Do Not Allow Interruption To Be Observed In Uninterruptible Region In ZIO#timeout #8086
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.
This test raises the issue of how
timeoutshould behave in an uninterruptible region. The current behavior is if the program is externally interrupted the timeout fiber will be interrupted because interruption is propagated from parent to child and the timeout fiber is interruptible. This means the timeout fiber "wins" the race by terminating first and causes the timeout to fail with an interrupted cause, which seems clearly incorrect.I think the correct behavior is that the timeout should get the full time to execute and essentially should behave as if no external interruption had occurred since it is in an uninterruptible region. To achieve this we fork the timeout fiber in the global scope instead of the parent scope so the only way it will be interrupted is if the workflow being timed out terminates and interrupts it.