Skip to content

Add a session handler to migrate from pdo to redis, add managed gc times#2127

Open
BentiGorlich wants to merge 5 commits into
mainfrom
new/improve-session-management
Open

Add a session handler to migrate from pdo to redis, add managed gc times#2127
BentiGorlich wants to merge 5 commits into
mainfrom
new/improve-session-management

Conversation

@BentiGorlich

@BentiGorlich BentiGorlich commented May 4, 2026

Copy link
Copy Markdown
Member
  • symfony uses the php default garbage collector probabilities, but that is set to 0 in debian and ubuntu, so manage it ourselves so the sessions get cleared out
  • add a service definition for redis, which the redis session handler needs, this includes splitting up the dsn in our .env file
  • add a MigratingSessionHandler that writes all sessions to the RedisSessionHandler as well, so we can move towards that

 - symfony uses the php default garbage collector probabilities, but that is set to 0 in debian and ubuntu, so manage it ourselves so the sessions get cleared out
 - add a service definition for redis, which the redis session handler needs, this includes splitting up the dsn in our .env file
@BentiGorlich BentiGorlich added dependencies Pull requests that update a dependency file backend Backend related issues and pull requests labels May 4, 2026
@BentiGorlich

Copy link
Copy Markdown
Member Author

As a note, we moved to the PdoSessionHandler in #1145. Before that we used our redis dsn as the handler_id. I have no idea why that worked at all, though I will be testing the redis sessions out starting tomorrow when all sessions have been duplicated in redis (that is what the MigratingSessionHandler does)

@blued-gear

Copy link
Copy Markdown
Collaborator

Please don't forget the .env.devcontainer.

@blued-gear

Copy link
Copy Markdown
Collaborator

As it runs well on some servers so far, do you think this is ready for review?

@BentiGorlich BentiGorlich marked this pull request as ready for review July 6, 2026 09:45
Comment thread config/services.yaml
- '%env(int:REDIS_PORT)%'

# uncomment the following if your Redis server requires a password
- auth:

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

it says 'uncomment the following' but it is already not commented; please change the comment or comment-out the code

Comment thread .env.example
@@ -89,7 +89,9 @@ TRUSTED_PROXIES=

# Redis

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

These changes need to be applied to the .devcontainer env file too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backend Backend related issues and pull requests dependencies Pull requests that update a dependency file

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants