Repository navigation
#203: pooled PDO slot configuration (TLS options, setAttribute, inTransaction, POOL_MIN) - #210
Merged
Merged
Conversation
Constructor options (incl. TLS) now reach pooled connections, setAttribute() reaches every slot, inTransaction() no longer takes one, and ATTR_POOL_MIN works. Supersedes the stopgap 'reject driver-specific options' entry, which never shipped in a release. php-src: true-async-stable 6d64baedf3
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
The test created a pool with POOL_MIN => 2 and expected zero connections, which is what the pool produced while the pre-warm was broken: it ran inside the pool constructor, before the PDO template the factory builds from was attached, so it silently created nothing. With the warm-up fixed the pool holds the 2 connections that were asked for. The assertion the test exists for -- closing a pool with a live healthcheck timer without crashing -- is unchanged.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changelog for the acquire half of #203, landed in php-src
true-async-stable(6d64baedf3).A pooled slot carried no configuration contract: nothing was applied when it was created, and nothing when it was handed out.
pdo_pool_factory()called the driver withoptions = NULL, so every driver-specific option was dropped — silently turning a TLS-configuredPDOinto a plaintext one, and re-enablingATTR_MULTI_STATEMENTSfor users who had switched it off. This supersedes the stopgap refusal shipped in #201/#202/#203: pooled PDO crashes and unapplied driver options #209; that entry is removed from[Unreleased]since it never reached a release.setAttribute()now reaches every slot. It was written onto whichever slot was bound at the time, so later slots kept their birth value. WithATTR_AUTOCOMMITthat lost data.inTransaction()no longer takes a slot.ATTR_POOL_MINworks at all — the pool pre-warms inside its own constructor, before the template is attached, so the warm-up always failed silently.Bumps
PDO_DRIVER_APIfor the two newpdo_dbh_tfields.Verification
Reproduced each defect first, then checked each fix by reverting it:
directrefuses andpooledused to connect with an emptySsl_cipher. Both now refuse identically.ATTR_MULTI_STATEMENTS => false: honoured in pooled mode, matching direct.ATTR_AUTOCOMMIT: 4 coroutines used to reportautocommit=1on 3 of 4 slots and leak rows pastrollBack(); now0,0,0,0and no rows survive.POOL_MIN: 0/1/3/5 producedcount=0for every value; now matches.inTransaction(): used to moveactive0 → 1 for a call answering "no transaction".Four new tests (
pdo_pool_024,pool_012,pool_014,pool_015), each confirmed to fail on the pre-fix binary.Full local suite (24574 tests): 13 failures, none in PDO — same set as the pre-change baseline.
Not in this PR
The release half of #203 stays open: resetting session state on release (
COM_RESET_CONNECTION/DISCARD ALL) and rolling back transactions opened with raw SQL, which needsin_transaction()rather than PDO's own flag. That work must follow this one — a reset before re-application would undo the attributes this PR restores.