[sr-dev] MySQL weirdness - timeout does not work

Klaus Darilion klaus.mailinglists at pernau.at
Mon May 18 13:31:54 CEST 2015



On 15.05.2015 22:48, Daniel-Constantin Mierla wrote:
> 
> 
> On 15/05/15 21:55, Klaus Darilion wrote:
>> Am 15.05.2015 um 17:54 schrieb Klaus Darilion:
>>> Hi Daniel!
>>>
>>> On 08.05.2015 15:33, Daniel-Constantin Mierla wrote:
>>>> Hello,
>>>>
>>>> On 08/05/15 15:13, Klaus Darilion wrote:
>>>>> Hi!
>>>>>
>>>>> (Kamailio 4.2.2 on Debian Squeeze with libmysqlclient16 5.1.73)
>>>>>
>>>>> I have a problem that a lost TCP connection is not detected by
>>>>> Kamailio/MySQL-CLient and this blocks the Kamailio process for 15
>>>>> minutes until Linux reports the TCP connection as broken.
>>>>>
>>>>> I am using db_mysql with the default settings. Thus, according to the
>>>>> db_mysql README, the default timeout_interval() of 2 seconds should
>>>>> be used.
>>>>>
>>>>> As this is not the case I took a look at the code and got confused: it
>>>>> seems there are 2 different mysql modules in modules/db_mysql, eg: the
>>>>> interface is defined in mysql_mod.c and km_db_mysql.c. Which one is
>>>>> actually used? I see they have different timeout setting code.
>>>>>
>>>>> Any hints on why the timeout is not working?
>>>> the files starting with km_* are used by kamailio modules. The other
>>>> are
>>>> for db api v2, used by few modules inherited from ser (those prefixed
>>>> with uid_*).
>>> I checked the code and the timeouts are correctly initialized.
>>>
>>> During all my tests Kamailio behaves correct and the lost TCP connection
>>> is detected after the configured timeout.
>>>
>>> But what drives my nuts is: it does not work on my production server. Do
>>> you have any ideas what could be the case that the timeout is not
>>> detected?
>>
>> I think it is related to the debugger module. First tests show that
>> the mysql timeout works if the debugger module is not loaded. Is there
>> a known issue, e.g. with signal handlers, when the debugger module is
>> loaded?
>>
> I am not aware of issues and I don't remember debugger module
> overwriting any signal handler. What parameters do you set for debugger
> module?

It seems that I was wrong. After I enabled the debugger module again, it
still works. Maybe it only worked due to the restart and the problem
starts only after a certain uptime.

Once I connected with strace to the process which waited for a mysql
timeout and the timeout did not worked. The strace output was (a few
times per second):

sigreturn()                             = ? (mask now [])
read(6, 0xa395f60, 16384)               = -1 EINTR (Interrupted system call)
--- SIGALRM (Alarm clock) @ 0 (0) ---
sigreturn()                             = ? (mask now [])
read(6, 0xa395f60, 16384)               = -1 EINTR (Interrupted system call)
--- SIGALRM (Alarm clock) @ 0 (0) ---
sigreturn()                             = ? (mask now [])
read(6, 0xa395f60, 16384)               = -1 EINTR (Interrupted system call)
--- SIGALRM (Alarm clock) @ 0 (0) ---

Do you have an idea what that could be related too?

Thanks
Klaus






More information about the sr-dev mailing list