tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Igor Cicimov <icici...@gmail.com>
Subject Re: Avoiding/Handling SocketTimeoutException(s) when web application serving resources to mobile clients
Date Sun, 10 Nov 2013 22:08:24 GMT
On Mon, Nov 11, 2013 at 1:25 AM, Howard W. Smith, Jr. <
smithh032772@gmail.com> wrote:

> On Sun, Nov 10, 2013 at 9:14 AM, Howard W. Smith, Jr. <
> smithh032772@gmail.com> wrote:
>
> > Caused by: java.net.SocketTimeoutException
> > at
> >
> org.apache.tomcat.util.net.NioBlockingSelector.write(NioBlockingSelector.java:127)
> > at
> >
> org.apache.tomcat.util.net.NioSelectorPool.write(NioSelectorPool.java:174)
> >  at
> >
> org.apache.coyote.http11.InternalNioOutputBuffer.writeToSocket(InternalNioOutputBuffer.java:163)
> >
>
> my apologies, based on this exception (above), I decided to provide you
> with the following from my tomee/conf/server.xml:
>
>
>     <Connector port="8080"
> protocol="org.apache.coyote.http11.Http11NioProtocol"
>                maxThreads="150" connectionTimeout="20000"
> acceptorThreadCount="2"
>                redirectPort="8443" socket.directBuffer="false"/>
>
>
> I guess the answer may be the connectionTimeout="..." (above), but still
> would like to know recommendations of others based on experience with web
> application serving mobile clients. thanks.
>

In my experience SocketTimeoutException comes up in case of misbehaving
browser (read IE 8 and older), i.e. the client fails to send the complete
request and the socket timeout strikes. In this case you can't fix anything
on the server side but you say your application is used by mobile clients
so this might not be the case.

You don't provide information about the Java and OS version you are running
your app on since this might be related to one of them (or maybe I missed
that info). For Sun Java for example you can try the following:

-Dsun.net.client.defaultReadTimeout=1800000

which will increase the socket timeout to 30 minutes lets say if the
default one is not enough in case or slow client. Another thing to check is
your OS socket timeout setting, on linux systems for example:

net.ipv4.tcp_keepalive_time = 300

and try adjusting it according to your needs.

Would love to hear some other people experiences and thoughts regarding
this as well, this is really annoying one to troubleshoot.

Cheers,
Igor

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message