p-hennessy / Bolt

All the parts for building a Discord robot
https://docs.bolt.bot/
MIT License
8 stars 6 forks source link

Gevent semaphore race condition when reconnecting #72

Open p-hennessy opened 6 years ago

p-hennessy commented 6 years ago
WARNING arcbot.discord.websocket.handle_websocket_close:70 'Socket closed unexpectedly'
DEBUG arcbot.discord.websocket.start:43 'Spawning Gateway Greenlet'
ERROR websocket.error:53 'error from callback <bound method Websocket.handle_websocket_close of <arcbot.discord.websocket.Websocket object at 0x7fca9e059470>>: maximum recursion depth exceeded while calling a Python object'
  File "/home/admin/Arcbot/.venv/lib/python3.6/site-packages/websocket/_app.py", line 269, in _callback
    callback(self, *args)
  File "/home/admin/Arcbot/arcbot/discord/websocket.py", line 78, in handle_websocket_close
    self.start()
  File "/home/admin/Arcbot/arcbot/discord/websocket.py", line 44, in start
    self.socket_url = f"{self.bot.api.get_gateway_bot()['url']}?v=6&encoding=json"
  File "/home/admin/Arcbot/arcbot/discord/api.py", line 31, in wrapper
    response = callback(self, *args, **kwargs)
  File "/home/admin/Arcbot/arcbot/discord/api.py", line 70, in get_gateway_bot
    headers=self.auth_headers
  File "/home/admin/Arcbot/.venv/lib/python3.6/site-packages/requests/api.py", line 72, in get
    return request('get', url, params=params, **kwargs)
  File "/home/admin/Arcbot/.venv/lib/python3.6/site-packages/requests/api.py", line 57, in request
    with sessions.Session() as session:
  File "/home/admin/Arcbot/.venv/lib/python3.6/site-packages/requests/sessions.py", line 386, in __init__
    self.mount('https://', HTTPAdapter())
  File "/home/admin/Arcbot/.venv/lib/python3.6/site-packages/requests/adapters.py", line 126, in __init__
    self.init_poolmanager(pool_connections, pool_maxsize, block=pool_block)
  File "/home/admin/Arcbot/.venv/lib/python3.6/site-packages/requests/adapters.py", line 162, in init_poolmanager
    block=block, strict=True, **pool_kwargs)
  File "/home/admin/Arcbot/.venv/lib/python3.6/site-packages/urllib3/poolmanager.py", line 155, in __init__
    dispose_func=lambda p: p.close())
  File "/home/admin/Arcbot/.venv/lib/python3.6/site-packages/urllib3/_collections.py", line 48, in __init__
    self.lock = RLock()
  File "/usr/lib/python3.6/threading.py", line 84, in RLock
    return _PyRLock(*args, **kwargs)
  File "/usr/lib/python3.6/threading.py", line 98, in __init__
    self._block = _allocate_lock()
  File "src/gevent/_semaphore.py", line 263, in gevent._semaphore.BoundedSemaphore.__init__ (src/gevent/gevent._semaphore.c:5176)
DEBUG plugins.Advertise.say:79 'Sending message to channel 123456'

Not totally sure i understand what is happening here and this has been running for almost 2 years and this is the first time i've seen this error.