Skip to content

GH-1513 - Propagate delegate when executor threads are already created#1552

Open
raoulvdberge wants to merge 2 commits intospring-projects:mainfrom
raoulvdberge:1513-propagate-delegate-when-executor-threads-are-already-created
Open

GH-1513 - Propagate delegate when executor threads are already created#1552
raoulvdberge wants to merge 2 commits intospring-projects:mainfrom
raoulvdberge:1513-propagate-delegate-when-executor-threads-are-already-created

Conversation

@raoulvdberge
Copy link

@raoulvdberge raoulvdberge commented Jan 29, 2026

There is an ordering issue: when task threads are created before ThreadBoundApplicationListenerAdapter is initialized, InheritableThreadLocal values are not propagated.

As a result, later events bypass the test context. Because thread creation timing is nondeterministic, this leads to flaky tests as expected events are not detected.

Fixes GH-1513

Signed-off-by: raoulvdberge <raoulvdberge@gmail.com>
@raoulvdberge raoulvdberge force-pushed the 1513-propagate-delegate-when-executor-threads-are-already-created branch 2 times, most recently from 2798f70 to be18636 Compare January 29, 2026 19:32
… main thread in case the task threads are initialized already

There is an ordering issue: when task threads are created before `ThreadBoundApplicationListenerAdapter` is initialized,  `InheritableThreadLocal` values are not propagated.

As a result, later events bypass the test context. Because thread creation timing is nondeterministic, this leads to flaky tests as expected events are not detected.

Fixes spring-projectsGH-1513

Signed-off-by: raoulvdberge <raoulvdberge@gmail.com>
@raoulvdberge raoulvdberge force-pushed the 1513-propagate-delegate-when-executor-threads-are-already-created branch from be18636 to dafff51 Compare January 29, 2026 19:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Events do not get observed, in multiple scenario tests

1 participant