-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
[keba] Don't use selector if it has been closed #7776
Conversation
Signed-off-by: Kai Kreuzer <[email protected]>
Travis tests were successfulHey @kaikreuzer, |
if (!selector.isOpen()) { | ||
return; | ||
} |
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.
As far as I can tell ClosedSelectorException
could be thrown from any of the selector operations and since the selector is closed from another thread it could be closed on this thread at any time. I don't think that simply checking if it is open at this point is sufficient to prevent ClosedSelectorException
from getting thrown.
I think the easiest way to deal with this error is to just catch the ClosedSelectorException
.
But a more proper way to prevent this error from getting thrown is to make the transceiverThread responsible for opening and closing the selector and to add logic to allow outside threads to instruct the transceiverThread to close the selector on its own accord.
I'm ok with either solution but I think the first one is better because there are fewer things that can go wrong with it.
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 @cpmeister, this makes a lot of sense indeed. I have updated the PR accordingly.
Signed-off-by: Kai Kreuzer <[email protected]>
Travis tests were successfulHey @kaikreuzer, |
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
* don't use selector if it has been closed * addressed review comment Signed-off-by: Kai Kreuzer <[email protected]>
* don't use selector if it has been closed * addressed review comment Signed-off-by: Kai Kreuzer <[email protected]>
* don't use selector if it has been closed * addressed review comment Signed-off-by: Kai Kreuzer <[email protected]> Signed-off-by: CSchlipp <[email protected]>
* don't use selector if it has been closed * addressed review comment Signed-off-by: Kai Kreuzer <[email protected]>
* don't use selector if it has been closed * addressed review comment Signed-off-by: Kai Kreuzer <[email protected]>
* don't use selector if it has been closed * addressed review comment Signed-off-by: Kai Kreuzer <[email protected]>
* don't use selector if it has been closed * addressed review comment Signed-off-by: Kai Kreuzer <[email protected]>
* don't use selector if it has been closed * addressed review comment Signed-off-by: Kai Kreuzer <[email protected]> Signed-off-by: Daan Meijer <[email protected]>
* don't use selector if it has been closed * addressed review comment Signed-off-by: Kai Kreuzer <[email protected]>
On bundle shutdown, I have seen errors like:
We hence must make sure to only use the selector if it hasn't yet been closed.
Signed-off-by: Kai Kreuzer [email protected]