Hello,<br><br>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:<br>
<br>[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<br>[Sun Jan 23 08:23:10 2011] [error] [client 169.173.0.179] return Connection.execute(self, statement, params, noresult)<br>
[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<br>[Sun Jan 23 08:23:10 2011] [error] [client 169.173.0.179] self._ensure_connected()<br>
[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<br>[Sun Jan 23 08:23:10 2011] [error] [client 169.173.0.179] raise DisconnectionError("Already disconnected")<br>
<br clear="all">Sometimes I got the error mesasge like ; MySQL has gonna away ....<br><br><br>To fix, just restart apache.<br><br>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)<br>
<br>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.<br>
<br>Any hint or help are very welcome. <br><br>Many thanks<br><br>-- <br>Steve Kieu<br>