Fix ThreadedActionListenerTests#testRejectionHandling#144795
Conversation
|
Pinging @elastic/es-distributed (Team:Distributed) |
DaveCTurner
left a comment
There was a problem hiding this comment.
This test had weak coverage because it would usually shut the threadpool down before doing anything else. Introduced another latch to delay the shutdown a bit, and also fixed the actual problem.
| if (pool.equals("fixed-bounded-queue") == false || forceExecution) { | ||
| assertTrue(esRejectedExecutionException.isExecutorShutdown()); |
There was a problem hiding this comment.
This is the key fix, we sometimes reject these tasks on the bounded queue before the executor is shut down.
There was a problem hiding this comment.
nit David just to understand, would they be rejected on the bounded queue because it's bounded? I.e., it happens that more than 10 listeners are submitted to it before they are actully triggered?
If so, I think a code comment above this fix would be nice as well.
…ejectionHandling-130129
kingherc
left a comment
There was a problem hiding this comment.
LGTM @DaveCTurner , just some nits for potentially improve readability, feel free to pick any of them as you see fit.
| if (pool.equals("fixed-bounded-queue") == false || forceExecution) { | ||
| assertTrue(esRejectedExecutionException.isExecutorShutdown()); |
There was a problem hiding this comment.
nit David just to understand, would they be rejected on the bounded queue because it's bounded? I.e., it happens that more than 10 listeners are submitted to it before they are actully triggered?
If so, I think a code comment above this fix would be nice as well.
| public void testRejectionHandling() throws InterruptedException { | ||
| final var listenerCount = between(1, 1000); | ||
| final var countdownLatch = new CountDownLatch(listenerCount); | ||
| final var startLatch = new CountDownLatch(between(1, listenerCount)); |
There was a problem hiding this comment.
nit
| final var startLatch = new CountDownLatch(between(1, listenerCount)); | |
| final var latchMinListenersToStartBeforeShutdown = new CountDownLatch(between(1, listenerCount)); |
There was a problem hiding this comment.
I've added a comment describing startLatch but I find such long symbol names to be somewhat hostile to readers so I'd rather keep it as-is.
| final var listenerCount = between(1, 1000); | ||
| final var countdownLatch = new CountDownLatch(listenerCount); | ||
| final var startLatch = new CountDownLatch(between(1, listenerCount)); | ||
| final var finishLatch = new CountDownLatch(listenerCount); |
There was a problem hiding this comment.
nit
| final var finishLatch = new CountDownLatch(listenerCount); | |
| final var latchAllListenersCompleted = new CountDownLatch(listenerCount); |
There was a problem hiding this comment.
I've added a comment describing finishLatch but I find such long symbol names to be somewhat hostile to readers so I'd rather keep it as-is.
There was a problem hiding this comment.
I would prefer the more descriptive version, to be honest.
This test is generally very hard to understand. I wonder if there's a way to reveal the intention of particular sections anyhow... and e.g. separate the "setup" "run" and "verification" parts of the test.
Just a loose idea.
…ejectionHandling-130129
…ejectionHandling-130129
…ejectionHandling-130129
…ejectionHandling-130129
…ejectionHandling-130129
…ejectionHandling-130129
…ejectionHandling-130129
💔 Backport failed
You can use sqren/backport to manually backport by running |
* upstream/main: (146 commits) Revert "[Native] Gradle-related tweaks to improve handling of the simdvec native library (elastic#144539)" Fix ArrayIndexOutOfBoundsException in fetch phase with partial results (elastic#144385) ESQL: Correctly manage NULL data type for SUM (elastic#144942) [ESQL] Fixes GroupedTopNBenchmark not executing (elastic#144944) Fix reader context leak when query response serialization fails (elastic#144708) Validate individual offset values in BULK_OFFSETS bounds checks (elastic#144643) Merge main21 source set into main in simdvec (elastic#144921) [TEST] Unmute TsidExtractingIdFieldMapperTests (elastic#144848) [Native] Gradle-related tweaks to improve handling of the simdvec native library (elastic#144539) Fix `ThreadedActionListenerTests#testRejectionHandling` (elastic#144795) Add new DLM Frozen Tier Transition execution plugin and service (elastic#144595) Prometheus: execute query_range via parsed EsqlStatement plan (elastic#144416) Investigate `testBulkIndexingRequestSplitting` failure (elastic#144766) Add test utility for wrapping directories in FilterDirectory layer (elastic#143563) Fix ES|QL decay tests with negative scale (elastic#144657) Fix circuit breaker leak in percolator query construction (elastic#144827) Use XPerFieldDocValuesFormat in AbstractTSDBSyntheticIdCodec (elastic#144744) [DOCS] Document how reindex work in CPS (elastic#144016) Fix Int4 vector library tests failing on Java 21 (elastic#144830) [DiskBBQ] Fix index sorting on flush (elastic#144938) ...
Closes #130129