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

Set active = True after setting currentPlane to avoid race condition. #23

Merged
merged 1 commit into from
Jan 28, 2022

Conversation

wiseman
Copy link
Contributor

@wiseman wiseman commented Jan 26, 2022

Fixes a race condition in axis-ptz/camera.py.

The mqtt message handler was setting active = True before it set currentPlane, which meant that when the first message was received it would be possible for the camera thread to begin trying to process currentPlane when it was still None.

This probably isn't a race condition that would manifest often, but in my case I was sending the wrong JSON on the flight mqtt topic, which not only triggered the race but also was a bit extra confusing because the exception was being silently eaten (See PR #24).

@robotastic
Copy link
Member

Great catch!
@wiseman I also have a fork that adds ONVIF support: https://github.com/robotastic/SkyScan
I will work on getting it merged in.

@wiseman
Copy link
Contributor Author

wiseman commented Jan 27, 2022

Thanks for the link to the ONVIF fork, @robotastic—I was just starting on that.

@mchadwick-iqt mchadwick-iqt merged commit 567a221 into IQTLabs:main Jan 28, 2022
@mchadwick-iqt
Copy link
Contributor

Good find @wiseman, thanks for the contribution. We have an active issue where the axis-ptz container will stop working at a seemingly random interval (days to weeks). Going to investigate if this was part of what was happening. Any rare event will randomly occur given enough time.

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

Successfully merging this pull request may close these issues.

None yet

3 participants