Dont suppress StopUser or GreenletExit in on_stop #2486
Merged
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.
The #2402 introduced change which wraps
on_stop
call around try/except block inside handling ofInterruptTaskSet
exception.The initial implementation assumed that every exception shall be handled and logged, without any further consequences.
This appeared to be a little bit too greedy. It allowed the execution to carry on.
When running our unit tests we observed a situation where the execution falls into infinite loop. This was because our
on_stop
method implementation counted its invocation and was supposed to raiseStopUser
exception after reaching some arbitrarly chosen number.We do believe that this behavior is inappropriate, as
StopUser
is supposed to always stop execution of current user.We wanted to propose a solution for this issue presented in this Pull Request.
Attached unit test is a simple copy of our unit test. The purpose of this unit test is to verify whether interrupts in
SequentialTaskSet
truly reschedule the execution of whole taskset. If interrupt occurs before calling all tasks, tasks defined after the interrupt shall never be executed. This was verified by the counter in our test. In order to exit the loop, we deliberately raiseStopUser
inon_stop
method.