Skip to content
This repository has been archived by the owner on Aug 3, 2020. It is now read-only.

Anomalies during notify and interrupt races #35

Closed
karalabe opened this issue Sep 30, 2014 · 0 comments
Closed

Anomalies during notify and interrupt races #35

karalabe opened this issue Sep 30, 2014 · 0 comments
Labels

Comments

@karalabe
Copy link
Member

I've noticed the bug particularly in the tunnel receive, but it may as well be present elsewhere too.

Essentially, if while blocking for an outside event on a wait, both the event arrives as well as the connection is torn down (i.e. last message of a tunnel, after which it is closed), then Java will happily exit the wait successfully, but the threads interrupted-flag remains set, so the next sleep/wait/join will immediately cause an exception.

One solution would be to always clear the interrupted flag after a notify is received, ensuring racy conditions are handled. Of course, this is if teh JVM always prioritizes notifies. If it sometimes throws the exception, then additional code is needed at that point too to check for notification and succeed if such cases.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

1 participant