Merged
Conversation
After starting the shut down process, there's a slight chance that an allocation could race and insert a slot in `newAllocations`. The `shutdownCompletion` never refilled the `newAllocations`, so such slots would never show up in the `live` queue. This could in turn cause the shut down process to stall forever.
There was a problem hiding this comment.
Pull request overview
This PR addresses flaky tests and real bugs in Stormpot by improving test infrastructure and fixing timing-related issues in the allocation controller.
Changes:
- Refactored test thread management from static methods to ExecutorExtension for better test isolation
- Fixed allocation failure timeout calculation in BAllocThread (changed from linear to 50ms increments per failure)
- Fixed shutdown completion in InlineAllocationController to properly refill newAllocations pile
- Disabled background thread test for InlinePoolIT (which has no background thread)
- Updated Maven wrapper from 3.9.6 to 3.9.12
- Fixed assertEquals parameter order to follow codebase convention
Reviewed changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/test/java/testkits/UnitKit.java | Removed static executor and fork methods, moved to ExecutorExtension |
| src/test/java/testkits/GarbageCreator.java | Updated to accept ExecutorExtension parameter |
| src/test/java/stormpot/tests/extensions/ExecutorExtension.java | Added fork, forkFuture, and exception handling classes moved from UnitKit |
| src/test/java/stormpot/tests/blackbox/slow/PoolIT.java | Fixed flaky test by changing timing measurement approach |
| src/test/java/stormpot/tests/blackbox/slow/InlinePoolIT.java | Disabled background thread test (not applicable) |
| src/test/java/stormpot/tests/blackbox/ThreadBasedPoolTest.java | Updated to use executor.forkFuture instead of static method |
| src/test/java/stormpot/tests/blackbox/AllocatorBasedPoolTest.java | Updated to use executor instance methods and fixed assertEquals order |
| src/test/java/stormpot/tests/blackbox/AbstractPoolTest.java | Added ExecutorExtension field and updated all fork/forkFuture calls |
| src/test/java/stormpot/tests/StackCompletionTest.java | Added ExecutorExtension field and updated all fork/forkFuture calls |
| src/test/java/stormpot/tests/PreciseLeakDetectorTest.java | Added ExecutorExtension field and updated GarbageCreator calls |
| src/test/java/stormpot/tests/PreciseLeakDetectorIT.java | Added ExecutorExtension field and updated GarbageCreator calls |
| src/main/java/stormpot/internal/InlineAllocationController.java | Fixed bug: added newAllocations.refill() in shutdown completion |
| src/main/java/stormpot/internal/BAllocThread.java | Fixed bug: changed allocation failure backoff from 1ms to 50ms per failure, added @SuppressWarnings for unchecked casts |
| .mvn/wrapper/maven-wrapper.properties | Updated Maven version from 3.9.6 to 3.9.12 with correct SHA256 |
…t more robust Measure the time directly in the allocator. Tolerate some missed delay times.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Another round of fixing various flaky tests and real bugs.