hackoregon / transportation-backend

Transportation backend repo - 2016 and 2017
8 stars 7 forks source link

RuntimeError: cannot release un-acquired lock #45

Closed sanjuroj closed 7 years ago

sanjuroj commented 7 years ago

@MikeTheCanuck, @leobender After monkey-patching commit was applied, I received this error when trying to run on a native Mac install (i.e. not in a docker container)

(venv) transportation-backend/transDjango$ ./manage.py runserver
Performing system checks...

System check identified no issues (0 silenced).
DEBUG:  CommitTransaction
DEBUG:  name: unnamed; blockState:       STARTED; state: INPROGR, xid/subid/cid: 0/1/0, nestlvl: 1, children: 
April 29, 2017 - 00:44:04
Django version 1.10.5, using settings 'transDjango.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CONTROL-C.
/Users/sanjuroIvy/Sites/hackoregon/transportation/transportation-backend/transDjango/transDjango/wsgi.py:19: RuntimeWarning: Monkey-patching not on the main thread; threading.main_thread().join() will hang from a greenlet
  from gevent import monkey; monkey.patch_all()
Unhandled exception in thread started by <function check_errors.<locals>.wrapper at 0x1145a1c80>
Traceback (most recent call last):
  File "/Users/sanjuroIvy/Sites/hackoregon/transportation/transportation-backend/venv/lib/python3.4/site-packages/django/utils/autoreload.py", line 226, in wrapper
    fn(*args, **kwargs)
  File "/Users/sanjuroIvy/Sites/hackoregon/transportation/transportation-backend/venv/lib/python3.4/site-packages/django/core/management/commands/runserver.py", line 142, in inner_run
    handler = self.get_handler(*args, **options)
  File "/Users/sanjuroIvy/Sites/hackoregon/transportation/transportation-backend/venv/lib/python3.4/site-packages/django/contrib/staticfiles/management/commands/runserver.py", line 27, in get_handler
    handler = super(Command, self).get_handler(*args, **options)
  File "/Users/sanjuroIvy/Sites/hackoregon/transportation/transportation-backend/venv/lib/python3.4/site-packages/django/core/management/commands/runserver.py", line 64, in get_handler
    return get_internal_wsgi_application()
  File "/Users/sanjuroIvy/Sites/hackoregon/transportation/transportation-backend/venv/lib/python3.4/site-packages/django/core/servers/basehttp.py", line 49, in get_internal_wsgi_application
    return import_string(app_path)
  File "/Users/sanjuroIvy/Sites/hackoregon/transportation/transportation-backend/venv/lib/python3.4/site-packages/django/utils/module_loading.py", line 20, in import_string
    module = import_module(module_path)
  File "/Users/sanjuroIvy/Sites/hackoregon/transportation/transportation-backend/venv/lib/python3.4/importlib/__init__.py", line 109, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 2254, in _gcd_import
  File "<frozen importlib._bootstrap>", line 2237, in _find_and_load
  File "<frozen importlib._bootstrap>", line 269, in __exit__
  File "<frozen importlib._bootstrap>", line 221, in release
RuntimeError: cannot release un-acquired lock
sanjuroj commented 7 years ago

The ./manage.py runserver works now. And the API queries sometimes work and sometimes fail. They often fail with "block forever" error below. There is another error below that might be relevant.

  File "/Users/sanjuroIvy/Sites/hackoregon/transportation/transportation-backend/venv/lib/python3.4/site-packages/gevent/_socket3.py", line 385, in recv_into
    self._wait(self._read_event)
  File "/usr/local/Cellar/python3/3.4.3/Frameworks/Python.framework/Versions/3.4/lib/python3.4/socket.py", line 374, in readinto
    return self._sock.recv_into(b)
  File "/Users/sanjuroIvy/Sites/hackoregon/transportation/transportation-backend/venv/lib/python3.4/site-packages/gevent/_socket3.py", line 157, in _wait
    self.hub.wait(watcher)
  File "/Users/sanjuroIvy/Sites/hackoregon/transportation/transportation-backend/venv/lib/python3.4/site-packages/gevent/_socket3.py", line 385, in recv_into
    self._wait(self._read_event)
  File "/Users/sanjuroIvy/Sites/hackoregon/transportation/transportation-backend/venv/lib/python3.4/site-packages/gevent/hub.py", line 651, in wait
    result = waiter.get()
  File "/Users/sanjuroIvy/Sites/hackoregon/transportation/transportation-backend/venv/lib/python3.4/site-packages/gevent/_socket3.py", line 157, in _wait
    self.hub.wait(watcher)
  File "/Users/sanjuroIvy/Sites/hackoregon/transportation/transportation-backend/venv/lib/python3.4/site-packages/gevent/hub.py", line 899, in get
    return self.hub.switch()
  File "/Users/sanjuroIvy/Sites/hackoregon/transportation/transportation-backend/venv/lib/python3.4/site-packages/gevent/hub.py", line 651, in wait
    result = waiter.get()
  File "/Users/sanjuroIvy/Sites/hackoregon/transportation/transportation-backend/venv/lib/python3.4/site-packages/gevent/hub.py", line 630, in switch
    return RawGreenlet.switch(self)
gevent.hub.LoopExit: ('This operation would block forever', <Hub at 0x12c4a15a0 select pending=0 ref=0>)
----------------------------------------
  File "/Users/sanjuroIvy/Sites/hackoregon/transportation/transportation-backend/venv/lib/python3.4/site-packages/gevent/hub.py", line 899, in get
    return self.hub.switch()
  File "/Users/sanjuroIvy/Sites/hackoregon/transportation/transportation-backend/venv/lib/python3.4/site-packages/gevent/hub.py", line 630, in switch
    return RawGreenlet.switch(self)
gevent.hub.LoopExit: ('This operation would block forever', <Hub at 0x111c75df0 select pending=0 ref=0>)