Sometimes java.net.SocketTimeoutException: Read timed out. Sometimes not

Bender picture Bender · May 28, 2013 · Viewed 11.1k times · Source

I have this strange error with the

java.net.SocketTimeoutException: Read timed out

And maybe someone of you can help to fix this problem.

The facts are these, I'm working with Eclipse, with a Tomcat v7. Then I execute a function which have

_call.setTimeout(3500);

In my Windows->Preferences->Java->Debug I have

Debugger timeout(ms):3000
Launch timeout(ms):20000

In my Servers->Tomcat v7.0->Timeouts I have

Start(in seconds): 45
Stop(in seconds): 15

Now, when I run my WebService, sometimes it works perfect, sometimes I get the RemoteException e2: java.net.SocketTimeoutException: Read timed out

Did I set the Timeout correctly? Because I tried to change it and stills happens the same, sometimes gets the error, sometimes not.

Answer

Old Pro picture Old Pro · May 28, 2013

Apparently, sometimes the call you are making takes longer than 3.5 seconds to complete. In that case, getting a SocketTimeoutException is the expected behavior.