Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

[Bug] ScreenCapLibrary destroys correct termination of ThreadPoolExecutor not created by ScreenCapLibrary #84

Open
d-biehl opened this issue May 15, 2023 · 0 comments

Comments

@d-biehl
Copy link

d-biehl commented May 15, 2023

For RobotCode, I encountered this bug where the RobotCode Debugger does not terminate when recording videos.

After some research, I found out that this error is due to an incorrect implementation of the clear_thread_queues method in the Client class.

https://github.com/rticau/ScreenCapLibrary/blob/146304edac5a062a39f6c738a0516212acbd0197/src/ScreenCapLibrary/client.py#LL252C22-L252C22

In this implementation, the internal state of a Python library is simply cleared, regardless of whether the ThreadPoolExecutors are being used by other programs. This is not good because in newer Python versions (> 3.8), ThreadPoolExecutor threads are no longer Daemon Threads, and when Python is being terminated, it waits for the ThreadPoolExecutors/Queues to be terminated as well.

Deleting the Python internal concurrent.futures.threads._threads_queues is actually unnecessary since Python takes care of terminating the threads. If the intention is to terminate only the threads started by the run_in_background decorator, then only those threads should be terminated and not all the threads in the system.

What is the reason for deleting the _threads_queues?

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

No branches or pull requests

1 participant