Skip to content

ext/pdo_pgsql: Collect nonpersistent notice callback cycles - #449

Closed
iliaal wants to merge 1 commit into
PHP-8.4from
fix/aph-pdo-pgsql-callback-gc-84
Closed

iliaal wants to merge 1 commit into
PHP-8.4from
fix/aph-pdo-pgsql-callback-gc-84

Conversation

@iliaal

@iliaal iliaal commented Nov 2, 2026

Copy link
Copy Markdown
Owner

Found while preparing php#25156: a notice callback capturing its nonpersistent PDO connection leaks after external references are dropped and GC runs. PDO_PGSQL now reports these callbacks to GC so the cycles can be collected.

Persistent callbacks remain owned by the cached connection and are excluded to avoid reporting the same callback through multiple PDO wrappers.

Report the notice callback from get_gc so a cycle through a nonpersistent
Pdo\Pgsql connection, such as a closure that captures the connection it is
set on, can be collected. A persistent handle is shared by every wrapper
created for it in the request, so reporting its callback from each wrapper
would count the single reference several times and free a live callback.
@iliaal
iliaal force-pushed the fix/aph-pdo-pgsql-callback-gc-84 branch from fcd3f82 to 48cd955 Compare November 18, 2026 12:22
@iliaal

iliaal commented Nov 18, 2026

Copy link
Copy Markdown
Owner Author

Submitted upstream as php#25553.

@iliaal iliaal closed this Nov 18, 2026
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.

1 participant