Skip to content
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

NPE with Jetty 9.3 #2154

Closed
Artur- opened this issue May 2, 2016 · 6 comments
Closed

NPE with Jetty 9.3 #2154

Artur- opened this issue May 2, 2016 · 6 comments

Comments

@Artur-
Copy link
Contributor

Artur- commented May 2, 2016

This is a followup of #1998. I am unable to get Vaadin + Atmosphere 2.4.3 + Jetty 9.3 websockets to work properly together. Before #1998 was fixed, there was an NPE in getContentType. Now I see that initially the app works as expected, including websockets (both JSR-356 and native). However, after refreshing not one but two times, I see the following NPE

javax.servlet.ServletException: com.vaadin.server.ServiceException: java.lang.NullPointerException
    at com.vaadin.server.VaadinServlet.service(VaadinServlet.java:366)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
    at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:845)
    at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1689)
    at org.eclipse.jetty.websocket.server.WebSocketUpgradeFilter.doFilter(WebSocketUpgradeFilter.java:225)
    at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1676)
    at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:581)
    at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)
    at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:548)
    at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:226)
    at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1174)
    at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:511)
    at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185)
    at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1106)
    at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
    at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:213)
    at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:119)
    at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:134)
    at org.eclipse.jetty.server.Server.handle(Server.java:518)
    at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:314)
    at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:253)
    at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:273)
    at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:95)
    at org.eclipse.jetty.io.SelectChannelEndPoint$2.run(SelectChannelEndPoint.java:93)
    at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.produceAndRun(ExecuteProduceConsume.java:246)
    at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.run(ExecuteProduceConsume.java:156)
    at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:654)
    at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:572)
    at java.lang.Thread.run(Thread.java:744)
Caused by: com.vaadin.server.ServiceException: java.lang.NullPointerException
    at com.vaadin.server.VaadinService.handleExceptionDuringRequest(VaadinService.java:1464)
    at com.vaadin.server.VaadinService.handleRequest(VaadinService.java:1421)
    at com.vaadin.server.VaadinServlet.service(VaadinServlet.java:364)
    ... 28 more
Caused by: java.lang.NullPointerException
    at org.eclipse.jetty.server.HttpConnection$Content.succeeded(HttpConnection.java:586)
    at org.eclipse.jetty.server.HttpInput.pollContent(HttpInput.java:205)
    at org.eclipse.jetty.server.HttpInput.nextContent(HttpInput.java:183)
    at org.eclipse.jetty.server.HttpInput.read(HttpInput.java:145)
    at org.eclipse.jetty.server.HttpInput.read(HttpInput.java:129)
    at org.eclipse.jetty.util.UrlEncoded.decodeUtf8To(UrlEncoded.java:538)
    at org.eclipse.jetty.util.UrlEncoded.decodeTo(UrlEncoded.java:674)
    at org.eclipse.jetty.server.Request.extractFormParameters(Request.java:480)
    at org.eclipse.jetty.server.Request.extractContentParameters(Request.java:412)
    at org.eclipse.jetty.server.Request.extractParameters(Request.java:364)
    at org.eclipse.jetty.server.Request.getParameter(Request.java:958)
    at javax.servlet.ServletRequestWrapper.getParameter(ServletRequestWrapper.java:194)
    at com.vaadin.server.communication.ServletUIInitHandler.isUIInitRequest(ServletUIInitHandler.java:30)
    at com.vaadin.server.VaadinServletService.requestCanCreateSession(VaadinServletService.java:152)
    at com.vaadin.server.VaadinService.findOrCreateVaadinSession(VaadinService.java:657)
    at com.vaadin.server.VaadinService.findVaadinSession(VaadinService.java:527)
    at com.vaadin.server.VaadinService.handleRequest(VaadinService.java:1403)
    ... 29 more

The same NPE then occurrs on all following refreshes. The exception is that if you open the same URL rapidly in multiple tabs, in that case one or a few tabs will open the app. Seems a bit like the request object somehow ends up in an invalid state and is reused for the following connections.

Test project: https://github.com/Artur-/push-jetty93 (mvn clean install jetty:run)

@joakime
Copy link

joakime commented May 3, 2016

Which specific version of Jetty 9.3?

This doesn't appear to be an Upgrade Request (for HTTP/1.1 -> WebSocket).

Is it a HTTP POST request? (or something else?)

@Artur-
Copy link
Contributor Author

Artur- commented May 3, 2016

Curious, I thought I tested 9.3.0 and 9.3.9.M1 but it turns out that this works with 9.3.0 but does not work with 9.3.9.M1. Let me track down what works and what does not

@Artur-
Copy link
Contributor Author

Artur- commented May 3, 2016

9.3.1.v20150714 works
9.3.2.v20150730 does not

@Artur-
Copy link
Contributor Author

Artur- commented May 3, 2016

Right, we might be in the wrong issue tracker as it seems to be reproducible without Atmosphere also although it was encountered when using websockets. It's a normal POST request which fails during getParameter

@Artur-
Copy link
Contributor Author

Artur- commented May 3, 2016

Added test to jetty/jetty.project#543, will close this as it seems unrelated to Atmosphere

@Artur- Artur- closed this as completed May 3, 2016
@joakime
Copy link

joakime commented May 3, 2016

Not convinced this is a Jetty issue.

The test case provided by @Artur- does not fail for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants