Skip to content
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

Deadlock due to race condition in WebSocketServer.stop #373

Closed
felixvf opened this issue Feb 23, 2016 · 0 comments
Closed

Deadlock due to race condition in WebSocketServer.stop #373

felixvf opened this issue Feb 23, 2016 · 0 comments
Assignees
Labels

Comments

@felixvf
Copy link
Contributor

felixvf commented Feb 23, 2016

In line

the source code reads

                selector.wakeup();
                selectorthread.interrupt();
                selectorthread.join( timeout );

but it should read

                selectorthread.interrupt();
                selector.wakeup();
                selectorthread.join( timeout );

Else it may happen that the selector thread wakes up and goes to sleep again, and only afterwards the selector thread is marked as interrupted (but nothing happens), which means that the selector thread sleeps forever. Due to the join(), the thread calling stop() will then also sleep forever.

felixvf pushed a commit to felixvf/Java-WebSocket that referenced this issue Feb 23, 2016
pau101 added a commit to Gegy/Slyther that referenced this issue May 31, 2016
@marci4 marci4 self-assigned this Mar 15, 2017
@marci4 marci4 added the Bug label Mar 15, 2017
marci4 pushed a commit that referenced this issue Mar 15, 2017
Deadlock due to race condition in WebSocketServer.stop
@marci4 marci4 closed this as completed Mar 15, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants