tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Osipov, Michael" <michael.osi...@siemens.com>
Subject RE: Chasing a SocketTimeoutException with APR
Date Fri, 30 Mar 2012 09:56:43 GMT
Konstantin Kolinko wrote:
> 2012/3/30 Osipov, Michael <michael.osipov@siemens.com>:
>> Konstantin Kolinko wrote:
>>> 2012/3/29 Osipov, Michael <michael.osipov@siemens.com>:
>>>> Hi folks,
>>>> 
>>>> I am trying to narrow down an exception which is happening
>>>> occasionally in certain spots of your code:
>>>> 
>>>> SCHWERWIEGEND: Servlet.service() for servlet default threw
>>>> exception Java.net.SocketTimeoutException
>>>>        at
>>>> org.apache.coyote.http11.InternalAprInputBuffer.fill(InternalAprInputBuffer.java:796)
>>>> ... 
>>>> 
>>>> The problematic spot in that file is:
>>>> if ((-nRead) == Status.ETIMEDOUT || (-nRead) == Status.TIMEUP) {
>>>>                    throw new
>>>> SocketTimeoutException(sm.getString("iib.failedread"))
>>>> 
>>>> Not to mention that 'iib.failedread' does not exists in the
>>>> properties file, I cannot localize the failing point whether it's
>>>> the client who's resetting/closing the connection or is it
>>>> libtcnative?
>>> 
>>> 
>>> It says "timeout" and it occurs while reading, so I would say that
>>> the client is slow at delivering data (disappeared without closing
>>> the connection), so read operation times out.
>>> 
>>> The native side (network.c in native/branches/1.1.x/native/src) just
>>> calls (tcn_nlayer_t)->recv,  which has two different
>>> implementations, depending on whether ssl is used or not used
>>> (network.c vs sslnetwork.c). 
>>> 
>>> 
>>> The timeout on the socket should be configurable (probably see
>>> AprEndpoint#setSocketOptions(..)), but I do not see specific mention
>>> of that option in the documentation.
>>> 
>>> It is a bit strange that soTimeout in setSocketOptions() is
>>> multiplied by 1000. I'd expect the option to be in milliseconds,
>>> like documented options. I cannot say without digging further into
>>> the code -- maybe it is divided by 1000 somewhere else.
>> 
>> According to Http11AprProtocol.java#L68 the default socket timeout
>> is set to 60 000 milliseconds. 
>> 
>> The reson for x1000 is:
>>    /**
>>     * Setup socket timeout for the specified socket
>>     * @param sock The socket to set up.
>>     * @param t Value for the timeout in microseconds.
>> 
>> So 60 seconds of timeout should be enough?
>> 
> 
> OK, understood. There is Collector.java L291
> 
>    replacements.put("connectionTimeout", "soTimeout");
> 
> The "connectionTimeout" attribute of Connector in default server.xml
> is explicitly configured to be 20000.  I do not know what value is in
> your server.xml file.

My server.xml says 5000 milliseconds for connection timeout. I should increase that value
and check for a few days.

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


Mime
View raw message