-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

The MySQL error occurs quite often, several times every day. The app has
about 20000 page views daily and heavily communicates with db (tens of
queries per request, in db I have about 100 tables). Currently I have
pool with size for 10 connections.

Meaning of the error message is described here:

http://dev.mysql.com/doc/refman/4.1/en/commands-out-of-sync.html

It seems that with MySQL statements on the same db connection have to be
exhausted one-by-one, never in parallel. Two statements returning data
to the process must be using separate DBConnections (possibly to the
same host/db). Multiple statements on the same connection are supported,
but only 1 may be in a state to 'fetch' data.

Traces for the errors look like this:

  File "/opt/web2py/gluon/sql.py", line 3378, in count
    return self.select('count(*)')[0]._extra['count(*)']
  File "/opt/web2py/gluon/sql.py", line 3237, in select
    rows = response(query)
  File "/opt/web2py/gluon/sql.py", line 3232, in response
    db._execute(query)
  File "/opt/web2py/gluon/sql.py", line 977, in <lambda>
    self._execute = lambda *a, **b: self._cursor.execute(*a, **b)
  File "/var/lib/python-support/python2.5/MySQLdb/cursors.py", line 166,
in execute
    self.errorhandler(self, exc, value)
  File "/var/lib/python-support/python2.5/MySQLdb/connections.py", line
35, in defaulterrorhandler
    raise errorclass, errorvalue
ProgrammingError: (2014, "Commands out of sync; you can't run this
command now")

Or e.g.:

Traceback (most recent call last):
  File "/opt/web2py/gluon/main.py", line 475, in wsgibase
    BaseAdapter.close_all_instances(BaseAdapter.rollback)
  File "/opt/web2py/gluon/sql.py", line 810, in close_all_instances
    action(instance)
  File "/opt/web2py/gluon/sql.py", line 1393, in rollback
    self._connection.rollback()
ProgrammingError: (2014, "Commands out of sync; you can't run this
command now")

Do you have any tips how to aviod these errors?

Thanks!

- --
David Zejda
Sbírka na operaci pro pětiletou Vanessu
http://www.tabang.eu
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkzXu3oACgkQ3oCkkciamVEXdACeJOUPZt8d3yDvgNNNY6V8HDmX
TvEAnid88S+V2I7OV9XLR1Kq/etu92kM
=iP7t
-----END PGP SIGNATURE-----

Reply via email to