Thanks for the update Ed, I remember this now. Agree to ping Jetty guys about that.
Regards JB On 12/30/2015 06:35 PM, Ed Welch wrote:
Hi Benson, JB, I'm familiar with this issue, and tried pretty hard to find the root cause a few months back. Ultimately, I believe this is a bug in Jetty. Originally I worked with Achim to see if this was a pax-web issue, you can read about that here: https://ops4j1.jira.com/browse/PAXWEB-863 We figured out it wasn't a pax web problem and so I looked at Jetty. I sent a message to the jetty user group: https://dev.eclipse.org/mhonarc/lists/jetty-users/msg06031.html To which the dev's asked me if I could recreate in jetty 9, which, at the time, I didn't have any easy ability to do. So it kind of just fell into the background. My use case did not require async handling, so I just changed to sync and the stack traces went away. Looking at your stack trace, it appears this issue still remains in jetty 9. I'm not sure if this same code exists in jetty 9, but I think this is where the problem occurs: This starts on line 861 of org.eclipse.jetty.server.handler.ContextHandler from jetty 8.1.15v20140411 switch (_availability) { case __STOPPED: case __SHUTDOWN: return false; case __UNAVAILABLE: baseRequest.setHandled(true); response.sendError(HttpServletResponse.SC_SERVICE_UNAVAILABLE); return false; default: if ((DispatcherType.REQUEST.equals(dispatch) && baseRequest.isHandled())) return false; } In the plain cxf case, we hit this block, with the Jolokia handler, and the default case is hit, and that conditional evaluates as true (dispatch == REQUEST and baseRequest.isHandled == true), which returns false, and results in no further handling of the request by that handler However, in the ASYNC case, baseRequest.isHandled() is true, however, dispatch==ASYNC causing this conditional to not return, which results in the handler attempting to process the request, which leads to jolokia calling the sendError method which in turn results in the error seen. I *think* the default case of that switch statement needs to be more like if (((DispatcherType.REQUEST.equals(dispatch) || DispatcherType.ASYNC.equals(dispatch)) && baseRequest.isHandled())) maybe you can resurrect this issue with the jetty guys? Regards, Ed On Wed, 30 Dec 2015 08:12:16 -0500, Benson Margulies <[email protected]> wrote:// Make a bus factory so that the worker and front end, if co-resident, don't share. bus = BusFactory.newInstance().createBus(); // set the class loader so that the TCCL is reliably 'us' when we get called. bus.setExtension(bundleContext.getBundle().adapt(BundleWiring.class).getClassLoader(), ClassLoader.class); JAXRSServerFactoryBean sf = new JAXRSServerFactoryBean(); sf.setBus(bus); sf.setServiceBean(this); sf.setAddress("/worker"); server = sf.create(); On Wed, Dec 30, 2015 at 1:54 AM, Jean-Baptiste Onofré <[email protected]> wrote:How did you deploy the CXF endpoint ? Can you share the blueprint or activator code where you register the endpoint ? Regards JB On 12/30/2015 12:15 AM, Benson Margulies wrote:/rest/worker/process is a CXF rest endpoint URL of mine. With Karaf 4.0.2, if I make this endpoint asynchronous, and I have the jolokia feature installed, I get the following backtrace from time to time. None of my calls to my endpoint fail, I just get these backtraces. Jolokia should be just it's own restful endpoint, so how is it involved in mine? And why does switching on async trigger all the trouble? 2015-12-29 14:32:14,328 | WARN | tp1821513140-131 | HttpChannel | 150 - org.eclipse.jetty.util - 9.2.10.v20150310 | /rest/worker/process java.lang.IllegalStateException: Committed at org.eclipse.jetty.server.Response.resetBuffer(Response.java:1253)[147:org.eclipse.jetty.server:9.2.10.v20150310] at org.eclipse.jetty.server.Response.sendError(Response.java:567)[147:org.eclipse.jetty.server:9.2.10.v20150310] at org.eclipse.jetty.server.Response.sendError(Response.java:544)[147:org.eclipse.jetty.server:9.2.10.v20150310] at javax.servlet.http.HttpServletResponseWrapper.sendError(HttpServletResponseWrapper.java:167)[51:javax.servlet-api:3.1.0] at org.jolokia.osgi.security.BasicAuthenticationHttpContext.handleSecurity(BasicAuthenticationHttpContext.java:49)[164:org.jolokia.osgi:1.3.0] at org.ops4j.pax.web.service.jetty.internal.HttpServiceServletHandler.doHandle(HttpServiceServletHandler.java:68)[191:org.ops4j.pax.web.pax-web-jetty:4.2.2] at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)[147:org.eclipse.jetty.server:9.2.10.v20150310] at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:577)[146:org.eclipse.jetty.security:9.2.10.v20150310] at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:223)[147:org.eclipse.jetty.server:9.2.10.v20150310] at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1127)[147:org.eclipse.jetty.server:9.2.10.v20150310] at org.ops4j.pax.web.service.jetty.internal.HttpServiceContext.doHandle(HttpServiceContext.java:271)[191:org.ops4j.pax.web.pax-web-jetty:4.2.2] at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:515)[148:org.eclipse.jetty.servlet:9.2.10.v20150310] at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185)[147:org.eclipse.jetty.server:9.2.10.v20150310] at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1061)[147:org.eclipse.jetty.server:9.2.10.v20150310] at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)[147:org.eclipse.jetty.server:9.2.10.v20150310] at org.ops4j.pax.web.service.jetty.internal.JettyServerHandlerCollection.handle(JettyServerHandlerCollection.java:99)[191:org.ops4j.pax.web.pax-web-jetty:4.2.2] at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97)[147:org.eclipse.jetty.server:9.2.10.v20150310] at org.eclipse.jetty.server.Server.handleAsync(Server.java:553)[147:org.eclipse.jetty.server:9.2.10.v20150310] at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:317)[147:org.eclipse.jetty.server:9.2.10.v20150310] at org.eclipse.jetty.server.HttpChannel.run(HttpChannel.java:261)[147:org.eclipse.jetty.server:9.2.10.v20150310] at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:635)[150:org.eclipse.jetty.util:9.2.10.v20150310] at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:555)[150:org.eclipse.jetty.util:9.2.10.v20150310]-- Jean-Baptiste Onofré [email protected] http://blog.nanthrax.net Talend - http://www.talend.com
-- Jean-Baptiste Onofré [email protected] http://blog.nanthrax.net Talend - http://www.talend.com
