You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bu...@apache.org on 2008/06/25 23:20:20 UTC

DO NOT REPLY [Bug 45282] New: NioReceiver doesn't close cleanly, leaving sockets in CLOSE_WAIT indefinitely.

https://issues.apache.org/bugzilla/show_bug.cgi?id=45282

           Summary: NioReceiver doesn't close cleanly, leaving sockets in
                    CLOSE_WAIT indefinitely.
           Product: Tomcat 6
           Version: 6.0.16
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Cluster
        AssignedTo: tomcat-dev@jakarta.apache.org
        ReportedBy: robert.newson@gmail.com


We see sockets in CLOSE_WAIT when NioReceiver.stop() is called. 

Apparently, according to;

http://forum.java.sun.com/thread.jspa?threadID=478802&messageID=2231353

one must remain registered with the selector, close, then select again (with a
timeout), and then the channel is properly drained and a tcp reset occurs.

I'm working on a patch.


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


DO NOT REPLY [Bug 45282] NioReceiver doesn't close cleanly, leaving sockets in CLOSE_WAIT indefinitely.

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=45282


Mark Thomas <ma...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |enhancement




--- Comment #2 from Mark Thomas <ma...@apache.org>  2008-10-01 08:36:27 PST ---
Any progress on your patch?


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 45282] NioReceiver doesn't close cleanly, leaving sockets in CLOSE_WAIT indefinitely.

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=45282

Mark Thomas <ma...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--- Comment #4 from Mark Thomas <ma...@apache.org> ---
Filips patch has been applied to 8.0.x for 8.0.15 onwards.

I do not propose to back-port this.

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


DO NOT REPLY [Bug 45282] NioReceiver doesn't close cleanly, leaving sockets in CLOSE_WAIT indefinitely.

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=45282





--- Comment #3 from Filip Hanik <fh...@apache.org>  2008-10-01 09:24:59 PST ---
I believe a patch could look something like

Index: org/apache/catalina/tribes/transport/nio/NioReceiver.java
===================================================================
--- org/apache/catalina/tribes/transport/nio/NioReceiver.java   (revision
695909)
+++ org/apache/catalina/tribes/transport/nio/NioReceiver.java   (working copy)
@@ -377,6 +377,7 @@
                 log.warn("Unable to cleanup on selector close.",ignore);
             }
         }catch ( ClosedSelectorException ignore){}
+        try {selector.selectNow();}catch (Throwable ignore){}
         selector.close();
     }



and all we do, is issue a selectNow statement after we have cancelled the keys

best
Filip


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


DO NOT REPLY [Bug 45282] NioReceiver doesn't close cleanly, leaving sockets in CLOSE_WAIT indefinitely.

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=45282





--- Comment #1 from Robert Newson <ro...@gmail.com>  2008-06-25 14:36:16 PST ---

Ah, forgive me, linger is enabled with a 3 second timeout. In my tests I see
them hanging around but if I wait they do close.

The pattern for draining the queue completely is still a useful enhancement and
would allow correct behavior without linger.


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org