Per some searching 
<https://groups.google.com/forum/#%21searchin/web2py/scheduler$20MySQL$20db._adapter.close%28%29/web2py/U-hkmIc3TZM/NobLcSyMGncJ>
 
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




On Friday, May 27, 2016 at 3:52:51 AM UTC-4, Niphlod wrote:
>
> nope, it's a mysql gotcha. it closes the connection without telling it did 
> so. Try issuing a query every once in a while.
>
> On Friday, May 27, 2016 at 3:56:34 AM UTC+2, Andre Kozaczka wrote:
>>
>> 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?
>>
>>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to