[sr-dev] [kamailio] Database timeout over SSL? (#406)

Tobias Lindgren notifications at github.com
Thu Nov 26 09:49:08 CET 2015


Ok, so I tested your code in a production system and just replacing the module didn't always seem to do the trick, I still ended up with messages like these:
```
Nov 25 15:35:26 /usr/sbin/kamailio[15053]: ERROR: db_mysql [km_dbase.c:128]: db_mysql_submit_query(): driver error on query: SSL connection error: socket layer receive error (2026)
Nov 25 15:35:26 /usr/sbin/kamailio[15053]: ERROR: <core> [db_query.c:235]: db_do_insert_cmd(): error while submitting query
```

The error above lead me to the conclusion that "mysql_ping()" wasn't performed on these requests. Dug into the MySQL C API and from what I understand the MYSQL_OPT_RECONNECT=true is only used by and acted upon by mysql_ping(), no query functions. So I decreased the "ping_interval" setting to:
```
modparam("db_mysql", "ping_interval", 5);
```
to force mysql_ping to run more frequently. This code has now been running for almost 24h on a production system and it looks promising. Made a small addition to your code to get a warning if connection ID changed after mysql_ping (see attached diff). Now I'm getting a few of these messages:
```
Nov 26 08:55:27 /usr/sbin/kamailio[29363]: WARNING: db_mysql [km_dbase.c:91]: db_mysql_submit_query(): mysql thread id changed due to reconnect in mysql_ping
```
but from what I can see no more failed INSERTs.

I'm thinking MYSQL_OPT_RECONNECT together with frequent mysql_ping()'s seems to have done the trick.

[mysql_ping.diff.txt](https://github.com/kamailio/kamailio/files/44746/mysql_ping.diff.txt)



---
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/406#issuecomment-159849980
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sip-router.org/pipermail/sr-dev/attachments/20151126/dd44ec96/attachment.html>


More information about the sr-dev mailing list