Jira Issues macros timeout in Confluence after 5 seconds

Still need help?

The Atlassian Community is here for you.

Ask the community

 

Platform Notice: Server and Data Center Only - This article only applies to Atlassian products on the server and data center platforms.

 

Summary

Confluence's Jira Issues macros timeout after 5 seconds when communicating with Jira.

Jira Issues macros that pull data from Jira for display in Confluence timeout after 5 seconds and display an "Unknown error" or "Connection to Jira has timed out". When encountering this error, clicking on the "Show details" will show that an HTTP 504 was returned, the code you would expect for a timeout. When refreshing the page, if the macro's query executes and returns data within 5 seconds, the macro will display properly. Viewing the issues in Jira will succeed with no issues. 

This occurs with or without the Rich Filters for Jira Dashboards Jira addon enabled and can occur with the out-of-the-box Jira Issues macro provided by Confluence. 

Environment

Confluence 6.13.8
Jira 7.13.5

Diagnosis

"Unknown error" when displaying Jira Issues macro:


(example shown here with the Rich Filters for Jira Dashboards Jira addon enabled)


Additionally you may see "Unable to render Jira Issues macro. Connection to Jira has timed out":

HTTP wire logging

If HTTP wire logging is enabled in Confluence (Confluence Administration > Logging and profiling -> Add org.apache.http and set to DEBUG), you will see the GET request being made to Jira and then a "Read timed out" message issued 5 seconds later:

(example shown here with the Rich Filters for Jira Dashboards Jira addon enabled)

2020-01-06 14:43:00,495 DEBUG [http-nio-8090-exec-2] [org.apache.http.wire] wire http-outgoing-84295 >> "GET /rest/qoti-rich-filters/latest/gadgets/created-vs-resolved/load-cvsr?ts=1578343379&req=%7B%22richFilterId%22%3A385%2C%22workingQuery%22%3A%22status%20changed%20to%20Accepted%20during%20(%5C%222019%2F2%2F13%5C%22%2C%20%5C%222019%2F5%2F7%5C%22)%22%2C%22activeFilters%22%3A%7B%7D%2C%22frequency%22%3A%22weekly%22%2C%22duration%22%3A100%2C%22displayType%22%3A%22count%22%2C%22statValues%22%3A%22sum%3Acustomfield_10105%22%7D&xoauth_requestor_id=csharpe HTTP/1.1[\r][\n]"
...
2020-01-06 14:43:05,513 DEBUG [http-nio-8090-exec-2] [org.apache.http.wire] wire http-outgoing-84295 << "[read] I/O error: Read timed out"
2020-01-06 14:43:05,515 DEBUG [http-nio-8090-exec-2] [http.impl.conn.DefaultManagedHttpClientConnection] close http-outgoing-84295: Close connection
2020-01-06 14:43:05,517 DEBUG [http-nio-8090-exec-2] [http.impl.conn.DefaultManagedHttpClientConnection] shutdown http-outgoing-84295: Shutdown connection
2020-01-06 14:43:05,518 DEBUG [http-nio-8090-exec-2] [http.impl.execchain.MainClientExec] abortConnection Connection discarded
2020-01-06 14:43:05,519 DEBUG [http-nio-8090-exec-2] [http.impl.conn.PoolingHttpClientConnectionManager] releaseConnection Connection released: [id: 84295][route: {s}->https://<JIRA_hostname>:443][total kept alive: 0; route allocated: 0 of 2; total allocated: 0 of 20]
 

Do not leave HTTP wire logging set to DEBUG indefinitely. Set to WARN or remove from Logging and Profiling when done testing as this will fill up the atlassian-confluence.log file quickly if left on DEBUG.

Other Notes

In Confluence's General Configuration, timeouts (for both connection and socket) can be set to an upwards of 60000ms, but macros will still time out after 5 seconds and show the "Unknown error" with a 504 timeout or "Connection to Jira has timed out".

How To Replicate

  1. Create a Confluence page with several Jira Issues macros on it.
  2. Make some macros' JQL queries simple and some more complex so that they will take longer to complete (the addition of the Story Points custom field may help).
  3. Refresh the page.
    • Macros that return data in under 5 seconds will succeed, the ones that take longer than 5 seconds will fail with "Unknown error" and a 504 timeout or "Connection to Jira has timed out". 

Cause

Confluence is not respecting the timeouts for Jira Issues macros/gadgets defined in the UI under "General Configuration" in the "Connection Timeouts".

Solution

This issue is being tracked in  CONFSERVER-51594 - Getting issue details... STATUS

Workaround

Add the following JVM system parameters as discussed in CONFSERVER-51594:

CATALINA_OPTS="-Datlassian.http.connection.timeout=60000 ${CATALINA_OPTS}"

This can be in addition to what is recommended in Timeouts in the JIRA Issues Macro or Highlighting Plugin:

CATALINA_OPTS="-Datlassian.http.socket.timeout=60000 ${CATALINA_OPTS}"
CATALINA_OPTS="-Dplugin.jira-integration.remote.timeout.connection=60000 ${CATALINA_OPTS}"
CATALINA_OPTS="-Dplugin.jira-integration.remote.timeout.socket=60000 ${CATALINA_OPTS}"

The socket and connection timeouts in General Configuration are ignored by the JIRA Issues macro and instead default to the following:

    DEFAULT_SOCKET_TIMEOUT_MS = 15000;
DEFAULT_CONNECT_TIMEOUT_MS = 5000;

Setting the system properties listed in the workaround section above resolves this. 

Last modified on Jan 15, 2020

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.