-
Notifications
You must be signed in to change notification settings - Fork 634
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
Throw fatalError when scheduling on shutdown EL if SWIFTNIO_STRICT is set #2190
Throw fatalError when scheduling on shutdown EL if SWIFTNIO_STRICT is set #2190
Conversation
… set Signed-off-by: Si Beaumont <beaumont@apple.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this, this looks good! We have a few integration tests that attempt to test our crashing behaviours: can we add a test for this one?
Ah, cool. I had a test for this locally in the unit tests to check crashes which I obviously couldn't add. Good to know there's a place for such a test, I'll see if I can put one in. |
Signed-off-by: Si Beaumont <beaumont@apple.com>
Signed-off-by: Si Beaumont <beaumont@apple.com>
Addressed comments and added |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, nice patch!
Late to the party, thanks for solving this! :-) |
Motivation:
When scheduling a task on an EventLoop that is shutdown an error message is printed to stdout which also warns that this will trigger a fatal error in future versions on NIO. #2153 suggests that we should support opting in to fatal errors now by means of an environment variable. It also suggests that any non-fatal error message should be printed to stderr, not stdout.
Modifications:
fatalError
when scheduling tasks if event loop is shutdown when theSWIFTNIO_STRICT
environment variable is set to something that looks like boolean true.SWIFTNIO_STRICT
is not true, continue to print error message, but to stderr.Result:
Fixes #2153.