Inaki,
I am doing updates with avp_db_query, so there is no avp I can check the value of . As I said in a subsequent post, I wrote a simple server that listened on port 3306, like mysql does, and pointed OpenSER at it. The avp_db_query commands() basically blocked forever and openser seemed to completely lose all ability to process new calls. That's really bad.
Doug.
----- Original Message ---- From: Iñaki Baz Castillo ibc@aliax.net To: users@lists.openser.org Sent: Monday, January 14, 2008 1:46:00 PM Subject: Re: [OpenSER-Users] avp_db_query() timeout
El Lunes, 14 de Enero de 2008, Douglas Garstang escribió:
I haven't had much luck getting replies to my questions lately,
hopefully
I'll have more luck with this one.
avp_db_query().... does it have a timeout? What is it? Can I set it?
If I use it, and there is a MySQL database problem, I don't want avp_db_query() to wait forever trying to connect to MySQL. If it
can't
connect after a few seconds, I'd like it to just give up. I have
multiple
calls to avp_db_query() in a typical call flow. It would be even
better if
I could set a flag on the first timeout and not try again during that
call.
Can that be done?
Hi, by the test I've done:
avp_db_query("SQL_QUERY", "$avp(s:result)"); xlog("L_INFO", "retcode = $rc \n");
Cases:
- If query doesn't return a row/value then $avp(s:result)=null and $rc=(-1).
- If query returns a row/value the $avp(s_result) stores that value and $rc=1.
- If there is a syntax error in query then $avp(s:result)=null and $rc=(-1).
- If MySQL is not running then $avp(s:result)=null and $rc=(-1).
I don't know what occurs if MySQL is running but because overload or any other reason it doesn't reply, but AFAIK the "avp_db_query" uses the same code of other OpenSer functions to access DB, so I'm sure it has a correct behaviour in case of failure.
BTW you can "play" with the $rc code after "avp_db_query".
On Monday 14 January 2008, Douglas Garstang wrote:
Inaki,
I am doing updates with avp_db_query, so there is no avp I can check the value of . As I said in a subsequent post, I wrote a simple server that listened on port 3306, like mysql does, and pointed OpenSER at it. The avp_db_query commands() basically blocked forever and openser seemed to completely lose all ability to process new calls. That's really bad.
Hi Douglas,
thats a know problems with the mysql driver, and the reason we wrote some time ago the mysql-mt module (on the tracker). This code is currently not maintained and also don't work that well with a current openser because of multi-threading issues.
The openser blocks on db connection problems for the TCP timeout.
Cheers,
Henning
Hi Henning,
The problem is actually in the libmysqlclient library, which deals with the TCP connection. I never got into its API, but maybe it pays the effort to take a look and see if the TCP timeout is configurable.
Regards, bogdan
Henning Westerholt wrote:
On Monday 14 January 2008, Douglas Garstang wrote:
Inaki,
I am doing updates with avp_db_query, so there is no avp I can check the value of . As I said in a subsequent post, I wrote a simple server that listened on port 3306, like mysql does, and pointed OpenSER at it. The avp_db_query commands() basically blocked forever and openser seemed to completely lose all ability to process new calls. That's really bad.
Hi Douglas,
thats a know problems with the mysql driver, and the reason we wrote some time ago the mysql-mt module (on the tracker). This code is currently not maintained and also don't work that well with a current openser because of multi-threading issues.
The openser blocks on db connection problems for the TCP timeout.
Cheers,
Henning
Users mailing list Users@lists.openser.org http://lists.openser.org/cgi-bin/mailman/listinfo/users
On Tuesday 15 January 2008, Bogdan-Andrei Iancu wrote:
Hi Henning,
The problem is actually in the libmysqlclient library, which deals with the TCP connection. I never got into its API, but maybe it pays the effort to take a look and see if the TCP timeout is configurable.
Hi Bogdan,
its configurable on kernel level of course. And for recent mysql versions i found two parameters (MYSQL_OPT_READ_TIMEOU, ..WRITE..) in the documentation http://dev.mysql.com/doc/refman/5.1/en/mysql-options.html
Douglas, perhaps you could try your test server with this options hacked in the driver and a recent mysql version? Would be great to know if it works this way. :-)
Cheers,
Henning
Hi Henning,
Thanks for the info - of course hacking kernel cfgs is not a nice option, but if the mysql lib allows this via API, it will be wonderful ;)
Regards, Bogdan
Henning Westerholt wrote:
On Tuesday 15 January 2008, Bogdan-Andrei Iancu wrote:
Hi Henning,
The problem is actually in the libmysqlclient library, which deals with the TCP connection. I never got into its API, but maybe it pays the effort to take a look and see if the TCP timeout is configurable.
Hi Bogdan,
its configurable on kernel level of course. And for recent mysql versions i found two parameters (MYSQL_OPT_READ_TIMEOU, ..WRITE..) in the documentation http://dev.mysql.com/doc/refman/5.1/en/mysql-options.html
Douglas, perhaps you could try your test server with this options hacked in the driver and a recent mysql version? Would be great to know if it works this way. :-)
Cheers,
Henning