Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: ensure env is not in an invalid state on shutdown #1442

Merged
merged 3 commits into from
Mar 19, 2025

Conversation

AlliBalliBaba
Copy link
Collaborator

Fixes #1441

The issue is:
After releasing superglobals that have jit, they remain in an 'invalid state' as long as they are not reloaded ($_SERVER, $_ENV, $_REQUEST). Since $_ENV is not reloaded in worker mode, accessing the global directly will lead to a segfault.

Extensions like xdebug directly access the $_ENV global on shutdown.

This PR sets $_ENV to an empty array on worker script shutdown to fix the segfault. Ideally, $_ENV would not be released between requests, but I have not yet found a way to do so without causing a memory leak.

@dunglas dunglas merged commit 432824e into main Mar 19, 2025
50 of 56 checks passed
@dunglas dunglas deleted the fix/invalid-env-on-shutdown branch March 19, 2025 12:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Exit 139 (segfault) on octane:reload with xdebug.mode=debug
3 participants