Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Unsolicited replies can cause threading error #285

Open
DominicOram opened this issue Jun 1, 2020 · 0 comments
Open

Unsolicited replies can cause threading error #285

DominicOram opened this issue Jun 1, 2020 · 0 comments

Comments

@DominicOram
Copy link
Contributor

If unsolicited_reply is called periodically in a thread e.g.:

def get_data_unsolicited(self):
    timer = threading.Timer(0.1, self.get_data_unsolicited)
    timer.start
    self.handler.unsolicited_reply(b"TEST")

there will be an occasional stack trace of:

Exception in thread Thread-911:
Traceback (most recent call last):
  File "c:\instrument\apps\python\lib\threading.py", line 801, in __bootstrap_inner
    self.run()
  File "c:\instrument\apps\python\lib\threading.py", line 1072, in run
    self.function(*self.args, **self.kwargs)
  File "C:\Instrument\Apps\epics\support\DeviceEmulator\master\lewis_emulators\mecfrf\interfaces\stream_interface.py", line 48, in get_data_unsolicited
    handler.unsolicited_reply(b"TEST")
  File "c:\instrument\apps\python\lib\site-packages\lewis\adapters\stream.py", line 116, in unsolicited_reply
    self.push(b(reply + self._target.out_terminator))
  File "c:\instrument\apps\python\lib\asynchat.py", line 193, in push
    self.initiate_send()
  File "c:\instrument\apps\python\lib\asynchat.py", line 251, in initiate_send
    del self.producer_fifo[0]
IndexError: deque index out of range

This stack trace does not appear to affect whether the message is actually sent or not.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant