IllegalStateException: Response is committed

Steps to reproduce

IRC Discussion:

18:55:49 lkiesow | Does anyone else get a lot of │
18:55:50 lkiesow | (HttpChannel:396) - /admin-ng/event/events.json?filter=status:EVENTS.EVENTS.STATUS.RECORDING&limit=1 │
18:55:51 lkiesow | java.lang.IllegalStateException: Response is committed │
19:07:00 AndChat|190896 | I do │
19:07:04 AndChat|190896 | All the time │
19:07:14 * | AndChat|190896 is greg_logan │
19:07:53 AndChat|190896 | HttpChannel throws that exception for most admin ui requests in my experience. │
19:08:12 AndChat|190896 | No one else was complaining so I assumed it was just on my end and hadn't tracked it down yet │
19:14:27 lkiesow | I did notice it only in the last couple of days │
19:15:15 lkiesow | From when it occurs, I am wondering if it's caused by a dropped tcp connection (Opencast tries to send data but browser is already somewhere else) │
19:15:40 lkiesow | because it's mainly the counter requests if I do a page reload │
19:16:14 lkiesow | I guess we see these errors now since Rubencino made change to the CleanSessionFilter │
19:16:25 lkiesow | which before ate all errors │
19:17:10 lkiesow | But all that is just a guess and I do not have time to investigate
19:17:18 AndChat|190896 | It's been there for a while for me, but that sounds like a reasonable guess. │
19:17:26 * | Rubencino likes to be mentioned for a good cause
19:17:43 AndChat|190896 | I haven't had time either. Can you file an Rb for this Lars? │
19:17:59 AndChat|190896 | This should be fixed prior to 3.0 if others are seeing it


2017-05-02 18:59:49,858 | WARN | (HttpChannel:396) - /admin-ng/event/events.json?filter=status:EVENTS.EVENTS.STATUS.PROCESSING&limit=1
java.lang.IllegalStateException: Response is committed
at org.eclipse.jetty.server.Request.getSession([291:org.eclipse.jetty.server:9.2.19.v20160908]
at org.eclipse.jetty.server.Request.getSession([291:org.eclipse.jetty.server:9.2.19.v20160908]
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter([292:org.eclipse.jetty.servlet:9.2.19.v20160908]
at org.eclipse.jetty.servlet.ServletHandler.doHandle([292:org.eclipse.jetty.servlet:9.2.19.v20160908]
at org.ops4j.pax.web.service.jetty.internal.HttpServiceServletHandler.doHandle([314:org.ops4j.pax.web.pax-web-jetty:4.3.0]
at org.eclipse.jetty.server.handler.ScopedHandler.handle([291:org.eclipse.jetty.server:9.2.19.v20160908]
at org.eclipse.jetty.server.session.SessionHandler.doHandle([291:org.eclipse.jetty.server:9.2.19.v20160908]
at org.eclipse.jetty.server.handler.ContextHandler.doHandle([291:org.eclipse.jetty.server:9.2.19.v20160908]
at org.ops4j.pax.web.service.jetty.internal.HttpServiceContext.doHandle([314:org.ops4j.pax.web.pax-web-jetty:4.3.0]
at org.eclipse.jetty.servlet.ServletHandler.doScope([292:org.eclipse.jetty.servlet:9.2.19.v20160908]
at org.eclipse.jetty.server.session.SessionHandler.doScope([291:org.eclipse.jetty.server:9.2.19.v20160908]
at org.eclipse.jetty.server.handler.ContextHandler.doScope([291:org.eclipse.jetty.server:9.2.19.v20160908]
at org.eclipse.jetty.server.handler.ScopedHandler.handle([291:org.eclipse.jetty.server:9.2.19.v20160908]
at org.ops4j.pax.web.service.jetty.internal.JettyServerHandlerCollection.handle([314:org.ops4j.pax.web.pax-web-jetty:4.3.0]
at org.eclipse.jetty.server.handler.HandlerWrapper.handle([291:org.eclipse.jetty.server:9.2.19.v20160908]
at org.eclipse.jetty.server.Server.handle([291:org.eclipse.jetty.server:9.2.19.v20160908]
at org.eclipse.jetty.server.HttpChannel.handle([291:org.eclipse.jetty.server:9.2.19.v20160908]
at org.eclipse.jetty.server.HttpConnection.onFillable([291:org.eclipse.jetty.server:9.2.19.v20160908]
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob([294:org.eclipse.jetty.util:9.2.19.v20160908]
at org.eclipse.jetty.util.thread.QueuedThreadPool$[294:org.eclipse.jetty.util:9.2.19.v20160908]
2017-05-02 18:59:49,858 | WARN | (HttpChannel:482) - Could not send response error 500: java.lang.IllegalStateException: Response is committed


Former user
May 2, 2017, 6:28 PM

Maybe change the CleanSessionFilter to request.getSession(false)

"If create is false and the request has no valid HttpSession, this method returns null.
To make sure the session is properly maintained, you must call this method before the response is committed. If the container is using cookies to maintain session integrity and is asked to create a new session when the response is committed, an IllegalStateException is thrown."

Current line#95-98
else if (request.getHeader("Authorization") != null) {
logger.trace("Invalidating digest request.");
request.getSession().invalidate(); <--- creates a new session if one doesn't exist, throws IllegalState
else if (request.getHeader("Authorization") != null) {
logger.trace("Invalidating digest request.");
HttpSession session = request.getSession(false); // don't create a new session on committed response
if (session != null) {
session.invalidate(); // only invalidate an existing session


Lars Kiesow
May 2, 2017, 6:44 PM

Sounds reasonable. If you create a pull request, I promise to review it immediately

Former user
May 2, 2017, 6:54 PM


Fixed and reviewed




Lars Kiesow


Usability Issue

Tags (folksonomy)


Fix versions

Affects versions