Skip to content

Comments

fix(worker): revert ini reset, keep session fixes (#2139)#2217

Merged
dunglas merged 1 commit intomainfrom
fix/2185
Feb 23, 2026
Merged

fix(worker): revert ini reset, keep session fixes (#2139)#2217
dunglas merged 1 commit intomainfrom
fix/2185

Conversation

@dunglas
Copy link
Member

@dunglas dunglas commented Feb 23, 2026

Revert the INI snapshot/restore mechanism from #2139, which caused issues with frameworks that lazily set INI values like session.save_path (#2185). Replace the session handler snapshot/restore with a simpler direct session state reset from #2193 (cc @xavierleune), which preserves mod_user_names across requests without requiring session module reload.

Closes #2185. Closes #2192. Closes #2193.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This pull request reverts the INI snapshot/restore mechanism from PR #2139 that caused issues with frameworks like Symfony 8 that lazily set INI values such as session.save_path. The PR replaces the complex session handler snapshot/restore system with a simpler direct session state reset approach from PR #2193, while preserving user-defined session handlers (mod_user_names) across worker requests. This fixes issue #2185 where session data was not being written to disk in worker mode with Symfony 8.0.5.

Changes:

  • Removed INI value snapshot/restore mechanism that was resetting INI values between worker requests
  • Replaced session handler snapshot/restore with simpler session state reset that preserves user handlers
  • Updated tests to reflect that session handlers and INI values now persist across worker requests

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
frankenphp.c Removed ~150 lines of INI and session handler snapshot/restore code; added simpler frankenphp_reset_session_state() function that preserves user handlers; removed "session" from MODULES_TO_RELOAD; added conditional compilation for session support
frankenphp_test.go Updated TestSessionHandlerReset_worker comments to reflect that handlers are now preserved; removed TestIniLeakBetweenRequests_worker and TestIniPreLoopPreserved_worker tests since INI values are intentionally no longer reset
testdata/worker-with-ini.php Deleted test file for INI pre-loop preservation (no longer applicable)
testdata/ini-leak.php Deleted test file for INI leak detection (no longer applicable)

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Revert the INI snapshot/restore mechanism from #2139 which caused
issues with frameworks that lazily set ini values like session.save_path
(#2185). Replace the session handler snapshot/restore with a simpler
direct session state reset from #2193, which preserves mod_user_names
across requests without requiring session module reload.

Co-Authored-By: Xavier Leune <xavier.leune@gmail.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@xavierleune
Copy link
Contributor

thanks for the PR @dunglas

@dunglas dunglas merged commit 681aae6 into main Feb 23, 2026
91 of 92 checks passed
@dunglas dunglas deleted the fix/2185 branch February 23, 2026 13:02
@dunglas
Copy link
Member Author

dunglas commented Feb 23, 2026

Thanks @xavierleune and all other people involved!

@LauJosefsen
Copy link

@dunglas I just want to note another side effect of the ini reset:

If one increase the memory limit with the ini reset, the reset can fail with errors like

Failed to set memory limit to 134217728 bytes (Current memory usage is 159387648 bytes) 
  • We are aware that not having the ini reset has its own problems of leaking ini changes, but we saw issues on 1.11.2 where requests got server errors due to the above.

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.

Session data not written to disk (0-byte session files) with FrankenPHP 1.11.2 + Symfony 8.0.5 in worker mode

4 participants