-
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
Embedded Jetty stops responding and then hangs while stopping #6059
Comments
Sorry, it's not clear what you're doing, nor where the problem is. From your logs I see server-side logs when from your description you have a problem in the client, so it's not clear if you have a client problem contacting an external webservice, or you also run the webservice with Jetty? It's not clear what you mean by "restart Jetty" because you're speaking about the client, while "Jetty" typically indicates the server. Also from your logs, the server is just idle and perfectly working (it just served a request few seconds before the end of the logs). Also from your logs, you seem to use custom extensions of Jetty classes ( I doubt it's Jetty the problem here. I would double check your application. |
Idle timeout rarely point at anything useful for troubleshooting this. When you experience a "hung jetty", do the following, before your restart.
Some example requests ...
What we are trying to do is understand the state of your server. (the server dump helps here) And we are trying to isolate WHERE in the server you are experiencing the problems. |
I mean Restart jetty, by calling server.stop() and then server.start(). |
I see two jetty threads waiting at WindowsSelectorImpl$SubSelector.poll0, rest are at Unsafe.park. "qtp2056418216-11752" Id=11752 TIMED_WAITING on java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject@110f2e5d "qtp2056418216-11747" Id=11747 TIMED_WAITING on java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject@110f2e5d "qtp2056418216-11729" Id=11729 RUNNABLE (in native) "qtp2056418216-11678" Id=11678 RUNNABLE (in native) "qtp2056418216-11657" Id=11657 TIMED_WAITING on java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject@110f2e5d To monitor service performance, we have a WS client within this program, with 20 second timeout, test service, simply returns a String. When this client fails due to time out, program tries to restart by stoping embeded server and starting it, where it seems it gets stuck. |
That's normal.
You should report what happens when this client fails, and in what status the server is when the server fails. So far, what you have reported is a normally, perfectly working server. |
@bhawani1978 what are the results of the information collection outlined in my prior comment? |
As of now we are not taking server.dump before stopping. We will make changes to capture before trying to restart. Also are we having time out of 20 seconds too low before trying to restart, which is causing the problem while stuck in stop. |
Keep in mind that we are not asking for a memory dump, or a class dump, or any other kind of normal JVM dump. We are specifically asking for a Jetty |
We are able to get the server dump when this issue is happening. Clients requests are getting time out. Seems old connections are not getting cleaned up, please let us your view. |
@bhawani1978 the dump you report shows that the selector threads are gone, and update tasks are accumulating into the selectors, but there is no thread to run them (nor to perform the select operation). You appear to be running some custom code ( Unfortunately Windows's NIO implementation in OpenJDK is not as stable as Linux's so there is not much we can do. What is it that you are working around in |
Hi @sbordet, we used https://github.com/jetty-project/selector-hack as suggested in #2205. |
@bhawani1978 have you actually hit the Windows selector spin problem so that you need the workaround? The code you are using is highly experimental as written in the projects README, so there might be a chance that it does not work in your case. I don't see how You should have logging in your logs that the selector has been rebuilt, and if the selector thread is gone you should have some stack trace of that too in the logs. |
On one of the environment, we see that issue starts intermittently and finally over a day or so, it completly stalls it. I was able to get current jetty logs in debug, thread dump and server dump, when its working but on and off. |
@bhawani1978 I can see the selecting threads, but the selectors are in a borked state. Can you please call Also, can you please compare and tell us if your I hate to say, but I have to, can you move to Linux? |
@sbordet thanks for the update. Our WorkaroundManagedSelector and WorkaroundServerConnector is exactly same, line by line. I will try to enable QueuedThreadPool.setDetailedDump(true) get more details. Also we are thinking about moving to Linux but will take sometime. Also I noticed that issue starts with intermittent timeout for some requests, where one fails one time passes next time. It takes hours before completely shutting this down for us. |
This issue has been automatically marked as stale because it has been a |
This issue has been closed due to it having no activity. |
Jetty version 9.4.33.v20201020
Java version JRE-8u271
OS type/version Windows Server
We are running embedded jetty in our java application, and perform a health check by calling a simple webservice, which just returns a success status. This health check done in main thread about every 1 minute and if we don't get response in time out interval (20 seconds), then we try to restart embedded jetty server by calling stop and later start method. We have noticed sometimes, we don’t see any trace for health check call in jetty log but we see other request are being served. Than after 20 sec we receive time out socketException, main thread thinks, service is not in good status and try to restart jetty, and then it hangs in stop.
From time to time we see this TimeoutException though:
java.util.concurrent.TimeoutException: Idle timeout expired: 30000/30000 ms
at org.eclipse.jetty.io.IdleTimeout.checkIdleTimeout(IdleTimeout.java:171)
at org.eclipse.jetty.io.IdleTimeout.idleCheck(IdleTimeout.java:113)
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(Unknown Source)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
attaching rest of the jetty longs.
jetty-hang-log.zip
The text was updated successfully, but these errors were encountered: