Skip to content

test(engine): sync on own monitor in history cleanup test - #4072

Merged
kthoms merged 1 commit into
mainfrom
fix/competing-history-cleanup-hang
Nov 8, 2026
Merged

kthoms merged 1 commit into
mainfrom
fix/competing-history-cleanup-hang

Conversation

@javahippie

Copy link
Copy Markdown
Contributor

Fixes #4067

The interceptor in CompetingHistoryCleanupAcquisitionTest called sync() on the static cleanupThread field. executeControllableCommand() starts the thread before the field is assigned, so the cleanup thread could see null (NPE) or the monitor of the previous test. In the second case both threads wait on different monitors and the build hangs.

The command now puts its own monitor into the ThreadLocal, and the interceptor syncs on that.

Checked locally with a Thread.sleep(500) after thread.start(), which hung before and passes now, and 3 runs on main without it.

The interceptor synced on the static cleanupThread field. The cleanup
thread could reach it before the field was assigned, so it saw null
or the monitor of the previous test and the test hung.

Fixes #4067
@github-actions github-actions Bot added lang:java Pull requests that update Java code scope:tests Changes affecting only test code labels Nov 7, 2026
@sonarqubecloud

sonarqubecloud Bot commented Nov 7, 2026

Copy link
Copy Markdown

@kthoms kthoms added the backport:patch-release Should be ported back to the latest feature release branch. label Nov 8, 2026
@kthoms

kthoms commented Nov 8, 2026

Copy link
Copy Markdown
Contributor

Should be backported for 2.2.2

@kthoms
kthoms merged commit 17ec868 into main Nov 8, 2026
15 checks passed
@kthoms
kthoms deleted the fix/competing-history-cleanup-hang branch November 8, 2026 09:17
@kthoms

kthoms commented Nov 8, 2026

Copy link
Copy Markdown
Contributor

Cherry picked to release/2.2.x

kthoms pushed a commit that referenced this pull request Nov 8, 2026
The interceptor synced on the static cleanupThread field. The cleanup
thread could reach it before the field was assigned, so it saw null
or the monitor of the previous test and the test hung.

Fixes #4067

(cherry picked from commit 17ec868)
@kthoms kthoms added this to the 2.2.2 milestone Nov 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport:patch-release Should be ported back to the latest feature release branch. lang:java Pull requests that update Java code scope:tests Changes affecting only test code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CompetingHistoryCleanupAcquisitionTest hangs in release workflow

2 participants