-
Notifications
You must be signed in to change notification settings - Fork 2.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
High CPU usage - may be deadlock #225
Comments
I am seeing a similar issue when many clients are connected. (WebSocketServer.java line 298 waiting for selector.select() to return.) Doing some research, this method usually churns when multiple threads make register calls or register OP_WRITE when not necessary. I could not find any place in the code where this could be happening. |
Is it really hanging on select()? (which is okay if there is nothing interesting happening) If the latter case is true, I am guessing this could be because i.remove() is not called often enough, and the same keys keep getting returned by selector.selectedKeys(). |
I just experienced the same problem but only while using SSL. It is an issue when an SSL session can not fully established or the negotiations break down. Which leaves the Channel in a constant read state. I created a PR. |
Hello everyone, Greetings |
Could also be fixed by #488 |
No feedback for months! If you still have an issue with that, please open a separate issue again! |
When my server gets more clients and respectivelly more data transfer, the CPU is getting high. I made stack dump using "jstack" and here is the log for the problematic thread (I'm using the latest code):
"WebsocketSelector17" prio=10 tid=0x00007f532c0fa000 nid=0x523a runnable [0x00007f5322ad0000]
java.lang.Thread.State: RUNNABLE
at sun.nio.ch.EPollArrayWrapper.epollCtl(Native Method)
at sun.nio.ch.EPollArrayWrapper.updateRegistrations(EPollArrayWrapper.java:246)
- locked <0x000000078b5c06d8> (a java.util.LinkedList)
at sun.nio.ch.EPollArrayWrapper.poll(EPollArrayWrapper.java:209)
at sun.nio.ch.EPollSelectorImpl.doSelect(EPollSelectorImpl.java:65)
at sun.nio.ch.SelectorImpl.lockAndDoSelect(SelectorImpl.java:69)
- locked <0x000000078b5c0600> (a sun.nio.ch.Util$2)
- locked <0x000000078b5c05f0> (a java.util.Collections$UnmodifiableSet)
- locked <0x000000078b5bbea8> (a sun.nio.ch.EPollSelectorImpl)
at sun.nio.ch.SelectorImpl.select(SelectorImpl.java:80)
at sun.nio.ch.SelectorImpl.select(SelectorImpl.java:84)
at org.java_websocket.server.WebSocketServer.run(WebSocketServer.java:298)
at java.lang.Thread.run(Thread.java:662)
The text was updated successfully, but these errors were encountered: