namboy94 / xdcc-dl

An XDCC File Downloader based on the irclib framework
GNU General Public License v3.0
62 stars 16 forks source link

AttributeError: 'NoneType' object has no attribute 'send' #11

Open splifter opened 4 years ago

splifter commented 4 years ago

I've no idea how to provide more info than the message itself. This happens after 30sec after receiving a package. By the amount of messages flying through the cli, it seems this happens to each thread:

Exception in thread Thread-29789:
Traceback (most recent call last):
  File "/usr/lib/python3.7/threading.py", line 917, in _bootstrap_inner
    self.run()
  File "/home/splifter/.local/lib/python3.7/site-packages/sentry_sdk/integrations/threading.py", line 69, in run
    reraise(*_capture_exception())
  File "/home/splifter/.local/lib/python3.7/site-packages/sentry_sdk/_compat.py", line 57, in reraise
    raise value
  File "/home/splifter/.local/lib/python3.7/site-packages/sentry_sdk/integrations/threading.py", line 67, in run
    return old_run_func(self, *a, **kw)
  File "/usr/lib/python3.7/threading.py", line 865, in run
    self._target(*self._args, **self._kwargs)
  File "/home/splifter/.local/lib/python3.7/site-packages/xdcc_dl/xdcc/XDCCClient.py", line 527, in acker
    self.xdcc_connection.socket.send(payload)
AttributeError: 'NoneType' object has no attribute 'send'
msdos commented 4 years ago

I'm having the same problem in a raspberrypi machine:

Exception in thread Thread-62324:
Traceback (most recent call last):
  File "/usr/lib/python3.7/threading.py", line 917, in _bootstrap_inner
    self.run()
  File "/home/pi/.local/venvs/xdcc-dl/lib/python3.7/site-packages/sentry_sdk/integrations/threading.py", line 69, in run
    reraise(*_capture_exception())
  File "/home/pi/.local/venvs/xdcc-dl/lib/python3.7/site-packages/sentry_sdk/_compat.py", line 57, in reraise
    raise value
  File "/home/pi/.local/venvs/xdcc-dl/lib/python3.7/site-packages/sentry_sdk/integrations/threading.py", line 67, in run
    return old_run_func(self, *a, **kw)
  File "/usr/lib/python3.7/threading.py", line 865, in run
    self._target(*self._args, **self._kwargs)
  File "/home/pi/.local/venvs/xdcc-dl/lib/python3.7/site-packages/xdcc_dl/xdcc/XDCCClient.py", line 527, in acker
    self.xdcc_connection.socket.send(payload)
AttributeError: 'NoneType' object has no attribute 'send'

Exception in thread Thread-62273:
Traceback (most recent call last):
  File "/usr/lib/python3.7/threading.py", line 917, in _bootstrap_inner
    self.run()
  File "/home/pi/.local/venvs/xdcc-dl/lib/python3.7/site-packages/sentry_sdk/integrations/threading.py", line 69, in run
    reraise(*_capture_exception())
  File "/home/pi/.local/venvs/xdcc-dl/lib/python3.7/site-packages/sentry_sdk/_compat.py", line 57, in reraise
    raise value
  File "/home/pi/.local/venvs/xdcc-dl/lib/python3.7/site-packages/sentry_sdk/integrations/threading.py", line 67, in run
    return old_run_func(self, *a, **kw)
  File "/usr/lib/python3.7/threading.py", line 865, in run
    self._target(*self._args, **self._kwargs)
  File "/home/pi/.local/venvs/xdcc-dl/lib/python3.7/site-packages/xdcc_dl/xdcc/XDCCClient.py", line 527, in acker
    self.xdcc_connection.socket.send(payload)
AttributeError: 'NoneType' object has no attribute 'send'
msdos commented 4 years ago

@splifter You can try an ugly workaround to always re-run the download automatically when the exception happens (to me this problem doesn't happen every 30s, it's random, so in my case it's worth it):

while [ "$ok" != true ]; do xdcc-dl "XDCC-DL-COMMAND" 2>&1 | tee /tmp/xdcc-dl.log; \
if ! grep -q AttributeError /tmp/xdcc-dl.log; then ok=true; fi; done

This calls the command again until AttributeError is not found anymore in the logs.