fix(server): worker-shell release double-free when a handler captures $server - #141
Merged
Merged
Conversation
…-free) A WebSocket handler that captures $server is transferred per worker; the captured server and the transit shell xlat-dedup to the same object. http_server_release_ worker_shell freed config, each handler closure, and the transit in separate transferred-zval releases — separate visited sets — so on a shutdown before the closure LOADed, the shared object was freed twice (double-free under valgrind/ASan; a hard crash on the Windows debug heap). Gather the roots and make ONE batched release (ZEND_ASYNC_THREAD_RELEASE_TRANSFERRED_ZVALS). Requires the async batched-release API. Regression test 067 (setWorkers(2), handler captures $server, a send parked at stop()) fails rc134 without the fix.
EdmondDantes
force-pushed
the
fix/worker-shell-release-double-free
branch
from
July 28, 2026 21:25
fca4430 to
573cf58
Compare
Contributor
CoverageTotal lines: 81.94% → 81.94% (-0.00 pp)
|
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.
A WebSocket handler that captures $server is transferred per worker; the captured server and the transit shell xlat-dedup to the same object.
http_server_release_worker_shellfreed config, each closure and the transit in separate transferred-zval releases (separate visited sets), so on a shutdown before the closure LOADed the shared object was freed twice — double-free under valgrind/ASan, hard crash on the Windows debug heap. Now gathers the roots and makes ONE batched release. Needs the async batched-release API (php-src + php-async PRs). Regression: test 067 (setWorkers(2), handler captures $server, a send parked at stop()) — rc134 without the fix, valgrind-clean with it.