StripesFramework / stripes

Stripes is a Java framework with the goal of making Servlet/JSP based web development in Java as easy, intuitive and straight-forward as it should be. It's stripey and it doesn't suck.
http://www.stripesframework.org/
171 stars 72 forks source link

DMF bug with jetty9 #39

Closed vankeisb closed 8 years ago

vankeisb commented 8 years ago

DMF calls response.sendError() event if response has already been commited (see net.sourceforge.stripes.controller.DynamicMappingFilter.ErrorTrappingResponseWrapper#proceed).

This leads to exceptions (randomly in my case) and blank pages (see stack trace below).

How To Reproduce

1/ Deploy the examples app in jetty9 (I do this from IDEA) 2/ open the index page 3/ reload until page gets blank

server stack :

java.lang.IllegalStateException: Committed
    at org.eclipse.jetty.server.Response.resetBuffer(Response.java:1285)
    at org.eclipse.jetty.server.Response.sendError(Response.java:567)
    at org.eclipse.jetty.server.Response.sendError(Response.java:544)
    at javax.servlet.http.HttpServletResponseWrapper.sendError(HttpServletResponseWrapper.java:167)
    at net.sourceforge.stripes.controller.DynamicMappingFilter$ErrorTrappingResponseWrapper.proceed(DynamicMappingFilter.java:294)
    at net.sourceforge.stripes.controller.DynamicMappingFilter.doFilter(DynamicMappingFilter.java:470)
    at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1650)
    at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:583)
    at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)
    at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:577)
    at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:223)
    at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1125)
    at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:515)
    at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185)
    at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1059)
    at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
    at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:215)
    at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:110)
    at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97)
    at org.eclipse.jetty.server.Server.handle(Server.java:485)
    at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:290)
    at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:248)
    at org.eclipse.jetty.io.AbstractConnection$2.run(AbstractConnection.java:540)
    at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:606)
    at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:535)
    at java.lang.Thread.run(Thread.java:722)
2015-12-29 12:11:28.915:WARN:oejs.HttpChannel:qtp2139563008-29: Could not send response error 500: java.lang.IllegalStateException: Committed
vankeisb commented 8 years ago

Happens for 304 responses etc.

Problem is that DMF's responseWrapper.setStatus considers all statuses as errors.

When the container sets a 304 status for example, DMF stores the status as an error, and subsequently tries to call response.sendError(). Not only 304 is not an error, but moreover the response seems to be already committed on jetty9 in that case.

vankeisb commented 8 years ago

fixed in e0eec13c8f85f1698d1d515598518ed31d6488de