Socket Timeout Exception - Unusual Scenario



  • Hello team,

    I am facing this error - net.jsreport.java.JsReportException: java.net.SocketTimeoutException
    I have read all possible answers and added all possible configurations mentioned here: https://jsreport.net/blog/long-reports

    When I check in Azure, the log streams say that the report gets successfully rendered and the process completes. But the java spring boot application fails with the above error. Also, the deployed jsreport on Azure works if called through API. It fails when I call it from java client.



  • This looks like a client timeout.
    I will ask the author of the java client to check it out.
    If you are skilled in java, you may also check yourself here
    https://github.com/hedonCZ/jsreport-javaclient



  • Thank you @jan_blaha for your quick response. How long does it usually take for such fix? We are going live in few days and I would like to get an idea on should I implement the work around to get this working?



  • I'm not sure. I believe it's better for you now to make your own HTTP call without a jsreport java client.
    I guess it's just one hour of work for you, based on this documentation.
    https://jsreport.net/learn/api



  • Thank you.



  • Your Java socket shows SocketTimeoutException means that it takes too long to get respond from other device and your request expires before getting response. This exception is occurring on following condition.

    • Server is slow and default timeout is less, so just put timeout value according to you.
    • Server is working fine but timeout value is for less time. so change the timeout value.

    Solution: A developer can pre-set the timeout option for both client and server operations.

    From Client side:

    Socket socket = new Socket();
    SocketAddress socketAddress = new InetSocketAddress(host, port);
    socket.connect(socketAddress, 12000); //12000 are milli seconds

    From Server side:

    ServerSocket serverSocket = new new ServerSocket(port);
    serverSocket.setSoTimeout(12000);


Log in to reply
 

Looks like your connection to jsreport forum was lost, please wait while we try to reconnect.