Skip to content

fix(test): increase awaitTermination timeout in concurrency test#16367

Closed
circleci-app[bot] wants to merge 2 commits intoapim-13586from
chunk/changes-1776091301337-1776091301337
Closed

fix(test): increase awaitTermination timeout in concurrency test#16367
circleci-app[bot] wants to merge 2 commits intoapim-13586from
chunk/changes-1776091301337-1776091301337

Conversation

@circleci-app
Copy link
Copy Markdown

@circleci-app circleci-app bot commented Apr 13, 2026

Prompt Given

Fix job failure for job 1632591

Root cause: The concurrency test shouldNotThrowConcurrentModificationException_concurrentReadersAndWriters uses awaitTermination(durationMs + 5000, MILLISECONDS) (8000ms total) to wait for reader/writer threads to finish. On slow CI machines, the writer thread's per-iteration cost is higher than expected — each iteration calls Mockito.when(), createReactorHandler(), reactorHandlerRegistry.create(), and reactorHandlerRegistry.remove(), all of which have non-trivial overhead. The test elapsed 11.03s, meaning the writer was still running ~8s after awaitTermination was called, exceeding the timeout.

Fix approach: Increase the awaitTermination timeout from durationMs + 5000 (8000ms) to durationMs + 15000 (18000ms) for both the readers and writer executor services. This gives the threads sufficient time to complete their current iteration on slower CI infrastructure without changing the test semantics.

Changes made:

  • ReactorHandlerRegistryTest.java: Changed awaitTermination timeout from durationMs + 5000 to durationMs + 15000 for both readers and writer executor services

View more about this proposed fix in the CircleCI web app →

aditya-goyal01 and others added 2 commits April 13, 2026 19:41
**Root cause:** The concurrency test `shouldNotThrowConcurrentModificationException_concurrentReadersAndWriters` uses `awaitTermination(durationMs + 5000, MILLISECONDS)` (8000ms total) to wait for reader/writer threads to finish. On slow CI machines, the writer thread's per-iteration cost is higher than expected — each iteration calls `Mockito.when()`, `createReactorHandler()`, `reactorHandlerRegistry.create()`, and `reactorHandlerRegistry.remove()`, all of which have non-trivial overhead. The test elapsed 11.03s, meaning the writer was still running ~8s after `awaitTermination` was called, exceeding the timeout.

**Fix approach:** Increase the `awaitTermination` timeout from `durationMs + 5000` (8000ms) to `durationMs + 15000` (18000ms) for both the readers and writer executor services. This gives the threads sufficient time to complete their current iteration on slower CI infrastructure without changing the test semantics.

**Changes made:**
- `ReactorHandlerRegistryTest.java`: Changed `awaitTermination` timeout from `durationMs + 5000` to `durationMs + 15000` for both `readers` and `writer` executor services
@circleci-app circleci-app bot marked this pull request as ready for review April 13, 2026 15:08
@circleci-app circleci-app bot requested a review from a team as a code owner April 13, 2026 15:08
@aditya-goyal01 aditya-goyal01 force-pushed the apim-13586 branch 6 times, most recently from 13cc40e to 8126d57 Compare April 14, 2026 18:42
@aditya-goyal01 aditya-goyal01 deleted the branch apim-13586 April 15, 2026 08:34
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.

1 participant