Skip to content
This repository has been archived by the owner on Mar 9, 2024. It is now read-only.

Recorder thread fails to join #23

Closed
cmangla opened this issue Nov 16, 2019 · 3 comments
Closed

Recorder thread fails to join #23

cmangla opened this issue Nov 16, 2019 · 3 comments

Comments

@cmangla
Copy link
Collaborator

cmangla commented Nov 16, 2019

When I press "stop recording", the main thread calls '.join' on the recorder thread, which never returns, so then the encoder is never called to make the video.

Describe the Bug

This ugly hack is what I need to do to workaround this issue:

https://github.com/cmangla/timelapse/commit/98482c04de8f99654061577f943313770f586121

System Information

  • Operating system: macOS Mojave 10.14.6
  • Software version: python3

Additional Context

I did pip3 install -r <(cut -d= -f1 < requirements.txt ), so I got the latest versions of the dependencies. I couldn't build the versions listed in requirements.txt.

@mre
Copy link
Owner

mre commented Nov 16, 2019

That's weird. It works for me. I thought that by calling _set_stop(), which sets the flag to stop the recording thread after the next iteration, it would terminate recording. Maybe there's an edge case that is not covered? Anyway, I'd be happy to merge a PR that fixes that if you want to give it a shot.
Thanks for the report.

@cmangla
Copy link
Collaborator Author

cmangla commented Nov 16, 2019

I tried very hard to figure out if there is some weird race condition in there. When _set.stop() is called, it seems to do its job. The loop in run() does indeed terminate. So I cannot figure out why Thread.join() then hangs. I even tried using a timeout in Thread.join, but that makes no difference: it hangs and does not time out.

The only clean solution I've found is to run Recorder in a different process. PR #24 does so.

@cmangla
Copy link
Collaborator Author

cmangla commented Nov 16, 2019

Thanks for merging PR #24 @mre.

@cmangla cmangla closed this as completed Nov 16, 2019
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