Fix ParallelPool timer threads keeping failed JVM runs alive#81
Open
mmv08 wants to merge 1 commit into
Open
Conversation
Collaborator
|
Hi @mmv08, thanks for reaching out. |
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.
Summary
Make
ParallelPool's shared scoped-resource timer executor create daemon threads.Motivation
ParallelPool.allocInScopekeeps expensive closeable resources alive briefly after use, then schedulescloseIfUnusedto run aftercvt.scoped.alloc.close.delay.The scheduled executor used for this delayed cleanup was created with the default JVM thread factory. Those threads are non-daemon, so once the timer thread was created it could keep the JVM alive even after the prover's useful work had finished. This showed up in failed local/WSL runs that did not exit cleanly.
The timer is only housekeeping. It should not prevent JVM shutdown.
Change
globalTimersnow uses a custom thread factory that marks timer threads as daemon threads.This matches the existing treatment of other background pool infrastructure.
Reproduction
I reproduced the issue locally with a temporary child-JVM test like this:
Before this change, the child JVM did not exit within 2 seconds because the scheduled cleanup executor had a non-daemon timer thread alive.
After this change, the child JVM exited normally in under 100 ms.
As an additional minimal sanity check, a standalone Java probe showed the same lifecycle behavior:
Executors.newScheduledThreadPool(1)kept the JVM alive until killed bytimeoutValidation
Ran locally with JDK 19:
All 23 related parallel tests passed.