[sr-dev] MySQL - driver error on query: Commands out of sync; you can't run this command now

Johny Kadarisman Kwan jkr888 at gmail.com
Tue Nov 23 07:21:44 CET 2010


Hi,

Looks like this error occur after I switch db_mode to 1 for the
registrar functionality.
Switch back to mode 2 does seem to eliminate above error.


On Fri, Nov 19, 2010 at 4:10 AM, marius zbihlei <marius.zbihlei at 1and1.ro> wrote:
> On 11/19/2010 12:24 AM, Johny Kadarisman Kwan wrote:
>>
>> Hi there,
>>
>> I'm running Kamilio 3.0.3, at least that is showen on sercmd>core.version.
>>
>> following are other details:
>>
>> Server: kamailio (3.0.3 (i386/linux)) a22dc9
>> Mysql: 5.0.77
>> CentOS 5.5
>>
>>
>> On Thu, Nov 18, 2010 at 5:19 PM, Iñaki Baz Castillo<ibc at aliax.net>  wrote:
>>
>>>
>>> 2010/11/18 Johny Kadarisman Kwan<jkr888 at gmail.com>:
>>>
>>>>
>>>> /usr/local/sbin/kamailio[11693]: ERROR: db_mysql [km_dbase.c:117]:
>>>> driver error on query: Commands out of sync; you can't run this
>>>> command now
>>>>
>>>
>>> This error occurs when two MySQL requests sharing the same TCP
>>> connection are sent one after the other, without waiting for the
>>> response of the first one. This problem can arise when two threads or
>>> two processes share the same MySQL connection and there is no a pool
>>> mechanism or a lock mechanism.
>>> This shouldn't occur in Kamailio as each process is supposed to
>>> mantain its own MySQL connections, so it seems a bug. Which version
>>> are you using?
>>>
>>>
>
> Hello
> Google suggests that this seems to happen when you don't free the result,
> and then issue another query (highly dependent on MySQL client version etc).
>
> "I think the real problem here is the order things happen in. A ROLLBACK or
> an AUTOCOMMIT query do not return a result set and thus do not need to be
> dealt with as you describe here. It is more likely that there is an existing
> result set that has not be explicitly freed in the PHP script and the PHP
> destructor for that result set is being called after the call to
> restore_connection_default. That's when you would get an out-of-sync error
> because the ROLLBACK is called with an outstanding result set. So, for those
> of you experiencing this problem, try explicitly calling mysql_free_result()
> on your result sets."
>
> This is from a thread on a php bug (from 2002)
> http://bugs.php.net/bug.php?id=19529
> Also this issue seem to plage some other known applications :
> http://forums.mysql.com/read.php?168,238786,238786 ;)
>
> After looking thru the code of auth_db that generated the error it seems
> that the digest_authenticate() method doesn't explicitly  free the result
> when the call to get_ha1() succeeds. AFAIK this should not be a problem (as
> the result is freed a liter later on by db_mysql module) Any other ideas...
> ?
>
> Marius
>>>
>>> --
>>>     Iñaki Baz Castillo
>>> <ibc at aliax.net>
>>>
>>>
>>
>> _______________________________________________
>> sr-dev mailing list
>> sr-dev at lists.sip-router.org
>> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev
>>
>>
>
>
> _______________________________________________
> sr-dev mailing list
> sr-dev at lists.sip-router.org
> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev
>



More information about the sr-dev mailing list