Return-Path: Delivered-To: apmail-tomcat-users-archive@www.apache.org Received: (qmail 94198 invoked from network); 8 May 2007 08:01:40 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 8 May 2007 08:01:40 -0000 Received: (qmail 99083 invoked by uid 500); 8 May 2007 08:01:33 -0000 Delivered-To: apmail-tomcat-users-archive@tomcat.apache.org Received: (qmail 99066 invoked by uid 500); 8 May 2007 08:01:33 -0000 Mailing-List: contact users-help@tomcat.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Tomcat Users List" Delivered-To: mailing list users@tomcat.apache.org Received: (qmail 99055 invoked by uid 99); 8 May 2007 08:01:33 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 08 May 2007 01:01:33 -0700 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received-SPF: neutral (herse.apache.org: local policy) Received: from [192.35.17.28] (HELO goliath.siemens.de) (192.35.17.28) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 08 May 2007 01:01:25 -0700 Received: from mail1.siemens.de (localhost [127.0.0.1]) by goliath.siemens.de (8.12.6/8.12.6) with ESMTP id l48813da025448 for ; Tue, 8 May 2007 10:01:03 +0200 Received: from mchp7wta.ww002.siemens.net (mchp7wta.ww002.siemens.net [139.25.131.193]) by mail1.siemens.de (8.12.6/8.12.6) with ESMTP id l48812Gl031594 for ; Tue, 8 May 2007 10:01:02 +0200 Received: from MCHP7R5A.ww002.siemens.net ([139.25.131.163]) by mchp7wta.ww002.siemens.net with Microsoft SMTPSVC(6.0.3790.1830); Tue, 8 May 2007 10:01:02 +0200 X-MIMEOLE: Produced By Microsoft Exchange V6.5 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Subject: NioEndpoint closes connection upon timeout Date: Tue, 8 May 2007 10:01:01 +0200 Message-ID: <23AFECEB22D2FD47ADF828485803B2C001A80A3F@MCHP7R5A.ww002.siemens.net> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-topic: NioEndpoint closes connection upon timeout Thread-index: AceRRwUutO22jmYIQ/uzJi3XR8aE5g== From: "Reich, Matthias" To: "Tomcat Users List" X-OriginalArrivalTime: 08 May 2007 08:01:02.0892 (UTC) FILETIME=[05C60EC0:01C79147] X-Virus-Checked: Checked by ClamAV on apache.org The NioEndpoint seems to close a connection during the timeout handling. My client reacts to a connection failure with a resubmit of the last request, and I see this in the log: 07.05.2007 22:08:14 comettest.CometServlet event WARNUNG: BEGIN(16) POST /comettest/comet/request?action=3Dpoll&count=3D1 07.05.2007 22:08:35 comettest.CometServlet event WARNUNG: ERROR/TIMEOUT(16) POST /comettest/comet/request?action=3Dpoll&count=3D1 07.05.2007 22:08:35 comettest.CometServlet event WARNUNG: BEGIN(17) POST /comettest/comet/request?action=3Dpoll&count=3D1 I had a look into the code and found that NioEndpoint.timeout calls cancelledKey(key, SocketStatus.TIMEOUT,true); Method cancelledKey processes the timeout event and then closes the channel. However, the Javadoc of enum EventSubType says: =20 TIMEOUT - the connection timed out (sub type of ERROR); note that this ERROR type is not fatal, and the connection will not be closed unless the servlet uses the close method of the event. My servlet does not close the event in case of a TIMEOUT, and thus the CoyoteAdapter won't recycle the processor. The consequence is that Tomcat runs out of memory after a while if my asynchronous response provider thread often waits longer than the connection timeout before sending an answer.=20 According to a note which was still present in the Tomcat 5.5 server.xml file, I tried to set the connectionTimeout value to 0 to disable connection timeouts, but that does no longer seem to work with Tomcat 6, at least not with the Nio connector. Thus, I think this behavior of the NioEndpoint must be considered a bug. (Also, the Apr connector does not close the connection upon a TIMEOUT event.) If it should not be possible to provide a short term solution which keeps the connection open, perhaps the behavior of NioEndpoint.timeout can be modified to signal a DISCONNECT instead of a TIMEOUT, even if it was the server and not the client that disconnected. This would allow the Servlet and the CoyoteAdapter to clean up more properly. Matthias --------------------------------------------------------------------- To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org For additional commands, e-mail: users-help@tomcat.apache.org