Jira Data Center REST API thread persistence after abrupt client disconnect
0 reputation · 10 Jun 2022, 07:49 UTC
0 reputation · 10 Jun 2022, 07:49 UTC
In Jira Data Center, long-running REST API operations such as bulk changes or large issue exports are often processed via background worker threads. While the jira.rest.http.connectionTimeout setting governs the duration of the HTTP connection, there is uncertainty regarding how the application handles the loss of the client-side connection.
When a client abruptly terminates a connection or a load balancer timeout occurs before a synchronous request completes, the server-side worker thread may continue to process the task. This creates a risk of orphaned threads that maintain database locks until the process naturally finishes or a hard database-level timeout is reached.
Does Jira provide a mechanism to terminate active worker threads when the associated HTTP request is cancelled? Furthermore, is there a configuration option to map connection-level timeouts to the cancellation of underlying background tasks to prevent thread exhaustion?
Jira Data Center does not automatically terminate the background worker thread that processes a long‑running REST operation when the client connection is lost. The thread continues to run until the operation completes or the database transaction times out.
jira.rest.http.connectionTimeout setting controls only the HTTP client side; it does not influence the lifecycle of server‑side worker threads.Orphaned worker threads hold database locks and consume JVM resources, potentially leading to thread exhaustion under high load. Understanding that Jira does not cancel them automatically helps you design mitigation strategies.
jstack -l > dump.txt) and look for the thread that started the bulk change. It should still be in a RUNNABLE state.Connection reset or Client disconnected and verify that the bulk change continues in the logs after the disconnect.Listener on the relevant event (e.g., BulkChangeEvent) and calls TaskManager.cancelTask(taskId) when a client disconnect is detected.If you are running a very recent Jira Data Center version (e.g., 8.19+), check the release notes for any new task cancellation APIs. If you discover a property such as jira.rest.abortOnClientDisconnect in your configuration, it would change this recommendation, but such a property does not exist in the current documentation.
Run the verification steps above in your environment. If you observe that worker threads are not being cleaned up after a client disconnect, consider implementing one of the mitigation options. If you find a configuration that changes this behavior, let us know so we can update the guidance.
Use comments to ask for clarification. Post a solution as an answer.
34,775 reputation · 10 Jun 2022, 10:02 UTC
In Jira Data Center, long-running REST API operations launch background tasks in a dedicated thread pool that operates independently of the HTTP request lifecycle. When a client disconnects or a load balancer times out, the servlet container closes the HTTP connection but does not signal Jira’s worker pool to abort the associated job. The worker thread continues until the task naturally finishes or a hard database‑level timeout is reached, which can leave orphaned threads holding database locks. Version‑specific thread‑pool shutdown semantics may vary across releases, and no official configuration maps connection‑level timeouts to background task cancellation. To verify, administrators can monitor JMX thread‑pool metrics and server logs when forcing client termination during bulk operations.