Error during scheduled job

27 views
Skip to first unread message

Andre Kozaczka

unread,
May 26, 2016, 9:56:34 PM5/26/16
to web2py-users
I'm seeing this error occasionally from my scheduler:

 
File "/usr/lib/python2.7/ssl.py", line 341, in recv
   
return self.read(buflen)
 
File "/usr/lib/python2.7/ssl.py", line 260, in read
   
return self._sslobj.read(len)
 
File "/home/andre/web2py/gluon/scheduler.py", line 702, in <lambda>
    signal
.signal(signal.SIGTERM, lambda signum, stack_frame: sys.exit(1))
SystemExit: 1


After the error I'll then see a 
OperationalError: (2006, 'MySQL server has gone away')

Not quite sure what's going on... seems to happen when I'm running a longer (5 minutes or so) task. Perhaps an issue with PythonAnywhere?

Niphlod

unread,
May 27, 2016, 3:52:51 AM5/27/16
to web2py-users
nope, it's a mysql gotcha. it closes the connection without telling it did so. Try issuing a query every once in a while.

Andre Kozaczka

unread,
May 27, 2016, 9:01:22 AM5/27/16
to web2py-users

Per some searching earlier, my scheduled job looks like this:

db._adapter.close()

doStuff
()

db
._adapter.reconnect()

Which I thought would take care of the lost connection problem however I still see the error. I also tried wrapping the doStuff() function in an exception block so when an exception does popup I can still do the reconnect - but again, that doesn't seem to work. I'll try doing some occasional db queries to keep the connection alive (which seems janky as hell but hey, it's MySQL) but I'm also curious about this ssl.py error I'm seeing. Anyone come across that error or maybe can point me in a direction to search.

-Andre
Reply all
Reply to author
Forward
0 new messages