Re: MySQL: Commands out of sync; you can't run this command now

Maciej (Matchek) Bliziński <[email protected]>
Newsgroups gmane.comp.python.sqlobject
Message-ID <CALtRa-7a5W0=dhhjpWpnzBT5E4p9nBuNeCTF2ViZEr=qX5xX-Q@mail.gmail.com>
2013/4/16 Oleg Broytman <[email protected]>
>
> On Tue, Apr 16, 2013 at 10:52:29AM +0100, "Maciej (Matchek) Blizi??ski" <[email protected]> wrote:
> >   File "/opt/csw/lib/python/site-packages/sqlobject/mysql/mysqlconnection.py",
> > line 71, in makeConnection
> >     conn.ping(True) # Attempt to reconnect. This setting is persistent.
> > ProgrammingError: (2014, "Commands out of sync; you can't run this command now")
>
>    conn.ping() is intended to reopen the connection after a timeout;
> AFAIR the default timeout is 3600 seconds, not a few minutes. There
> shouldn't be any problem with ping after a minute or two.
>
>    "Commands out of sync"means the application calls functions in the
> wrong order:
> https://dev.mysql.com/doc/refman/5.1/en/commands-out-of-sync.html
>    Is the app multithreaded? Could it be the app tries to reuse the same
> transaction in different threads?

That was my suspicion too, but it's an wsgi application which doesn't
use threads. I experimented by reducing the number of wsgi application
copies / threads in Apache config to 1. It didn't help, so it's
probably not that.

I've got an update: I noticed that MySQLdb[1] has a new version (1.2.4)
so I upgraded it and the problem seems to have gone away. Maybe it was
some interplay between SqlObject and the MySQL driver for Python, or
just simply the db driver had a problem.

Maciej

[1] https://pypi.python.org/pypi/MySQL-python

------------------------------------------------------------------------------
Try New Relic Now & We'll Send You this Cool Shirt
New Relic is the only SaaS-based application performance monitoring service 
that delivers powerful full stack analytics. Optimize and monitor your
browser, app, & servers with just a few lines of code. Try New Relic
and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_apr
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.