Hello, We are using Tomcat 7.0.69 and suspect a bug with session.close() when "Connection timed out" happens sporadically. When the exception is thrown @onError correctly is called and I call session.close but the connection is still open in limbo which cause memory leak. On the client we use Tyrus with reconnectHandler and set HeartBeatIntervall to 1 minute. When the timeout exception is thrown in Tomcat, Tyrus is still happy with the connection even though its closed in Tomcat. My theory is that there is a problem with session.close() when a timeout occurs. It never really gets closed. I have set the connectionTimeout=-1 connectionUploadTimeout=-1 in server.xml. Anyone has a clue? BR, Hugo java.io.IOException: Connection timed out at sun.nio.ch.FileDispatcherImpl.read0(Native Method) at sun.nio.ch.SocketDispatcher.read(SocketDispatcher.java:39) at sun.nio.ch.IOUtil.readIntoNativeBuffer(IOUtil.java:223) at sun.nio.ch.IOUtil.read(IOUtil.java:192) at sun.nio.ch.SocketChannelImpl.read(SocketChannelImpl.java:384) at org.apache.tomcat.util.net.SecureNioChannel.read(SecureNioChannel.java:442) at org.apache.coyote.http11.upgrade.NioServletInputStream.fillReadBuffer(NioServletInputStream.java:136) at org.apache.coyote.http11.upgrade.NioServletInputStream.doRead(NioServletInputStream.java:80) at org.apache.coyote.http11.upgrade.AbstractServletInputStream.read(AbstractServletInputStream.java:129) at org.apache.tomcat.websocket.server.WsFrameServer.onDataAvailable(WsFrameServer.java:56) at org.apache.tomcat.websocket.server.WsHttpUpgradeHandler$WsReadListener.onDataAvailable(WsHttpUpgradeHa ndler.java:205) at org.apache.coyote.http11.upgrade.AbstractServletInputStream.onDataAvailable(AbstractServletInputStream .java:203) at org.apache.coyote.http11.upgrade.AbstractProcessor.upgradeDispatch(AbstractProcessor.java:93) at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:623) at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1749) at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1708) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) at java.lang.Thread.run(Thread.java:745)
This should be fixed in trunk and will be included in the 7.0.70 release currently in progress. If you still see this issue with 7.0.70 please provide the simplest possible test case that demonstrates the issue and we'll take another look.
Will do! BR, Hugo
I'm afraid that the problem is not fixed with 7.0.70. I have no clue to emulate a timeout Exception. BR, Hugo
Stacktrace from 7.0.70 please.
java.io.IOException: Connection timed out at sun.nio.ch.FileDispatcherImpl.read0(Native Method) at sun.nio.ch.SocketDispatcher.read(SocketDispatcher.java:39) at sun.nio.ch.IOUtil.readIntoNativeBuffer(IOUtil.java:223) at sun.nio.ch.IOUtil.read(IOUtil.java:192) at sun.nio.ch.SocketChannelImpl.read(SocketChannelImpl.java:384) at org.apache.tomcat.util.net.SecureNioChannel.read(SecureNioChannel.java:442) at org.apache.coyote.http11.upgrade.NioServletInputStream.fillReadBuffer(NioServletInputStream.java:136) at org.apache.coyote.http11.upgrade.NioServletInputStream.doRead(NioServletInputStream.java:80) at org.apache.coyote.http11.upgrade.AbstractServletInputStream.read(AbstractServletInputStream.java:129) at org.apache.tomcat.websocket.server.WsFrameServer.onDataAvailable(WsFrameServer.java:56) at org.apache.tomcat.websocket.server.WsHttpUpgradeHandler$WsReadListener.onDataAvailable(WsHttpUpgradeHandler.java:204) at org.apache.coyote.http11.upgrade.AbstractServletInputStream.onDataAvailable(AbstractServletInputStream.java:203) at org.apache.coyote.http11.upgrade.AbstractProcessor.upgradeDispatch(AbstractProcessor.java:93) at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:621) at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1756) at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1715) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) at java.lang.Thread.run(Thread.java:745)
I've tried manually triggering an exeception in the relevant code but I still see the server and client session being correctly closed and cleaned up. To investigate this further we need more information. Ideally, we need a simple web application that demonstrates the problem. We also need details of the memory leak. What references are held by which object to which objects?
No further response for 3+ months. Resolving as WORKSFORME.