Skip to content

Conversation

@AlliBalliBaba
Copy link
Contributor

@AlliBalliBaba AlliBalliBaba commented Feb 25, 2025

This is an attempt at fixing #1395 #1061 #1353

The idea is basically to sandbox the environment on a per-thread basis and to not flush $_ENV values in worker mode.

This still allows putenv to affect the actual environment (in case of forking). It does not fully resolve all environment races in ZTS, but will resolve all races for $_ENV, $_SERVER and through getenv().

@AlliBalliBaba
Copy link
Contributor Author

AlliBalliBaba commented Feb 27, 2025

To reiterate , this fixes:

  • $_ENV randomly getting reloaded in worker mode on script compilation
  • threads affecting each other's $_ENV and $_SERVER (while still allowing putenv to affect the actual environment)

Important to mention:

@AlliBalliBaba AlliBalliBaba marked this pull request as ready for review February 27, 2025 21:24
Copy link
Member

@dunglas dunglas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Very good work.

Copy link
Member

@withinboredom withinboredom left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. It might also be worth updating the documentation on worker mode in this PR to inform users how worker mode affects the environment (or doesn't).

@dunglas dunglas merged commit c57f741 into main Mar 1, 2025
55 checks passed
@dunglas dunglas deleted the fix/concurrent-env branch March 1, 2025 13:45
@dunglas
Copy link
Member

dunglas commented Mar 1, 2025

Thank you! Great as usual.

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.

4 participants