<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Excellent! Has this been verified to be a problem for 2.0?<br>
g-)<br>
<br>
SIP wrote:
<blockquote cite="mid:465584EC.1020005@arcdiv.com" type="cite">
  <pre wrap="">No problem. I've now added this information to the FAQ:

<a class="moz-txt-link-freetext" href="http://www.iptel.org/faq/why_does_my_mysql_5_0_x_connection_time_out_when_using_ser_0_9_x">http://www.iptel.org/faq/why_does_my_mysql_5_0_x_connection_time_out_when_using_ser_0_9_x</a>



N.



Andrey Kuprianov wrote:
  </pre>
  <blockquote type="cite">
    <pre wrap="">Nice! Thanx.

On 5/24/07, SIP <a class="moz-txt-link-rfc2396E" href="mailto:sip@arcdiv.com">&lt;sip@arcdiv.com&gt;</a> wrote:
  
    </pre>
    <blockquote type="cite">
      <pre wrap="">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
    
      </pre>
    </blockquote>
    <pre wrap="">still
  
    </pre>
    <blockquote type="cite">
      <pre wrap="">the same.
    
      </pre>
    </blockquote>
    <pre wrap="">I tend to think, though, that this is a MySQL version problem.
  
    </pre>
    <blockquote type="cite">
      <pre wrap="">I
    
      </pre>
    </blockquote>
    <pre wrap="">installed MySQL 5.0 from Ubuntu's packages. I think reinstalling MySQL
or
  
    </pre>
    <blockquote type="cite">
      <pre wrap="">just upgrading it (or maybe downgrading to 4.1), should do the
    
      </pre>
    </blockquote>
    <pre wrap="">trick.

On
  
    </pre>
    <blockquote type="cite">
      <pre wrap="">5/24/07, Nhadie <a class="moz-txt-link-rfc2396E" href="mailto:nhadie@tbgi.net.ph">&lt;nhadie@tbgi.net.ph&gt;</a> wrote:
    
      </pre>
    </blockquote>
    <pre wrap="">  
    </pre>
    <blockquote type="cite">
      <pre wrap="">Hi All
    
      </pre>
    </blockquote>
    <pre wrap="">
How can i make sure that when mysql dies, ser will not allow calls
  
    </pre>
    <blockquote type="cite">
      <pre wrap="">anymore?
    
      </pre>
    </blockquote>
    <pre wrap="">Because i had a problem, when mysql died, ser still continued to
  
    </pre>
    <blockquote type="cite">
      <pre wrap="">allow
    
      </pre>
    </blockquote>
    <pre wrap="">calls and i was not able to account it.

How can i resolve this. Thank
  
    </pre>
    <blockquote type="cite">
      <pre wrap="">You in
Advance.
    
      </pre>
    </blockquote>
    <pre wrap="">Regards
Ronald




_______________________________________________
Serusers
  
    </pre>
    <blockquote type="cite">
      <pre wrap="">mailing
list
    
      </pre>
    </blockquote>
    <pre wrap=""><a class="moz-txt-link-abbreviated" href="mailto:Serusers@lists.iptel.org">Serusers@lists.iptel.org</a>
<a class="moz-txt-link-freetext" href="http://lists.iptel.org/mailman/listinfo/serusers">http://lists.iptel.org/mailman/listinfo/serusers</a>

  
    </pre>
    <blockquote type="cite">
      <pre wrap="">_______________________________________________
    
      </pre>
    </blockquote>
    <pre wrap="">Serusers
  
    </pre>
    <blockquote type="cite">
      <pre wrap="">mailing
list
    
      </pre>
    </blockquote>
    <pre wrap=""><a class="moz-txt-link-abbreviated" href="mailto:Serusers@lists.iptel.org">Serusers@lists.iptel.org</a>
<a class="moz-txt-link-freetext" href="http://lists.iptel.org/mailman/listinfo/serusers">http://lists.iptel.org/mailman/listinfo/serusers</a>
  
    </pre>
    <blockquote type="cite">
      <pre wrap="">/*
 * $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:
 *    <a class="moz-txt-link-abbreviated" href="mailto:info@iptel.org">info@iptel.org</a>
 *
 * 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 &lt;string.h&gt;
#include &lt;time.h&gt;
#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-&gt;ref = 1;

       ptr-&gt;con = (MYSQL*)pkg_malloc(sizeof(MYSQL));
       if (!ptr-&gt;con) {
               LOG(L_ERR, "new_connection(): No enough memory\n");
               goto err;
       }

       mysql_init(ptr-&gt;con);
       mysql_options(ptr-&gt;con, MYSQL_OPT_RECONNECT, &amp;my_true);

       if (!mysql_real_connect(ptr-&gt;con, id-&gt;host.s, id-&gt;username.s,
id-&gt;password.s, id-&gt;database.s, id-&gt;port, 0, 0)) {
               LOG(L_ERR, "new_connection(): %s\n", mysql_error(ptr-&gt;con));
               mysql_close(ptr-&gt;con);
               goto err;
       }

       ptr-&gt;timestamp = time(0);

       ptr-&gt;id = id;
       return ptr;

 err:
       if (ptr &amp;&amp; ptr-&gt;con) pkg_free(ptr-&gt;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-&gt;res) mysql_free_result(con-&gt;res);
       if (con-&gt;id) free_my_id(con-&gt;id);
       if (con-&gt;con) {
               mysql_close(con-&gt;con);
               pkg_free(con-&gt;con);
       }
       pkg_free(con);
}


    
      </pre>
    </blockquote>
    <pre wrap="">_______________________________________________
Serusers mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Serusers@lists.iptel.org">Serusers@lists.iptel.org</a>
<a class="moz-txt-link-freetext" href="http://lists.iptel.org/mailman/listinfo/serusers">http://lists.iptel.org/mailman/listinfo/serusers</a>
  
    </pre>
  </blockquote>
  <pre wrap=""><!---->
_______________________________________________
Serusers mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Serusers@lists.iptel.org">Serusers@lists.iptel.org</a>
<a class="moz-txt-link-freetext" href="http://lists.iptel.org/mailman/listinfo/serusers">http://lists.iptel.org/mailman/listinfo/serusers</a>


  </pre>
</blockquote>
</body>
</html>