Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Solves a deadlock in the scanning toolchain.
Description
The deadlock could occur, when scanning_optimize_logic is calling scanning_probe_logic.start_scan().
In this case, the scanning_optimize_logic thread holds a lock (scanning_probe_logic._thread_lock) when entering start_scan().
This lock can prevent __start_timer() to invoke the timer on the scanning_probe_logic via a BlockingQueuedConnection, since this threads wait on lock-release.
Rather surprisingly, the deadlock conditions seems to be timing-related and is not always found.
It might be the reason, why on some setups the optimizer freezes after hours of operation.
The solution is to call __start_timer() outside the thread lock. This is is safe, as the thread lock block before is guaranteed to have executed and __start_timer is not using any shared ressources.
Motivation and Context
For my dummy config, this deadlock can be reproduced by a fresh start of the scanning toolchain and start an optimization without any other prior action.
The gui hangs like this, with no way to recover:
How Has This Been Tested?
Dummy scanning toolchain, optimizing continuously via POIManager for > 24 h.
Types of changes
Checklist:
/docs/changelog.md
.(syntax, indentation, mutable default values, etc.).