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 2007/10/15 02:14:52 UTC

DO NOT REPLY [Bug 43621] New: - soTimeout not worked on channelNioSocket

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=43621>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=43621

           Summary: soTimeout not worked on channelNioSocket
           Product: Tomcat 5
           Version: Nightly Build
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Connector:AJP
        AssignedTo: tomcat-dev@jakarta.apache.org
        ReportedBy: william.barker@wilshire.com


I have configuared tomcat to use the NIO impl over AJP, here are the lines in
server.xml 
    <Connector address="127.0.0.1" port="0" 

               channelNioSocket.port="8009" 
               channelNioSocket.soTimeout="600000" 
               channelNioSocket.bufferSize="16384" 
               channelNioSocket.maxThreads="125" 
               channelNioSocket.minSpareThreads="10" 
               channelNioSocket.maxSpareThreads="50" 

               redirectPort="8443" protocol="AJP/1.3" 
               useBodyEncodingForURI="true" 
               /> 

(TC version 5.5.17) 
I had setted the soTimeout with 10 minutes, cause I notice such stages in
server status 

Stage Time B Sent B Recv Client VHost Request 
S 33280840 ms 359 KB 0 KB x.x.x.x 127.0.0.1 GET ... 

That shows several requests were blocking on reading request bodies for
hours. 

But unfortunately it dosen't worked for me, I am expecting a request should
only blocking mostly 10 minutes on read, after that a SocketTimeoutException
should raised. 

After digest the source code of ChannelNioSocket.java, I found that
ChannelNioSocket.SocketInputStream just wait infinitly if no data comes
while socket could not be detected closing 

        private void block(int len) throws IOException { 
            ... ... 
            if(!dataAvailable) { 
                blocking = true; 
                if(log.isDebugEnabled()) 
                    log.debug("Waiting for "+len+" bytes to be available"); 
                try{ 
                    wait(socketTimeout); 
                }catch(InterruptedException iex) { 
                    log.debug("Interrupted",iex); 
                } 
                blocking = false; 
            } 
            if(dataAvailable) { 
                dataAvailable = false; 
                if(fill(len) < 0) { 
                    isClosed = true; 
                } 
            } 
        } 

The socketTimeout parameter is not used to throw SocketTimeoutException,
actually it has no meaning. 

I even read the source for TC 6.0.13, the same as above. 

Should it be more precisely that throwing SocketTimeoutException on later
condiction test for (dataAvailable) is not true? 

In ChannelSocket implement, the problem is not exists,  it uses blocking
Socket.getInputStream, and it would throws SocketTimeoutException for socket
timeout while Socket.setSoTimeout was called

-- 
View this message in context: http://www.nabble.com/soTimeout-not-worked-on-
channelNioSocket-tf4586319.html#a13091614
Sent from the Tomcat - Dev mailing list archive at Nabble.com.

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

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


DO NOT REPLY [Bug 43621] - soTimeout not worked on channelNioSocket

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=43621>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=43621





------- Additional Comments From william.barker@wilshire.com  2007-10-14 17:19 -------
Created an attachment (id=20976)
 --> (http://issues.apache.org/bugzilla/attachment.cgi?id=20976&action=view)
Patch to fix this problem

This should fix the Apache close, when TC can detect it.  In addition it also
handles the case of non-default connectionTimeouts (which really isn't
recommended for this Connector).

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

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


DO NOT REPLY [Bug 43621] - soTimeout not worked on channelNioSocket

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=43621>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=43621


william.barker@wilshire.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|Connector:AJP               |Connectors
            Product|Tomcat 5                    |Tomcat 6
   Target Milestone|---                         |default
            Version|Nightly Build               |6.0.0




------- Additional Comments From william.barker@wilshire.com  2007-10-21 01:37 -------
Patch applied to TC 5.5, so changing version to 6.0 to apply the patch there 
as well.

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

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


DO NOT REPLY [Bug 43621] - soTimeout not worked on channelNioSocket

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=43621>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=43621





------- Additional Comments From william.barker@wilshire.com  2007-10-25 20:08 -------
Created an attachment (id=21047)
 --> (http://issues.apache.org/bugzilla/attachment.cgi?id=21047&action=view)
TC6 version of the patch

No functional change, but fixes packaging from 5.5 (which I forgot about)

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

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


DO NOT REPLY [Bug 43621] - soTimeout not worked on channelNioSocket

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=43621>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=43621


william.barker@wilshire.com changed:

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




------- Additional Comments From william.barker@wilshire.com  2007-10-25 20:08 -------
This is now fixed in TC 5.5 and 6.0 with the patches attached.

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

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


DO NOT REPLY [Bug 43621] - soTimeout not worked on channelNioSocket

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=43621>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=43621





------- Additional Comments From william.barker@wilshire.com  2007-10-14 17:16 -------
Actually, it is a more general problem where the NIO/AJP Connector doesn't 
handle Apache dropping the connection well at all.  Fortunately, this module 
is still marked as "Experimental".

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

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