Skip to content

Threads are not exiting gracefully #8

Description

@MarkDannemiller
SerialException caught: ClearCommError failed (OSError(9, 'The handle is invalid.', None, 6))
SerialException caught: ClearCommError failed (OSError(9, 'The handle is invalid.', None, 6))
SerialException caught: ClearCommError failed (OSError(9, 'The handle is invalid.', None, 6))
SerialException caught: ClearCommError failed (OSError(9, 'The handle is invalid.', None, 6))
SerialException caught: ClearCommError failed (OSError(9, 'The handle is invalid.', None, 6))
SerialException caught: ClearCommError failed (OSError(9, 'The handle is invalid.', None, 6))
SerialException caught: ClearCommError failed (OSError(9, 'The handle is invalid.', None, 6))
SerialException caught: ClearCommError failed (OSError(9, 'The handle is invalid.', None, 6))
Exception in thread Thread-1 (serial_thread):
Traceback (most recent call last):
  File "C:\Users\priva\anaconda3\lib\threading.py", line 1016, in _bootstrap_inner
    self.run()
  File "C:\Users\priva\anaconda3\lib\threading.py", line 953, in run
    self._target(*self._args, **self._kwargs)
  File "C:\Users\priva\Dropbox\Github\TF-Python-Serial\python-serial\src\thermoflex\tools\nodeserial.py", line 149, in serial_thread
    cmd_rec = receiver.receive()
  File "C:\Users\priva\Dropbox\Github\TF-Python-Serial\python-serial\src\thermoflex\tools\nodeserial.py", line 89, in receive
    while port.in_waiting > 0:
  File "C:\Users\priva\Dropbox\Github\TF-Python-Serial\test-env\lib\site-packages\serial\serialwin32.py", line 259, in in_waiting
    raise SerialException("ClearCommError failed ({!r})".format(ctypes.WinError()))
serial.serialutil.SerialException: ClearCommError failed (OSError(9, 'The handle is invalid.', None, 6))
Permission Error: Cannot remove session directory

The following error is occurring when the thermoflex library is shutting down, supposedly triggered by tf.endAll()

We need to ensure that the threads are closing in the right order and signal to the others correctly when to shut down. If the receive function is running when tf.endAll(), the program needs to wait until the thread is ready before shutting down. This needs to be done with all threads, ensuring that the python resources are not destroyed before critical processes are finished.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

Fields

No fields configured for Bug.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions