https://bz.apache.org/bugzilla/show_bug.cgi?id=58004
Bug ID: 58004 Summary: Possible memory leak on ClientAbortException in Ajp Product: Tomcat 8 Version: 8.0.23 Hardware: PC OS: Linux Status: NEW Severity: normal Priority: P2 Component: Connectors Assignee: dev@tomcat.apache.org Reporter: bo.gunder...@gmail.com Created attachment 32795 --> https://bz.apache.org/bugzilla/attachment.cgi?id=32795&action=edit Example maven web application When a client drops the connection during a request, a ClientAbortException is thrown. If the web application caches this, and then tries to write to the request outputstream it seems that a memory leak occurs. I think it is a fairly general scenario where an exception is thrown while serving the request, and then the application tries to write an error response back to the client. Looking at heap dumps it seems like the bufferedWrites property in AjpNioProcessor grows each time it happens. I have attached a small web application that shows this issue. The culprit is BigStupidFileServlet that in line 36 writes to the response after having gotten an exception. To execute the sample do: 1) Deploy the web application to a Tomcat, or execute tomcat.example.Main to use the embedded tomcat, and expose it through ajp 2) Start an Apache HTTPD and point it to the Tomcat's ajp port 3) Execute tomcat.example.Breaker with the url of the apache, e.g.: mvn exec:java -Dexec.mainClass="tomcat.example.Breaker" -Dexec.args="http://localhost:8080/tomcat-example/files/test.bin" 4) Observe that the Tomcat server will run out of memory quickly (on my machine around 6k requests, but it ofcause depends on heap size) If you run the breaker on a http connector, it will continue running without OOM exceptions. -- You are receiving this mail because: You are the assignee for the bug. --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org