Repository navigation
fix(workers): release thread-local event names after VM teardown - #153
Merged
Merged
Conversation
This was referenced Oct 9, 2026
Ports oven-sh#38164. Explicitly release the Worker-owned cache while the thread atom table remains alive; preserve live-thread caching and main-thread exit behavior.
steipete
force-pushed
the
claude/worker-thread-cache-release
branch
from
October 9, 2026 20:10
89ef517 to
38de3d6
Compare
steipete
marked this pull request as ready for review
October 9, 2026 20:45
This was referenced Oct 9, 2026
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.
Repeated Worker creation retained each thread's EventNames cache because C++ TLS destructors are disabled. This ports oven-sh#38164 and releases the cache explicitly on the exiting Worker thread, after VM destruction and before the thread's atom table disappears. Live-thread caching and main-thread exit behavior are unchanged. The upstream PR remains open; its EventNames release is credited to @robobun.
The branch is based on merged #152. An addon can supply the first external string adopted as an event-name atom; when the cache releases it after env cleanup, #152's storage-owned finalizer invokes the addon with
env == nullptr. The new regression keeps the matching literal out of the Worker module, verifies no early callback or copy, and requires exactly one null-env callback on the creating thread with the addon's fd closed. Both termination routes fail before this change and pass after it. The previously aborting reproducer now passes Linux ASAN and macOS without any further lifetime-policy or ordering change.The separate parser leak is fixed in openclaw/WebKit#28 (development) and openclaw/WebKit#29 (release).
DefineFieldNodeowns an Identifier but previously skipped destruction during arena teardown; those changes register its destructor. Complete leak qualification uses both fixes on the pinned engine source.Loaded-Worker timing uses eight alternating blocks of 30 Workers per arm and exit route. Median/p95 milliseconds: macOS terminate 6.060/7.516→5.831/6.834, self-exit 6.047/6.778→5.787/6.515; Linux terminate 28.931/31.672→29.431/32.208, self-exit 28.871/31.411→28.497/32.529. Linux results are mixed: paired-block uncertainty includes zero for both routes. This does not establish timing equivalence or a speedup; the small positive shifts are retained, with no discarded or repeated run and no new tolerance.
P2 review is scoped-clean. Exact-head Linux/macOS native CI and Rust CI are green at
38de3d6e68ed3b767575b0de1be7846ccd62d9e5; lint, source checks, and formatting are green too. Sanitizer allocator exports were changed only in verification relinks, with no production linker-map changes or new suppressions.Integration ordering: #152 must precede this change; it is already merged. A release claiming the complete leak fix must also use a rebuilt engine containing the parser fix. WebKit #28 and #29 target separate branches and have no serial dependency on each other. These PRs remain unmerged; engine publication, Bun repinning, and release are separate follow-up actions.