Skip to content

Fix frankenphp shutdown functions - #65563

Draft
come-nc wants to merge 3 commits into
masterfrom
fix/fix-frankenphp-shutdown-functions
Draft

come-nc wants to merge 3 commits into
masterfrom
fix/fix-frankenphp-shutdown-functions

Conversation

@come-nc

@come-nc come-nc commented Oct 15, 2026

Copy link
Copy Markdown
Contributor
  • Resolves: #

Summary

This is an attempt at fixing the service leak currently happening when using frankenphp worker mode.
At some point database connection pool is exhausted because services from previous requests are not garbage collected.
This removes one of the references that were kept against some services: shutdown functions.
It does not fix the issue yet, so there must be other sources of references to container or services outside of the request lifecycle.
This also keeps the Server object around and only rebuilds the internal containers.

TODO

  • Identify other dangling references?
  • Split Server::reset in two steps so that garbage collection can run in the middle? Or directly call gc_collect_cycle in reset?

Checklist

AI (if applicable)

  • The content of this PR was partly or fully generated using AI

Only the container and app containers are dropped, the server object
 itself is kept. That will allow to keep global state in the Server
 object if needed, and later to keep or revive some services.

Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
Make sure to reset exception and error handler, and register shutdown
 functions through Server instance. For TempManager, rely on destructor
 instead. This helps reducing the number of service references floating
 around. There’s still something keeping database connections alive
 unidentified yet.

Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
Default is too low.

Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
@come-nc come-nc added this to the Nextcloud 36 milestone Oct 15, 2026
@come-nc come-nc self-assigned this Oct 15, 2026
@come-nc come-nc added the 2. developing Work in progress label Oct 15, 2026

This branch has not been deployed

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

Labels

2. developing Work in progress

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant