Scheduler workers crash on usage of urllib

230 views
Skip to first unread message

Ryan Herbert

unread,
Dec 6, 2017, 10:39:11 AM12/6/17
to web2py-users
Hello,
I am currently experiencing an issue with my scheduler workers crashing on startup with the following error:

Exception in thread Thread-1:
Traceback (most recent call last):
 
File "/usr/lib/python2.7/threading.py", line 801, in __bootstrap_inner
   
self.run()
 
File "/usr/share/vidjil/server/web2py/gluon/scheduler.py", line 637, in run
   
self.send_heartbeat(counter)
 
File "/usr/share/vidjil/server/web2py/gluon/scheduler.py", line 1161, in send_heartbeat
   
self.db._uri, folder=self.db._adapter.folder, decode_credentials=True)
 
File "/usr/share/vidjil/server/web2py/gluon/packages/dal/pydal/base.py", line 169, in __call__
    obj
= super(MetaDAL, cls).__call__(*args, **kwargs)
 
File "/usr/share/vidjil/server/web2py/gluon/packages/dal/pydal/base.py", line 474, in __init__
   
"Failure to connect, tried %d times:\n%s" % (attempts, tb)
RuntimeError: Failure to connect, tried 5 times:
Traceback (most recent call last):
 
File "/usr/share/vidjil/server/web2py/gluon/packages/dal/pydal/base.py", line 454, in __init__
   
self._adapter = adapter(**kwargs)
 
File "/usr/share/vidjil/server/web2py/gluon/packages/dal/pydal/adapters/__init__.py", line 40, in __call__
    obj
= super(AdapterMeta, cls).__call__(*args, **kwargs)
 
File "/usr/share/vidjil/server/web2py/gluon/packages/dal/pydal/adapters/base.py", line 368, in __init__
   
super(SQLAdapter, self).__init__(*args, **kwargs)
 
File "/usr/share/vidjil/server/web2py/gluon/packages/dal/pydal/adapters/base.py", line 50, in __init__
   
self._initialize_(do_connect)
 
File "/usr/share/vidjil/server/web2py/gluon/packages/dal/pydal/adapters/mysql.py", line 24, in _initialize_
    user
= self.credential_decoder(m.group('user'))
 
File "/usr/share/vidjil/server/web2py/gluon/packages/dal/pydal/base.py", line 403, in <lambda>
    credential_decoder
= lambda cred: urllib.unquote(cred)
NameError: global name 'urllib' is not defined

The workers are running inside a docker container and are started with the following command:
/usr/local/bin/gosu www-data python web2py.py -K myapp


I have made sure urllib is correctly installed, and as far as I can tell, it is. Or at least running a python shell and importing the module works. Does anyone have any insight as to why this might be happening ?

Thanks

Val K

unread,
Dec 6, 2017, 12:59:29 PM12/6/17
to web2py-users
Hi! 
Consider that is NameError, not ImportError. i.e. there is trying to use urllib without  import  

Ryan Herbert

unread,
Dec 7, 2017, 5:20:20 AM12/7/17
to web2py-users
Ah, yes you are right. However, this error isn't occuring in my own code, could it be an issue with this build of web2py (2.16.1-stable+timestamp.2017.11.14.05.54.25
(Running on nginx/1.10.3, Python 2.7.12) ) ?

Ryan Herbert

unread,
Dec 7, 2017, 7:26:33 AM12/7/17
to web2py-users
I found this issue: https://github.com/web2py/pydal/issues/498 which denotes my exact problem, so it should be fixed soon (?). Not entirely sure why this issue didn't come up when searching my error on google...

Massimo Di Pierro

unread,
Dec 16, 2017, 4:47:06 PM12/16/17
to web2py-users
fixed on gitghub. thanks for reporting it.

Antonio Salazar

unread,
Apr 6, 2018, 6:02:32 PM4/6/18
to web...@googlegroups.com
Shouldn't this warrant a new release? The last stable release is 2.16.1 and the fix is missing there.

Massimo Di Pierro

unread,
Apr 24, 2018, 5:43:26 PM4/24/18
to web2py-users
yes. asap.

ma...@kerkhofftech.ca

unread,
Jul 10, 2018, 10:41:58 AM7/10/18
to web2py-users
Hi,

Is there an update on this issue? https://github.com/web2py/pydal/pull/505 was merged January 7, but the most recent PyDAL release on PyPI and GitHub is still 17.11, from November 13 2017.

Thanks,
Matt Fox

Oasis Agano

unread,
Jul 11, 2018, 1:10:51 PM7/11/18
to web...@googlegroups.com
I ended up importing it my self in gluon/packages/dal/pydal/base.py.

with

import urllib
Reply all
Reply to author
Forward
0 new messages