Jetty is unresponsive when using multiple connectors.

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Jetty is unresponsive when using multiple connectors.

Nicholas Lun
Hi,

I'm having an issue running my webapp with Jetty 9.0.6 when I try to have more than one server connector. I've been using the code here as a reference: http://git.eclipse.org/c/jetty/org.eclipse.jetty.project.git/tree/examples/embedded/src/main/java/org/eclipse/jetty/embedded/ManyConnectors.java

A connection to a single port (either http or ssl) works great, but trying to do both causes issues. Sending a request to any port results in the browser waiting indefinitely. No exceptions get thrown. I set a break point in HttpChannel's handle method and it never gets reached. Also, confusingly the issue seems to be restricted to my local environment as a colleague tried the same code on their machine without issues. Does anybody have experience with a similar issue?

Regards,
Nick
Reply | Threaded
Open this post in threaded view
|

Re: [jetty-users] Jetty is unresponsive when using multiple connectors.

Joakim Erdfelt-9
Some details on how you are are making the requests, and how you diagnosed an issue, would be helpful.


--
Joakim Erdfelt <[hidden email]>
Expert advice, services and support from from the Jetty & CometD experts


On Tue, Oct 15, 2013 at 10:23 AM, Nicholas Lun <[hidden email]> wrote:
Hi,

I'm having an issue running my webapp with Jetty 9.0.6 when I try to have
more than one server connector. I've been using the code here as a
reference:
http://git.eclipse.org/c/jetty/org.eclipse.jetty.project.git/tree/examples/embedded/src/main/java/org/eclipse/jetty/embedded/ManyConnectors.java

A connection to a single port (either http or ssl) works great, but trying
to do both causes issues. Sending a request to any port results in the
browser waiting indefinitely. No exceptions get thrown. I set a break point
in HttpChannel's handle method and it never gets reached. Also, confusingly
the issue seems to be restricted to my local environment as a colleague
tried the same code on their machine without issues. Does anybody have
experience with a similar issue?

Regards,
Nick



--
View this message in context: http://jetty.4.x6.nabble.com/Jetty-is-unresponsive-when-using-multiple-connectors-tp4961391.html
Sent from the Jetty User mailing list archive at Nabble.com.
_______________________________________________
jetty-users mailing list
[hidden email]
https://dev.eclipse.org/mailman/listinfo/jetty-users


_______________________________________________
jetty-users mailing list
[hidden email]
https://dev.eclipse.org/mailman/listinfo/jetty-users
Reply | Threaded
Open this post in threaded view
|

Re: [jetty-users] Jetty is unresponsive when using multiple connectors.

Nicholas Lun
This post was updated on .
I’m making a request through a browser (chrome) to the address:port of an embedded jetty instance to see if I at least get a 404 response. I am also using eclipse's debugging tools to launch the server and step through the code.
Reply | Threaded
Open this post in threaded view
|

Re: [jetty-users] Jetty is unresponsive when using multiple connectors.

Lothar Kimmeringer
In reply to this post by Nicholas Lun
Am 15.10.2013 19:23, schrieb Nicholas Lun:

> A connection to a single port (either http or ssl) works great, but trying
> to do both causes issues. Sending a request to any port results in the
> browser waiting indefinitely. No exceptions get thrown. I set a break point
> in HttpChannel's handle method and it never gets reached. Also, confusingly
> the issue seems to be restricted to my local environment as a colleague
> tried the same code on their machine without issues. Does anybody have
> experience with a similar issue?

Can you try it on a Linux-system and send a kill -3 to the PID
of the process. That should allow to see what the threads of
the process are doing at that moment. Alternatively a profiler
should be able to do the same on Windows or pressing CTRL-Break
if you run the process in a console (redirect that to a file to
keep the output).


Best regards, Lothar
_______________________________________________
jetty-users mailing list
[hidden email]
https://dev.eclipse.org/mailman/listinfo/jetty-users
Reply | Threaded
Open this post in threaded view
|

Re: [jetty-users] Jetty is unresponsive when using multiple connectors.

Nicholas Lun
This post was updated on .
I think I solved my issue after looking at the running threads. I noticed that there were 16 selector threads but only 8 acceptor threads, all of which were for the http connector. I wondered why acceptor threads weren't being spawned for my ssl connector, so I reduced the number of acceptor/selector threads to 1 per connector. That got it working.

I did some digging and read that by default it would spawn as many acceptor and selector threads as there were cores on my cpu that were available to the JVM (Incidently I had 8). My question now is why wouldn't any of my acceptors spawn for the ssl connector? Is there a limit to the total number of acceptors that can run, relative to the number of cores in my cpu?

EDIT: It seems like Jetty, if left at default, is trying to spawn 16 selector threads per connector for some reason, even though I only have 8 cores on my cpu. Either way it seems as though if too many threads are spawned Jetty freezes up. Even 8 selector threads and 8 acceptor threads per connector seems to make Jetty unresponsive. Not sure what the expected behavior is here.