-
Notifications
You must be signed in to change notification settings - Fork 818
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
Bubble up session loop's exceptions #736
Bubble up session loop's exceptions #736
Conversation
bb5a7db
to
9ac604d
Compare
Hi @hylkevds |
When a session loop the execption is simply logged and lost, so the error status is not reported to the broker. This PR interrupt the session loop on an exception, saving the error in a local variable. When the PostOffice terminates it re-throw the first (and last) exception that was reached during session loop execution.
9ac604d
to
e8001d6
Compare
If I understand the changes correctly, when an exception happens in a task, this will store the exception and then end the SessionEventLoop that had the exception. Then, when the server exits, it will re-throw the exception. So between the exception happening and the server being shut down, all of the Sessions that are assigned to the event loop that had the exception will hang? That's both good and bad :) And when something is fatal, like the queue store being corrupted, maybe we should shut down the entire server? Maybe we should make two types of exception? Fatal ones that shut down the server to prevent further corruption, and non-fatal ones that just kill the session that had the exception? |
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.
It does what it is supposed to do. 👍
This requirement come out to me during debugging of a failed test, where the expectation didn't match. |
I agree that just continuing like nothing happened is a bad idea. The question is, is just killing the affected |
Yes maybe this proposal is more sensible. I think that the exception handler of every |
Yes, I agree. |
41e9d8e
to
331dc87
Compare
Hi @hylkevds |
e1357c5
to
ac8ea0b
Compare
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.
Looks good!
When a session loop the exception is simply logged and lost, so the error status is not reported to the broker.
This PR interrupt the session loop on an exception, saving the error in a local variable.
When the
PostOffice
terminates it re-throw the exception that was reached during session loopexecution, while in the meantime it notifies the user implemented API
InterceptHandler.onSessionLoopError
.The firing of the newly added event type
InterceptExceptionMessage
containing the error stacktrace, is done asychronously from the launching thread (the session loop thread that terminating because of the error).What it does?#
SessionEventLoop
to be itself a thread (and not aRunnable
task)uncatchedExceptionHandler
in the newly ``SessionEventLoop` thread to scatter the notification.