[Serusers] mysql dies -- accounting stopped -- call continues

SIP sip at arcdiv.com
Thu May 24 14:56:16 CEST 2007


I have not tried it in 2.0, but logically, I would assume it is, as it's 
an issue with the mysql socket itself. Unless the code has already been 
changed for the mysql socket connection in 2.0, it would remain a problem.

N.


Greger V. Teigre wrote:
> Excellent! Has this been verified to be a problem for 2.0?
> g-)
>
> SIP wrote:
>> No problem. I've now added this information to the FAQ:
>>
>> http://www.iptel.org/faq/why_does_my_mysql_5_0_x_connection_time_out_when_using_ser_0_9_x
>>
>>
>>
>> N.
>>
>>
>>
>> Andrey Kuprianov wrote:
>>   
>>> Nice! Thanx.
>>>
>>> On 5/24/07, SIP <sip at arcdiv.com> wrote:
>>>   
>>>     
>>>> Check the archives. I've answered this a couple of times already.
>>>>
>>>> mysql 5.0.X has modified the default behaviour of how the socket timeout
>>>> works. By default, it times out connections after a period of time. There
>>>> was a patch after about 5.0.12 to allow people to modify this behaviour, but
>>>> the patch didn't work until 5.0.19.
>>>>
>>>> In order to get SER 0.9.X to work with 5.0.19 and above and reconnect after
>>>> a timed out socket, you need to modify the my_con.c in
>>>> $SER-SRC/modules/mysql and recompile the mysql module.
>>>>
>>>> I've attached a modified my_con.c file that has the correct options to
>>>> utilise the patched mysql code. It will fix the reconnect issues (allowing
>>>> SER to reconnect once the socket has timed out).
>>>>
>>>> N.
>>>>
>>>>
>>>>
>>>> Andrey Kuprianov wrote:
>>>> Im also having this problem. I even upgraded SER to 0.9.7-pre8, but
>>>>     
>>>>       
>>> still
>>>   
>>>     
>>>> the same.
>>>>     
>>>>       
>>> I tend to think, though, that this is a MySQL version problem.
>>>   
>>>     
>>>> I
>>>>     
>>>>       
>>> installed MySQL 5.0 from Ubuntu's packages. I think reinstalling MySQL
>>> or
>>>   
>>>     
>>>> just upgrading it (or maybe downgrading to 4.1), should do the
>>>>     
>>>>       
>>> trick.
>>>
>>> On
>>>   
>>>     
>>>> 5/24/07, Nhadie <nhadie at tbgi.net.ph> wrote:
>>>>     
>>>>       
>>>   
>>>     
>>>> Hi All
>>>>     
>>>>       
>>> How can i make sure that when mysql dies, ser will not allow calls
>>>   
>>>     
>>>> anymore?
>>>>     
>>>>       
>>> Because i had a problem, when mysql died, ser still continued to
>>>   
>>>     
>>>> allow
>>>>     
>>>>       
>>> calls and i was not able to account it.
>>>
>>> How can i resolve this. Thank
>>>   
>>>     
>>>> You in
>>>> Advance.
>>>>     
>>>>       
>>> Regards
>>> Ronald
>>>
>>>
>>>
>>>
>>> _______________________________________________
>>> Serusers
>>>   
>>>     
>>>> mailing
>>>> list
>>>>     
>>>>       
>>> Serusers at lists.iptel.org
>>> http://lists.iptel.org/mailman/listinfo/serusers
>>>
>>>   
>>>     
>>>> _______________________________________________
>>>>     
>>>>       
>>> Serusers
>>>   
>>>     
>>>> mailing
>>>> list
>>>>     
>>>>       
>>> Serusers at lists.iptel.org
>>> http://lists.iptel.org/mailman/listinfo/serusers
>>>   
>>>     
>>>> /*
>>>>  * $Id: my_con.c,v 1.2 2004/08/03 17:22:06 janakj Exp $
>>>>  *
>>>>  *
>>>>  * Copyright (C) 2001-2004 iptel.org
>>>>  *
>>>>  * This file is part of ser, a free SIP server.
>>>>  *
>>>>  * ser is free software; you can redistribute it and/or modify
>>>>  * it under the terms of the GNU General Public License as published by
>>>>  * the Free Software Foundation; either version 2 of the License, or
>>>>  * (at your option) any later version
>>>>  *
>>>>  * For a license to use the ser software under conditions
>>>>  * other than those described here, or to purchase support for this
>>>>  * software, please contact iptel.org by e-mail at the following addresses:
>>>>  *    info at iptel.org
>>>>  *
>>>>  * ser is distributed in the hope that it will be useful,
>>>>  * but WITHOUT ANY WARRANTY; without even the implied warranty of
>>>>  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
>>>>  * GNU General Public License for more details.
>>>>  *
>>>>  * You should have received a copy of the GNU General Public License
>>>>  * along with this program; if not, write to the Free Software
>>>>  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
>>>>  */
>>>>
>>>> #include <string.h>
>>>> #include <time.h>
>>>> #include "my_con.h"
>>>> #include "../../mem/mem.h"
>>>> #include "../../dprint.h"
>>>> #include "utils.h"
>>>>
>>>>
>>>> /*
>>>>  * Create a new connection structure,
>>>>  * open the MySQL connection and set reference count to 1
>>>>  */
>>>> struct my_con* new_connection(struct my_id* id)
>>>> {
>>>>        struct my_con* ptr;
>>>>        my_bool my_true;
>>>>        my_true=1;
>>>>
>>>>        if (!id) {
>>>>                LOG(L_ERR, "new_connection(): Invalid parameter value\n");
>>>>                return 0;
>>>>        }
>>>>
>>>>        ptr = (struct my_con*)pkg_malloc(sizeof(struct
>>>> my_con));
>>>>        if (!ptr) {
>>>>                LOG(L_ERR, "new_connection(): No memory left\n");
>>>>                return 0;
>>>>        }
>>>>
>>>>        memset(ptr, 0, sizeof(struct my_con));
>>>>        ptr->ref = 1;
>>>>
>>>>        ptr->con = (MYSQL*)pkg_malloc(sizeof(MYSQL));
>>>>        if (!ptr->con) {
>>>>                LOG(L_ERR, "new_connection(): No enough memory\n");
>>>>                goto err;
>>>>        }
>>>>
>>>>        mysql_init(ptr->con);
>>>>        mysql_options(ptr->con, MYSQL_OPT_RECONNECT, &my_true);
>>>>
>>>>        if (!mysql_real_connect(ptr->con, id->host.s, id->username.s,
>>>> id->password.s, id->database.s, id->port, 0, 0)) {
>>>>                LOG(L_ERR, "new_connection(): %s\n", mysql_error(ptr->con));
>>>>                mysql_close(ptr->con);
>>>>                goto err;
>>>>        }
>>>>
>>>>        ptr->timestamp = time(0);
>>>>
>>>>        ptr->id = id;
>>>>        return ptr;
>>>>
>>>>  err:
>>>>        if (ptr && ptr->con) pkg_free(ptr->con);
>>>>        if (ptr) pkg_free(ptr);
>>>>        return 0;
>>>> }
>>>>
>>>>
>>>> /*
>>>>  * Close the connection and release memory
>>>>  */
>>>> void free_connection(struct my_con* con)
>>>> {
>>>>        if (!con) return;
>>>>        if (con->res) mysql_free_result(con->res);
>>>>        if (con->id) free_my_id(con->id);
>>>>        if (con->con) {
>>>>                mysql_close(con->con);
>>>>                pkg_free(con->con);
>>>>        }
>>>>        pkg_free(con);
>>>> }
>>>>
>>>>
>>>>     
>>>>       
>>> _______________________________________________
>>> Serusers mailing list
>>> Serusers at lists.iptel.org
>>> http://lists.iptel.org/mailman/listinfo/serusers
>>>   
>>>     
>>
>> _______________________________________________
>> Serusers mailing list
>> Serusers at lists.iptel.org
>> http://lists.iptel.org/mailman/listinfo/serusers
>>
>>
>>   




More information about the sr-users mailing list