This issue is automatically created based on existing pull request: #41099: Fix silent fallback to file sessions when session/save is set to Valkey
Description (*)
Magento\Framework\Session\SaveHandlerFactory registers only the db and redis session save handlers (app/etc/di.xml). However, bin/magento setup:config:set --session-save=valkey is a documented, supported command that writes session/save = valkey plus a session/valkey connection group to app/etc/env.php.
Because valkey is missing from the handlers map, falls back to the default files handler with no log entry, so sessions are written to var/session even though the store is configured for Valkey. The failure is invisible to operators.
The 2.4.9 Valkey work added Magento\Framework\Cache\Backend\Valkey and the --session-save=valkey / --session-save-valkey-* CLI options, but the matching session SaveHandlerFactory registration was never added.
This PR registers the valkey save handler, reusing the Redis-compatible session handler and reading connection parameters from the session/valkey/session/redis deployment-config group.
Related Pull Requests
None.
Fixed Issues (if relevant)
None.
Manual testing scenarios (*)
- On a 2.4.9 install with Valkey running, configure Valkey sessions:
bin/magento setup:config:set --session-save=valkey \
--session-save-valkey-host=127.0.0.1 \
--session-save-valkey-port=6379 \
--session-save-valkey-db=2
bin/magento cache:flush
- Open the storefront and create a session (add to cart / log in).
- Before: new files appear under
var/session, and valkey-cli -n 2 --scan returns no session keys — silent fallback to files.
- After: sessions are stored in Valkey —
valkey-cli -n 2 --scan returns sess_* keys and valkey-cli -n 2 dbsize grows, while var/session stops growing.
- Regression:
--session-save=redis, --session-save=db, and --session-save=files continue to work unchanged.
Questions or comments
None.
Contribution checklist (*)
This issue is automatically created based on existing pull request: #41099: Fix silent fallback to file sessions when session/save is set to Valkey
Description (*)
Magento\Framework\Session\SaveHandlerFactoryregisters only thedbandredissession save handlers (app/etc/di.xml). However,bin/magento setup:config:set --session-save=valkeyis a documented, supported command that writessession/save = valkeyplus asession/valkeyconnection group toapp/etc/env.php.Because
valkeyis missing from thehandlersmap, falls back to the defaultfileshandler with no log entry, so sessions are written tovar/sessioneven though the store is configured for Valkey. The failure is invisible to operators.The 2.4.9 Valkey work added
Magento\Framework\Cache\Backend\Valkeyand the--session-save=valkey/--session-save-valkey-*CLI options, but the matching sessionSaveHandlerFactoryregistration was never added.This PR registers the
valkeysave handler, reusing the Redis-compatible session handler and reading connection parameters from thesession/valkey/session/redisdeployment-config group.Related Pull Requests
None.
Fixed Issues (if relevant)
None.
Manual testing scenarios (*)
var/session, andvalkey-cli -n 2 --scanreturns no session keys — silent fallback to files.valkey-cli -n 2 --scanreturnssess_*keys andvalkey-cli -n 2 dbsizegrows, whilevar/sessionstops growing.--session-save=redis,--session-save=db, and--session-save=filescontinue to work unchanged.Questions or comments
None.
Contribution checklist (*)