Project

General

Profile

Actions

Bug #14916

closed
RP RP

Deadlock between WebSession mutex and servlet session lock during unload request and session invalidation

Bug #14916: Deadlock between WebSession mutex and servlet session lock during unload request and session invalidation

Added by Raf Pauwels 12 days ago. Updated 10 days ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
-
Target version:
Start date:
10/26/2026
Due date:
% Done:

0%

Estimated time:

Description

A JWt request triggered by the browser’s Beacon-based page-unload signal (see #14709) can deadlock with session invalidation while the server is shutting down.

In GDP's UI tests, the unload request can still be processing when UIServerExtension.afterEach() calls Server.stop(). The thread dump (10597_jetty.txt) shows this lock cycle:

  1. The unload-request thread holds the JWt WebSession mutex while WebSession.handleRequest() flushes its response. During the flush, Jetty commits the session and waits for the Jetty session lock.
  2. A second request thread invalidates the session. Jetty invokes WtServlet.BoundSession.valueUnbound() while handling invalidation; JWt calls WebSession.destruct(), which waits for the WebSession mutex while the Jetty session lock is held.
  3. The test thread stopping the server also waits for the Jetty session lock.

The relevant stacks include WebSession.Handler.flushResponse() → WebSession.handleRequest() → Jetty session commit on one thread, and ManagedSession.finishInvalidate() → BoundSession.valueUnbound() → WebSession.destruct() on the other.
We observed the same lock cycle with Jetty 11 and Jetty 12, although the Jetty stack frames differ. This suggests the issue is the lock ordering between JWt request handling and session-unbind cleanup, rather than a Jetty-version-specific regression.


Files

10597_jetty.txt (49.5 KB) 10597_jetty.txt thread dump Raf Pauwels, 10/26/2026 04:16 PM

RM Updated by Romain Mardulyn 12 days ago Actions #1

  • Status changed from New to InProgress
  • Assignee set to Raf Pauwels

RM Updated by Romain Mardulyn 12 days ago Actions #2

  • Status changed from InProgress to Review
  • Assignee changed from Raf Pauwels to Romain Mardulyn

RM Updated by Romain Mardulyn 12 days ago Actions #3

  • Status changed from Review to Resolved
  • Assignee changed from Romain Mardulyn to Raf Pauwels
  • Target version set to 4.15.0

RM Updated by Romain Mardulyn 11 days ago Actions #4

  • Status changed from Resolved to Implemented @Emweb

RM Updated by Romain Mardulyn 10 days ago Actions #5

  • Status changed from Implemented @Emweb to Closed
Actions

Also available in: PDF Atom