-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Few random threads reporting high CPU usage #4453
Comments
The threads with names However, the ones with While it is possible to use standard Java thread executors with various Jetty components it's not recommended for any system with load. Also, using Jetty 9.4.13 is not recommended (as it's subject to multiple overlapping security issues now) - https://www.eclipse.org/jetty/security-reports.html You mention pipes and whatnot, are you using unixsocket or conscrypt perhaps? If so, did you upgrade those components as well when you updated to newer versions of Jetty? |
While handling requests, we use the javax.servlet.AsyncContext to free up the jetty worker threads and process asynchronously and write response to javax.servlet.http.HttpServletResponse. Rest assured, all the other components remain unchanged other than the Jetty libraries (client, http, io, server, servlet, util) revision. I added the details regarding the threads and system calls and the work it was doing when the issue is faced for additional information in case it could help. |
@dhruvil-93 I don't think VisualVM reports correctly which thread is consuming CPU. I recommend you use JMC to track CPU usage. Are you setting a timeout on We need DEBUG logs to understand what's going on, as there is not enough evidence that this is a Jetty issue - the stack traces just show some thread idle in an external pool. |
Yes, I've set timeout on AsyncContext of 10 seconds and it is working. This is a production system and hence DEBUG logs are disabled hence won't be able to share DEBUG logs. Also, JMC requires to be on Oracle Commercial license for use in production environment and that is something I would prefer to avoid. |
@dhruvil-93 we don't have enough information to help you. It could be that in previous Jetty versions we did not call correctly If you can enable DEBUG logs momentarily (say for 1 minute) it would be possible to understand more what's going on. If you implement Would be great to know what you do in Can you setup a simple reproducible test project that we can try ourselves? |
@dhruvil-93 just FYI: Azul backported the Flight Recorder in their recent builds of the free Zulu JVM: https://www.azul.com/downloads/zulu-community/ With it, you can use Zulu Mission Control (https://www.azul.com/products/zulu-mission-control/) and enjoy JFR without using the Oracle JVM. |
This issue has been automatically marked as stale because it has been a full year without activity. It will be closed if no further activity occurs. Thank you for your contributions. |
This issue has been closed due to it having no activity. |
Jetty version
9.4.22.v20191022 to 9.4.25.v20191220
Java version
Oracle Java 8u65, Oracle Java 8u231, Amazon Corretto Java 8u232
OS type/version
Host: Amazon Linux 2 (Linux ip-xxx-xxx-xxx-xxx 4.14.154-99.181.amzn1.x86_64 #1 SMP Sat Nov 16 01:38:34 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux)
Docker: Debian:8.11
Description
I have a web service packaged as war and deployed using Jetty Server.
Recently I migrated from 9.4.13.v20181111 to 9.4.22.v20191022 and observed that the CPU usage is consistently increasing without dropping down.
Sample
top -H
output:I use javax.servlet.AsyncContext to process requests asynchronously and submit it as Runnable to a thread pool.
The work done is very much simple. The application receives data over HTTP and puts to MQ for further processing.
But with time, few threads report high CPU usage. On analyzing the application using Visual VM, it can be seen that the threads reporting high CPU in top are continuously in WAITING (Park) state. Pasting below the Thread Dump for reference.
Upon tracing the system calls using the strace utility, I see that these threads are performing the following syscalls continuously -
Both these threads are performing the write operation on the same file descriptor.
Upon examining the pipe using lsof ,the output is -
Here 14880 is the main java process running.
I was earlier using 9.4.13.v20181111 without any such issue, but am able to reproduce the same with all releases from 9.4.22.v20191022 to 9.4.25.v20191220.
I also tried with an multiple releases of Java and still the issue persists but goes away as soon as I switch to 9.4.13.v20181111.
Please note me know if any additional information is required.
The text was updated successfully, but these errors were encountered: