struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From JOSE L MARTINEZ-AVIAL <jlm...@gmail.com>
Subject Dispatcher attempts to write on the response after it has been commited
Date Tue, 18 Mar 2014 05:06:51 GMT
Hi,
  I'm using Struts 2.3.16.1 with Weblogic 10.3. I recently noticed some
errors on the server log:

java.lang.IllegalStateException: Response already committed
        at
weblogic.servlet.internal.ServletResponseImpl.objectIfCommitted(ServletResponseImpl.java:1553)
        at
weblogic.servlet.internal.ServletResponseImpl.sendError(ServletResponseImpl.java:612)
        at
org.apache.struts2.dispatcher.Dispatcher.sendError(Dispatcher.java:914)
        at
org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:574)
        at
org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:77)
        at
org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:99)
        at
weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:42)
        at
com.spb.eco.security.auditory.web.MDCSessionIdFilter.doFilter(MDCSessionIdFilter.java:128)
        at
weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:42)
        at
weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3496)
        at
weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
        at weblogic.security.service.SecurityManager.runAs(Unknown Source)
        at
weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2180)
        at
weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2086)
        at
weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1406)
        at weblogic.work.ExecuteThread.execute(ExecuteThread.java:201)
        at weblogic.work.ExecuteThread.run(ExecuteThread.java:173)

I took a look at my logs, and it seems this error message is being
generated when there is a broken connection from the client's side. In that
situation I got the following exception in my logs:


java.net.SocketException: Connection reset
        at
java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:96)
        at java.net.SocketOutputStream.write(SocketOutputStream.java:136)
        at com.certicom.io.OutputSSLIOStream.write(Unknown Source)
        at com.certicom.tls.record.WriteHandler.flushOutput(Unknown Source)
        at com.certicom.tls.record.WriteHandler.write(Unknown Source)
        at com.certicom.io.OutputSSLIOStreamWrapper.write(Unknown Source)
        at
weblogic.servlet.internal.ChunkOutput.writeChunkNoTransfer(ChunkOutput.java:548)

        at
weblogic.servlet.internal.ChunkOutput.writeChunks(ChunkOutput.java:505)
        at
weblogic.servlet.internal.ChunkOutput.flush(ChunkOutput.java:382)
        at
weblogic.servlet.internal.ChunkOutput.checkForFlush(ChunkOutput.java:469)
        at
weblogic.servlet.internal.ChunkOutput.write(ChunkOutput.java:304)
        at
weblogic.servlet.internal.ChunkOutputWrapper.write(ChunkOutputWrapper.java:143)

        at
weblogic.servlet.internal.ServletOutputStreamImpl.write(ServletOutputStreamImpl.java:169)

        at
org.apache.struts2.dispatcher.StreamResult.doExecute(StreamResult.java:294)
[...]

but just after that, the "java.lang.IllegalStateException: Response already
committed" is shown on the server logs. After checking the code, I believe
the problem is that when the exception is thrown while writing to the
response, the Dispatcher catches it and calls the method sendError, and
tries to write the error message in the response. Since the response is not
writable anymore, the web server is throwing the exception Response already
committed.

I think this could be avoided by changing the method sendError of class
Dispatcher to chech if the response is committed before trying to write in
it.There is no point on doing anything with the response if it has already
been committed.

Should I open a ticket for this in JIRA?

JL

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message