As was found out in "Kamailio stops processing requests over UDP"
thread, db_mysql_submit_query() in some circumstances hangs when it
executes mysql_ping here:

        if (my_ping_interval) {
                t = time(0);
                if ((t - CON_TIMESTAMP(_h)) > my_ping_interval) {
                        for (i=0; i < (db_mysql_auto_reconnect ? 3 : 1); i++) {
                                if (mysql_ping(CON_CONNECTION(_h))) {
                                        LM_INFO("driver error on ping: %s\n", 
mysql_error(CON_CONNECTION(_h)));
                                        counter_inc(mysql_cnts_h.driver_err);
                                } else {
                                        break;
                                }
                        }
                }
        ...
     }

Comment in front of db_mysql_submit_query() function tells:

 * Send a SQL query to the database server. This methods tries to reconnect
 * to the server if the connection is gone and the auto_reconnect parameter is
 * enabled. It also issues a mysql_ping before the query to connect again after
 * a long waiting period because for some older mysql versions the auto 
reconnect
 * don't work sufficient. If auto_reconnect is enabled and the server supports 
it,
 * then the mysql_ping is probably not necessary, but its safer to do it in this
 * cases too.
 *

The text was most likely written many years ago and auto reconnect now
works OK in mysql versions in use today.

I would like to test if the hangup could be prevented without the above
code. Would it be possible to make the code optional via a compilation
flag or by some other means?

-- Juha

_______________________________________________
Kamailio (SER) - Development Mailing List
[email protected]
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev

Reply via email to