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

Fixing 100% CPU untilisation when SSL negotiations fail - Maybe related to #225 & #458 #459

Closed
wants to merge 4 commits into from

Conversation

becast
Copy link
Contributor

@becast becast commented Apr 23, 2017

No description provided.

@becast becast changed the title Fixing 100% CPU untilisation when SSL negotiations fail - Maybe related to #225 Fixing 100% CPU untilisation when SSL negotiations fail - Maybe related to #225 & #458 Apr 23, 2017
@marci4
Copy link
Collaborator

marci4 commented Apr 23, 2017

Hello @becast,

thx for your pull request.

Could you explain why you made those changes to the code?

I would like to understand the reasoning behind this :)

Greetings
marci4

@becast
Copy link
Contributor Author

becast commented Apr 23, 2017

Hi!

Yes, if you use the library to create a WSS Server and i.e. test it with the SSL-Labs test (https://www.ssllabs.com/) a lot of connections are made and in some cases aborted. It appears that this leaves some connections in Limbo forcing their way through selector.select(); in WebSocketServer.java

These connections are not Handshaking and have the SSLEngine closed but keep the WebSocketSelector busy and causing 100% CPU as the selector tries to read them.

This change examines the Connection status upon reading to detect these "Limbo" connections, and since this is a SSL only issue fixing it in the selector seems to be much more work and prone to introduce issues for non WSS connections.

That being said, I'm not sure why all my previous PR are here too. It*s only the last one ( 203470b) I wanted to merge.

@marci4 marci4 added this to the Release 1.3.3 milestone Apr 23, 2017
@marci4
Copy link
Collaborator

marci4 commented Apr 24, 2017

Hello @becast,

I testet your changes against the autobahn ws testcase and also against https://www.htbridge.com/ssl in production.

It fixes the 100% CPU usage.

Is it fine for you that I copy the changes over to my repository and also add some comments for a future me to it? (And don't f**k up this repository with all the other changes included in this pull request)

Greetings
marci4

@becast
Copy link
Contributor Author

becast commented Apr 24, 2017

Yes that is completely fine! I'm not sure how I screwed up that PR so badly xD

marci4 added a commit to marci4/Java-WebSocket-Dev that referenced this pull request Apr 24, 2017
@marci4
Copy link
Collaborator

marci4 commented Apr 24, 2017

Thx again for your help!

Included with PR #461

Greetings
marci4

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

Successfully merging this pull request may close these issues.

2 participants