java.net.SocketTimeoutException: Read timed while making a request to a remote server
Platform notice: Server and Data Center only. This article only applies to Atlassian products on the Server and Data Center platforms.
Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.
*Except Fisheye and Crucible
Platform Notice: Data Center - This article applies to Atlassian products on the Data Center platform.
Note that this knowledge base article was created for the Data Center version of the product. Data Center knowledge base articles for non-Data Center-specific features may also work for Server versions of the product, however they have not been tested. Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.
*Except Fisheye and Crucible
Summary
When a Jira instance makes an HTTP request to a remote server, the request fails with a message similar to:
Exception in request: java.net.SocketTimeoutException: Read timed out in http POST to ...
Or,
https-jsse-nio-8443-exec-46 ERROR XYXYXYX 131x9311062x2 60xyx1 10.xx.76.xx,xx.16.xx.180 /plugins/servlet/applinks/oauth/login-dance/authorize [c.a.a.oauth.auth.OAuthApplinksServlet] An error occurred when performing the oauth 'dance' for application link 'ABC Bitbucket (e40c84fe-44a0-324a-b6f4-f6c8ab997a5a) https://bitbucket.abcdefghijkl.com stash'
com.atlassian.sal.api.net.ResponseException: java.net.SocketTimeoutException: Read timed out
at com.atlassian.sal.core.net.HttpClientRequest.executeAndReturn(HttpClientRequest.java:122)
...and goes on
Caused by: java.net.SocketTimeoutException: Read timed out
at java.base/java.net.SocketInputStream.socketRead0(Native Method)
Environment
The issue may occur in any setup where one Jira instance makes an HTTP request to a remote server.
For example, Jira A makes a request to Jira B via the Jira to Jira Issue Copy.
Diagnosis
The request in the remote server succeeds but takes more than 10 seconds, which is the default socket timeout for the client.
Cause
The reason why the request in the remote server takes more than 10 seconds should be investigated and potentially fixed.
If the request legitimately takes more than 10 seconds, the default socket timeout of 10 seconds isn't enough on the Apache client side.
Solution
Increase the Apache client socket timeout via the JVM parameter http.socket.timeout
.
In some cases, we have seen apps that use a different parameter http.socketTimeout
.
- The value needs to be set in milliseconds.
For example:-Dhttp.socket.timeout=20000
. - For more details on setting up the JVM parameter, please refer to the Atlassian documentation Setting properties and options on startup.
- Jira should be restarted for the change to be effective.