What are the reasons for getting a Socket read timed out Exception in Java?

Rishi Rahiman picture Rishi Rahiman · Oct 3, 2016 · Viewed 21.3k times · Source

What are the reasons for getting a Socket read timed out Exception in Java?

I'm gettting:

    ### Cause: java.sql.SQLRecoverableException: IO Error: Socket read timed out
; SQL []; IO Error: Socket read timed out; nested exception is java.sql.SQLRecoverableException: IO Error: Socket read timed out

Answer

Peter Lawrey picture Peter Lawrey · Oct 3, 2016

A timeout was set by the library and yet it didn't read anything before the timeout was reached.

This could happen if the other end it is reading from stop for a long time. The library determines what counts as a long time. I would look for any errors logged on the server it is connected to.