ninja icon indicating copy to clipboard operation
ninja copied to clipboard

standalone Jety seems to be ignoring parameter "ninja.idle.timeout"

Open raptaml opened this issue 9 years ago • 11 comments

@raphaelbauer It worked in netbeans and the tests ran but after trying it with release version 5.1.2 in prod mode, jetty still returns 404 after 30 sec. I cannot figure it out, do you have an idea?

raptaml avatar Jun 09 '15 12:06 raptaml

I checked source code but could not find why. Are you starting with java -jar or mvn ninja:run ? The later may not work, I'm afraid, as the parameter is not passed to the jetty server. I'm also interested on this one.

momiji avatar Jun 11 '15 21:06 momiji

Both variants do not work.

raptaml avatar Jun 15 '15 13:06 raptaml

I will have a deeper look if I have some time

raptaml avatar Jun 15 '15 13:06 raptaml

I have edited the test class and placed

assertEquals(60000, nj.server.getConnectors()[0].getIdleTimeout());

after

assertTrue(nj.server.isStarted());

to get the active parameter of the running jetty instance and it passes. I have no idea....

raptaml avatar Jun 16 '15 07:06 raptaml

I lately found that all -D must be specified before the -jar when starting command. This may be obvious to people used to work a lot with java, which is not my case. Can it be the reason ?

Can you try this : java -Dninja.idle.timeout=60000 -jar file.jar

momiji avatar Jun 16 '15 20:06 momiji

In my case it is provided before -jar. I have also inspected the NinjaJetty class during runtime with javosize an it has the conmand line parameter set as idleTimeout. Dont know if jetty is ignoring it or what the problem is.

raptaml avatar Jun 17 '15 05:06 raptaml

I attached the debugger to the running app and inspected jetty classes, I found that SelectChannelEndpoint, which is instanciated with every request handled, extends IdleTimeout class. Instance of this class holds _idleTimeout private variable (exposed by getter which is called by extending classes') with value 60000 during runtime. I think I should file a bug with the Jetty server? What do you think? Anny further ideas?

raptaml avatar Jun 17 '15 09:06 raptaml

Have you tried with à jetty.xml file instead ? Does it allow this customisation ? I'll soon do the same as you, and if I'm planning to avoid tomcat installation !

momiji avatar Jun 17 '15 10:06 momiji

I have discussed XML topic with @raphaelbauer on the mailing list and he said it would require a full blown Jetty config file which is not an option for me. Avoiding tomcat is my goal too. I want to have scaleable and flexible runtime which deploys anywhere in minimal time. I have filed a bug at eclipse bugtracker for jetty 9.2.10 which is current dependency for ninja.

raptaml avatar Jun 17 '15 11:06 raptaml

Accidently closed the issue sorry. Reopened.

raptaml avatar Jun 17 '15 11:06 raptaml

I have resolved this! More detail and maybe PR tomorrow...

raptaml avatar Jun 18 '15 14:06 raptaml