Skip to content
This repository has been archived by the owner on Sep 4, 2023. It is now read-only.

Exception in Thread #7

Open
image357 opened this issue Jun 19, 2020 · 1 comment
Open

Exception in Thread #7

image357 opened this issue Jun 19, 2020 · 1 comment

Comments

@image357
Copy link

Hey,

when I run a recorder and stop it, sometimes the event thread throws an exception:

Exception in thread Thread-98:
Traceback (most recent call last):
  File "/usr/lib64/python3.7/threading.py", line 926, in _bootstrap_inner
    self.run()
  File "/usr/lib64/python3.7/threading.py", line 870, in run
    self._target(*self._args, **self._kwargs)
  File "/home/koepke/.local/share/virtualenvs/keylogger_tests-PqRXr-0S/lib/python3.7/site-packages/sneakysnek/recorders/linux_recorder.py", line 54, in start_keyboard_recording
    lambda r: self.event_handler(self.display_record_keyboard, r)
  File "/home/koepke/.local/share/virtualenvs/keylogger_tests-PqRXr-0S/lib/python3.7/site-packages/Xlib/ext/record.py", line 243, in enable_context
    context = context)
  File "/home/koepke/.local/share/virtualenvs/keylogger_tests-PqRXr-0S/lib/python3.7/site-packages/Xlib/ext/record.py", line 220, in __init__
    rq.ReplyRequest.__init__(self, *args, **keys)
  File "/home/koepke/.local/share/virtualenvs/keylogger_tests-PqRXr-0S/lib/python3.7/site-packages/Xlib/protocol/rq.py", line 1369, in __init__
    self.reply()
  File "/home/koepke/.local/share/virtualenvs/keylogger_tests-PqRXr-0S/lib/python3.7/site-packages/Xlib/protocol/rq.py", line 1381, in reply
    self._display.send_and_recv(request = self._serial)
  File "/home/koepke/.local/share/virtualenvs/keylogger_tests-PqRXr-0S/lib/python3.7/site-packages/Xlib/protocol/display.py", line 599, in send_and_recv
    count = self.recv_packet_len - len(self.data_recv)
TypeError: object of type 'NoneType' has no len()
Exception in thread Thread-99:
Traceback (most recent call last):
  File "/usr/lib64/python3.7/threading.py", line 926, in _bootstrap_inner
    self.run()
  File "/usr/lib64/python3.7/threading.py", line 870, in run
    self._target(*self._args, **self._kwargs)
  File "/home/koepke/.local/share/virtualenvs/keylogger_tests-PqRXr-0S/lib/python3.7/site-packages/sneakysnek/recorders/linux_recorder.py", line 62, in start_mouse_recording
    lambda r: self.event_handler(self.display_record_mouse, r)
  File "/home/koepke/.local/share/virtualenvs/keylogger_tests-PqRXr-0S/lib/python3.7/site-packages/Xlib/ext/record.py", line 243, in enable_context
    context = context)
  File "/home/koepke/.local/share/virtualenvs/keylogger_tests-PqRXr-0S/lib/python3.7/site-packages/Xlib/ext/record.py", line 220, in __init__
    rq.ReplyRequest.__init__(self, *args, **keys)
  File "/home/koepke/.local/share/virtualenvs/keylogger_tests-PqRXr-0S/lib/python3.7/site-packages/Xlib/protocol/rq.py", line 1369, in __init__
    self.reply()
  File "/home/koepke/.local/share/virtualenvs/keylogger_tests-PqRXr-0S/lib/python3.7/site-packages/Xlib/protocol/rq.py", line 1381, in reply
    self._display.send_and_recv(request = self._serial)
  File "/home/koepke/.local/share/virtualenvs/keylogger_tests-PqRXr-0S/lib/python3.7/site-packages/Xlib/protocol/display.py", line 599, in send_and_recv
    count = self.recv_packet_len - len(self.data_recv)
TypeError: object of type 'NoneType' has no len()

I'm running Fedora with the newest packages.
To reproduce run:

from sneakysnek.recorder import Recorder
import time

while True:
    recorder = Recorder.record(print)
    time.sleep(1)
    recorder.stop()

It must have something to do with initialization time, because when I run:

from sneakysnek.recorder import Recorder

recorder = Recorder.record(print)
recorder.stop()

I get a similar exception every time:

Exception in thread Thread-2:
Traceback (most recent call last):
  File "/usr/lib64/python3.7/threading.py", line 926, in _bootstrap_inner
    self.run()
  File "/usr/lib64/python3.7/threading.py", line 870, in run
    self._target(*self._args, **self._kwargs)
  File "/home/koepke/.local/share/virtualenvs/keylogger_tests-PqRXr-0S/lib/python3.7/site-packages/sneakysnek/recorders/linux_recorder.py", line 54, in start_keyboard_recording
    lambda r: self.event_handler(self.display_record_keyboard, r)
  File "/home/koepke/.local/share/virtualenvs/keylogger_tests-PqRXr-0S/lib/python3.7/site-packages/Xlib/ext/record.py", line 243, in enable_context
    context = context)
  File "/home/koepke/.local/share/virtualenvs/keylogger_tests-PqRXr-0S/lib/python3.7/site-packages/Xlib/ext/record.py", line 220, in __init__
    rq.ReplyRequest.__init__(self, *args, **keys)
  File "/home/koepke/.local/share/virtualenvs/keylogger_tests-PqRXr-0S/lib/python3.7/site-packages/Xlib/protocol/rq.py", line 1369, in __init__
    self.reply()
  File "/home/koepke/.local/share/virtualenvs/keylogger_tests-PqRXr-0S/lib/python3.7/site-packages/Xlib/protocol/rq.py", line 1381, in reply
    self._display.send_and_recv(request = self._serial)
  File "/home/koepke/.local/share/virtualenvs/keylogger_tests-PqRXr-0S/lib/python3.7/site-packages/Xlib/protocol/display.py", line 509, in send_and_recv
    for req, wait in self.request_queue:
TypeError: 'NoneType' object is not iterable
Exception in thread Thread-3:
Traceback (most recent call last):
  File "/usr/lib64/python3.7/threading.py", line 926, in _bootstrap_inner
    self.run()
  File "/usr/lib64/python3.7/threading.py", line 870, in run
    self._target(*self._args, **self._kwargs)
  File "/home/koepke/.local/share/virtualenvs/keylogger_tests-PqRXr-0S/lib/python3.7/site-packages/sneakysnek/recorders/linux_recorder.py", line 62, in start_mouse_recording
    lambda r: self.event_handler(self.display_record_mouse, r)
  File "/home/koepke/.local/share/virtualenvs/keylogger_tests-PqRXr-0S/lib/python3.7/site-packages/Xlib/ext/record.py", line 243, in enable_context
    context = context)
  File "/home/koepke/.local/share/virtualenvs/keylogger_tests-PqRXr-0S/lib/python3.7/site-packages/Xlib/ext/record.py", line 220, in __init__
    rq.ReplyRequest.__init__(self, *args, **keys)
  File "/home/koepke/.local/share/virtualenvs/keylogger_tests-PqRXr-0S/lib/python3.7/site-packages/Xlib/protocol/rq.py", line 1369, in __init__
    self.reply()
  File "/home/koepke/.local/share/virtualenvs/keylogger_tests-PqRXr-0S/lib/python3.7/site-packages/Xlib/protocol/rq.py", line 1381, in reply
    self._display.send_and_recv(request = self._serial)
  File "/home/koepke/.local/share/virtualenvs/keylogger_tests-PqRXr-0S/lib/python3.7/site-packages/Xlib/protocol/display.py", line 599, in send_and_recv
    count = self.recv_packet_len - len(self.data_recv)
TypeError: object of type 'NoneType' has no len()

It's not a dealbreaker because the recorder stops as expected. But still, there might be some unfinished resource cleanup or similar when it stops due to an exception (?)

Any ideas?

@emceef94
Copy link

Hello,
did anyone else have the problem or any similar ones?

I encountered the same error as above & also:
xlib.error.Display Connection Error maximum number of clients reached

When playing with .start()/.stop()

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants