tracker issue : CF-4199244

select a category, or use search below
(searches all categories and all time range)
Title:

Sporadic server errors: Cannot create a session after the response has been committed

| View in Tracker

Status/Resolution/Reason: Closed/Fixed/Fixed

Reporter/Name(from Bugbase): Terry Ford / Terry Ford ()

Created: 07/24/2017

Components: General Server

Versions: 2016,2018

Failure Type: Incorrect w/Workaround

Found In Build/Fixed In Build: Release / 2018,0,02,312339

Priority/Frequency: Normal / Few users will encounter

Locale/System: English / Linux Red Hat All

Vote Count: 0

Problem Description:

ERRORS APPEARING IN APPLICATION.LOG:

"Error","ajp-nio-8016-exec-25","07/24/17","04:03:12","TheAPP","Cannot create a session after the response has been committed The specific sequence of files included or processed is: /var/www/html/template.cfm'' "

Seemingly randomly we get these errors in our application.log, with corresponding 500 responses in our apache log.  They are currently infrequent -- 2 or 3 requests per day.  The concerning part is that there appears to be no way to work around them.   It happens on very different templates.   Run the identical template a second later and the error does not occur.   

Our server has a fair amount of traffic -- we run approximately 20 templates/second throughout the day.

Steps to Reproduce:

Unable to produce a reproducible test case at this time.  

Actual Result:

Expected Result:

Any Workarounds:

No

Attachments:

Comments:

Here is a sample exception log entry for the error above: "Error","ajp-nio-8016-exec-25","07/24/17","04:03:12","TheAPP","Cannot create a session after the response has been committed The specific sequence of files included or processed is: /var/www/html/template.cfm'' " java.lang.IllegalStateException: Cannot create a session after the response has been committed at org.apache.catalina.connector.Request.doGetSession(Request.java:2955) at org.apache.catalina.connector.Request.getSession(Request.java:2368) at org.apache.catalina.connector.RequestFacade.getSession(RequestFacade.java:896) at javax.servlet.http.HttpServletRequestWrapper.getSession(HttpServletRequestWrapper.java:231) at coldfusion.runtime.AppHelper.setupJ2eeSessionScope(AppHelper.java:1042) at coldfusion.runtime.AppHelper.setupSessionScope(AppHelper.java:1141) at coldfusion.filter.ApplicationFilter.invoke(ApplicationFilter.java:415) at coldfusion.filter.RequestMonitorFilter.invoke(RequestMonitorFilter.java:43) at coldfusion.filter.MonitoringFilter.invoke(MonitoringFilter.java:40) at coldfusion.filter.PathFilter.invoke(PathFilter.java:153) at coldfusion.filter.ExceptionFilter.invoke(ExceptionFilter.java:94) at coldfusion.filter.ClientScopePersistenceFilter.invoke(ClientScopePersistenceFilter.java:28) at coldfusion.filter.BrowserFilter.invoke(BrowserFilter.java:38) at coldfusion.filter.NoCacheFilter.invoke(NoCacheFilter.java:60) at coldfusion.filter.GlobalsFilter.invoke(GlobalsFilter.java:38) at coldfusion.filter.DatasourceFilter.invoke(DatasourceFilter.java:22) at coldfusion.filter.CachingFilter.invoke(CachingFilter.java:62) at coldfusion.filter.RequestThrottleFilter.invoke(RequestThrottleFilter.java:151) at coldfusion.CfmServlet.service(CfmServlet.java:219) at coldfusion.bootstrap.BootstrapServlet.service(BootstrapServlet.java:89) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:230) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165) at coldfusion.monitor.event.MonitoringServletFilter.doFilter(MonitoringServletFilter.java:42) at coldfusion.bootstrap.BootstrapFilter.doFilter(BootstrapFilter.java:46) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165) at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:199) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:474) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:363) at org.apache.coyote.ajp.AjpProcessor.service(AjpProcessor.java:507) at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66) at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:798) at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1434) at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) at java.lang.Thread.run(Thread.java:745) "
Comment by Terry F.
489 | July 24, 2017 01:36:55 PM GMT
Note that a search indicates that this has been an unresolved issue since CF11: https://forums.adobe.com/thread/1901070 Another web search indicates that this is also an issue that hits a lot of Tomcat users: https://stackoverflow.com/questions/8072311/adding-hform-causes-java-lang-illegalstateexception-cannot-create-a-session So, it appears it is a Tomcat issue that CF has inherited in some way.
Comment by Terry F.
490 | July 24, 2017 01:40:09 PM GMT
On closer inspection of the exception logs, I think perhaps there is a root cause here. Prior to each of the "session" exceptions in the exception log is an exception like the following. I wonder if THIS is the real bug, and the "session cant be created" bug is generated upon trying to handle this bug. Or something? This exception precedes the exception above: "Error","ajp-nio-8016-exec-25","07/24/17","04:03:12","","" java.lang.IllegalArgumentException at coldfusion.filter.FormScope.parseQueryString(FormScope.java:582) at coldfusion.filter.FormScope.parsePostData(FormScope.java:530) at coldfusion.filter.FormScope.fillForm(FormScope.java:458) at coldfusion.filter.FusionContext.SymTab_initForRequest(FusionContext.java:537) at coldfusion.filter.GlobalsFilter.invoke(GlobalsFilter.java:33) at coldfusion.filter.DatasourceFilter.invoke(DatasourceFilter.java:22) at coldfusion.filter.CachingFilter.invoke(CachingFilter.java:62) at coldfusion.filter.RequestThrottleFilter.invoke(RequestThrottleFilter.java:151) at coldfusion.CfmServlet.service(CfmServlet.java:219) at coldfusion.bootstrap.BootstrapServlet.service(BootstrapServlet.java:89) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:230) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165) at coldfusion.monitor.event.MonitoringServletFilter.doFilter(MonitoringServletFilter.java:42) at coldfusion.bootstrap.BootstrapFilter.doFilter(BootstrapFilter.java:46) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165) at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:199) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:474) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:363) at org.apache.coyote.ajp.AjpProcessor.service(AjpProcessor.java:507) at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66) at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:798) at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1434) at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) at java.lang.Thread.run(Thread.java:745)
Comment by Terry F.
491 | July 24, 2017 03:53:55 PM GMT
AHA -- think i worked it out. This appears to be a resurrection of a bug that was killed back in CF8. It appears to have resurfaced with a different behavior after Tomcat. You can reproduce the bug using this code <cfhttp url="http://www.CFSERVER.com/" method="POST"> <Cfhttpparam name="results_string" encoded=no value="hello %2P" type="formfield"> </cfhttp> It generates a server error 400 on the server: HTTP/1.1 400 For input string: "2P" Which then gets handled incorrectly by CF, somehow triggering the weird "Cannot create a session after the response has been committed" error. Pleasse fix to handle such errors correctly.
Comment by Terry F.
492 | July 24, 2017 04:16:38 PM GMT