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

AtmosphereFramework.configureQueryStringAsRequest fails parsing queryString "=&X-atmo-protocol=true" at async timeout #1321

Closed
oyvindhorneland opened this issue Oct 1, 2013 · 4 comments
Labels

Comments

@oyvindhorneland
Copy link

Atmosphere runtime v2.0.1
Atmosphere client v2.0.3-javascript
Transport: long-polling
Server: Jetty 9

When AtmosphereResource is suspended with a timeout, the timeout seems to fire an event after the client has unsubscribed and it will result in an ArrayIndexOutOfBoundsException in AtmosphereFramework.configureQueryStringAsReques#1847. The received query string starts with "=&", but should probably start with just "&".

Not sure if this failure actually has any unfortunate effects besides an ERROR-log as the connection seems to be cleaned up just fine.

Debugging AtmosphereRequest#getQueryString() shows

  b.queryString "=&X-atmo-protocol=true" //this will be returned
  b.request._queryString    "&X-Atmosphere-tracking-id=dbac95ef-63a4-4a28-af2f-2fa7a2b1c4b4&X-Atmosphere-Framework=2.0.3-javascript&X-Atmosphere-Transport=long-polling&X-Atmosphere-TrackMessageSize=true&X-Cache-Date=0&X-atmo-protocol=true&_=1380610936531"

Tracelog shows:

.Servlet30CometSupport  onTimeout(): event: AtmosphereRequest{ contextPath= servletPath= pathInfo=/TestPage requestURI=/TestPage destroyable=true} 
.AsynchronousProcessor  Timing out AtmosphereRequest{ contextPath= servletPath= pathInfo=/TestPage requestURI=/TestPage destroyable=true} 
.AsynchronousProcessor  AtmosphereResource was null, failed to cancel AtmosphereRequest {} 
.AtmosphereFramework    Unable to parse query string
java.lang.ArrayIndexOutOfBoundsException: 0
at org.atmosphere.cpr.AtmosphereFramework.configureQueryStringAsRequest(AtmosphereFramework.java:1847)
at org.atmosphere.cpr.AtmosphereFramework.configureRequestResponse(AtmosphereFramework.java:1615)
at org.atmosphere.cpr.AtmosphereFramework.doCometSupport(AtmosphereFramework.java:1674)
at org.atmosphere.cpr.AtmosphereServlet.doPost(AtmosphereServlet.java:177)
at org.atmosphere.cpr.AtmosphereServlet.doGet(AtmosphereServlet.java:163)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:687)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:698)
at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:505)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:138)
at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:582)
at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:213)
at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1096)
at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:432)
at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:175)
at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1030)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:136)
at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:177)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97)
at org.eclipse.jetty.server.Server.handleAsync(Server.java:502)
at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:282)
at org.eclipse.jetty.server.HttpChannel.run(HttpChannel.java:229)
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:601)
at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:532)
at java.lang.Thread.run(Thread.java:722) 
@jfarcand
Copy link
Member

jfarcand commented Oct 1, 2013

Nice catch! Will look at it.

jfarcand added a commit that referenced this issue Oct 2, 2013
@jfarcand
Copy link
Member

jfarcand commented Oct 2, 2013

Fixed in 2.0.2-SNAPSHOT. Please confirm it worked.

@jfarcand jfarcand closed this as completed Oct 2, 2013
jfarcand added a commit that referenced this issue Oct 2, 2013
@oyvindhorneland
Copy link
Author

Hi,

The received queryString is now "=", so getting there

b.queryString   "="
b.request.getQueryString()  "&X-Atmosphere-tracking-id=c8834462-c46e-4dad-a22f-b86aabe3f883&X-Atmosphere-Framework=2.0.3-javascript&X-Atmosphere-Transport=long-polling&X-Atmosphere-TrackMessageSize=true&X-Cache-Date=0&X-atmo-protocol=true&_=1380799455333"

, but that too fails with

13:22:06.383 [qtp1924984000-48] ERROR o.atmosphere.cpr.AtmosphereFramework - Unable to parse query string
java.lang.ArrayIndexOutOfBoundsException: 0
    at org.atmosphere.cpr.AtmosphereFramework.configureQueryStringAsRequest(AtmosphereFramework.java:1847) [atmosphere-runtime-2.0.2-20131002.213840-6.jar:2.0.2-SNAPSHOT]
    at org.atmosphere.cpr.AtmosphereFramework.configureRequestResponse(AtmosphereFramework.java:1615) [atmosphere-runtime-2.0.2-20131002.213840-6.jar:2.0.2-SNAPSHOT]
    at org.atmosphere.cpr.AtmosphereFramework.doCometSupport(AtmosphereFramework.java:1674) [atmosphere-runtime-2.0.2-20131002.213840-6.jar:2.0.2-SNAPSHOT]
    at org.atmosphere.cpr.AtmosphereServlet.doPost(AtmosphereServlet.java:177) [atmosphere-runtime-2.0.2-20131002.213840-6.jar:2.0.2-SNAPSHOT]
    at org.atmosphere.cpr.AtmosphereServlet.doGet(AtmosphereServlet.java:163) [atmosphere-runtime-2.0.2-20131002.213840-6.jar:2.0.2-SNAPSHOT]
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:687) [javax.servlet-api-3.1.0.jar:3.1.0]
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:790) [javax.servlet-api-3.1.0.jar:3.1.0]
    at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:698) [jetty-servlet-9.0.5.v20130815.jar:9.0.5.v20130815]
    at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:505) [jetty-servlet-9.0.5.v20130815.jar:9.0.5.v20130815]
    at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:138) [jetty-server-9.0.5.v20130815.jar:9.0.5.v20130815]
    at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:582) [jetty-security-9.0.5.v20130815.jar:9.0.5.v20130815]
    at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:213) [jetty-server-9.0.5.v20130815.jar:9.0.5.v20130815]
    at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1096) [jetty-server-9.0.5.v20130815.jar:9.0.5.v20130815]
    at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:432) [jetty-servlet-9.0.5.v20130815.jar:9.0.5.v20130815]
    at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:175) [jetty-server-9.0.5.v20130815.jar:9.0.5.v20130815]
    at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1030) [jetty-server-9.0.5.v20130815.jar:9.0.5.v20130815]
    at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:136) [jetty-server-9.0.5.v20130815.jar:9.0.5.v20130815]
    at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:177) [jetty-server-9.0.5.v20130815.jar:9.0.5.v20130815]
    at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97) [jetty-server-9.0.5.v20130815.jar:9.0.5.v20130815]
    at org.eclipse.jetty.server.Server.handleAsync(Server.java:502) [jetty-server-9.0.5.v20130815.jar:9.0.5.v20130815]
    at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:282) [jetty-server-9.0.5.v20130815.jar:9.0.5.v20130815]
    at org.eclipse.jetty.server.HttpChannel.run(HttpChannel.java:229) [jetty-server-9.0.5.v20130815.jar:9.0.5.v20130815]
    at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:601) [jetty-util-9.0.5.v20130815.jar:9.0.5.v20130815]
    at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:532) [jetty-util-9.0.5.v20130815.jar:9.0.5.v20130815]
    at java.lang.Thread.run(Thread.java:722) [na:1.7.0_15]

@jfarcand jfarcand reopened this Oct 3, 2013
@jfarcand
Copy link
Member

jfarcand commented Oct 3, 2013

I admit I fail to reproduce this issue...digging

jfarcand added a commit that referenced this issue Oct 3, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants