MySQL server has gone away - py4web

118 views
Skip to first unread message

Marcello

unread,
Feb 11, 2020, 4:58:11 PM2/11/20
to web2py-users
Hello,

I'm trying py4web and found something stragne.
Don't know if I'm making something wrong.

I'm having "MySQL server has gone away" error if I wait some time (about 10 minutes) betweeen page reloads...

I tested same thing with web2py and this problem did not happen...

Is it a bug or a problem here ?


Thanks
Marcello

Marcello

unread,
Feb 14, 2020, 5:31:58 PM2/14/20
to web2py-users
Hi,

Any informatiion about this ?
Nobody using py4web with mysql ??

Massimo Di Pierro

unread,
Feb 15, 2020, 6:30:58 AM2/15/20
to web2py-users
My guess is that there is some timeout in the mysql config example.
Can you repro with latest py4web?

Marcello

unread,
Feb 15, 2020, 7:15:38 AM2/15/20
to web2py-users
I'm with lastest version...

Shouldn't reconnect to db every page load ???
If the server stays 1 hour without serving pages, a reconnection is needed... or not ?

Massimo Di Pierro

unread,
Feb 16, 2020, 8:22:48 PM2/16/20
to web2py-users
The db fixture should automatiically try reconnect.

To help me debug can you edit py4web/core.py and add the line below:

 class DAL(pydal.DAL, Fixture):
     def on_request(self):
         threadsafevariable.ThreadSafeVariable.restore(ICECUBE)
+         db._adapter.reconnect() 

Does it solve the problem?

Marcello

unread,
Feb 16, 2020, 10:17:25 PM2/16/20
to web2py-users
I got this error:

  File "/home/parra/py4web/py4web/core.py", line 239, in on_request
    db._adapter.reconnect()
NameError: name 'db' is not defined

Massimo Di Pierro

unread,
Feb 17, 2020, 10:22:04 PM2/17/20
to web2py-users
sorry. My bad. try:

+    self._adapter.reconnect() 

Marcello

unread,
Feb 18, 2020, 6:35:47 AM2/18/20
to web2py-users
Hi Massimo,

Great !
Now worked fine...

Thanks

Massimo Di Pierro

unread,
Feb 20, 2020, 10:48:32 PM2/20/20
to web2py-users
Can you check which version of pydal you are using?
Need to decide whether to make this the default behavior

Marcello

unread,
Feb 21, 2020, 7:17:34 AM2/21/20
to web2py-users
It's  20191227.1
Reply all
Reply to author
Forward
0 new messages