[storm] Storm and MySQL in WSGI environment - MySQL server run away

Steve Kieu msh.computing at gmail.com
Wed Jan 26 08:31:17 UTC 2011


Hello,

I am developing a simple WSGI application using storm and MySQL. The problem
is, after midnight ; or for some reason I restart MySQL server and my
application dies with 500 - and inside I have exception by Storm raised:

[Sun Jan 23 08:23:10 2011] [error] [client 169.173.0.179]   File
"/usr/local/lib/python2.6/dist-packages/storm/databases/mysql.py", line 106,
in execute
[Sun Jan 23 08:23:10 2011] [error] [client 169.173.0.179]     return
Connection.execute(self, statement, params, noresult)
[Sun Jan 23 08:23:10 2011] [error] [client 169.173.0.179]   File
"/usr/local/lib/python2.6/dist-packages/storm/database.py", line 227, in
execute
[Sun Jan 23 08:23:10 2011] [error] [client 169.173.0.179]
self._ensure_connected()
[Sun Jan 23 08:23:10 2011] [error] [client 169.173.0.179]   File
"/usr/local/lib/python2.6/dist-packages/storm/database.py", line 344, in
_ensure_connected
[Sun Jan 23 08:23:10 2011] [error] [client 169.173.0.179]     raise
DisconnectionError("Already disconnected")

Sometimes I got the error mesasge like ; MySQL has gonna away ....


To fix, just restart apache.

The problem is that storm tried to use existing connection and the server is
gone. Storm does not want to reinitialize the connection but raise
exception. In my code it is clearly that for each request I create a dsn and
a Store object like store = Store(create_database(dsn)). Unfortunately it
still reuse the connection somehow and then dies. (probably the python
environment is reusing these variable somehow)

To prove that is the issue I took a cgi to wsgi gateway from python PEP
somewhere, fix it a bit so I can convert the whole wsgi to use cgi. Now
problem goes away, I can restart mysql server but the application still
works as expected.

Any hint or help are very welcome.

Many thanks

-- 
Steve Kieu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ubuntu.com/archives/storm/attachments/20110126/22ac33ee/attachment.html>


More information about the storm mailing list