Symptom
With two live physical connections to the same database created via FBIRD_CONNECT_FORCE_NEW, PHP request shutdown SIGSEGVs while closing the links:
#0 Firebird::IAttachment::getInfo<CheckStatusWrapper> (this=0x556adeae2bb9, ...) <- garbage pointer
#1 fb::Connection::pingAttachment src/cpp/fb_connection.hpp:451
#3 fb::Connection::detachNoThrow src/cpp/fb_connection.hpp:491
#4 fbc_disconnect firebird_utils.cpp:607
#5 _php_fbird_close_link fbird_connection.c:216
... zend_shutdown_executor_values -> php_request_shutdown
Connection* this=0x556f88569910 vs IAttachment*=0x556adeae2bb9 - the attachment pointer inside one wrapper points into a foreign/freed heap region.
Minimal repro (tests/ddl_default_tx_commit_001.phpt on branch fix/issue-572-578-ddl-execute-commit, pre-fix build reproduces identically - verified via stash control):
$c1 = fbird_connect($test_base);
$c2 = fbird_connect($test_base, '', '', '', 0, 3, '', FBIRD_CONNECT_FORCE_NEW);
// ... any work ...
// script ends WITHOUT explicit fbird_close() -> shutdown closes both links -> SIGSEGV
Explicitly fbird_close()-ing the second link before script end avoids it.
Notes
Acceptance criteria
- phpt with two FORCE_NEW connections surviving request shutdown without segfault
- gdb/ASAN clean on that repro
Symptom
With two live physical connections to the same database created via
FBIRD_CONNECT_FORCE_NEW, PHP request shutdown SIGSEGVs while closing the links:Connection* this=0x556f88569910vsIAttachment*=0x556adeae2bb9- the attachment pointer inside one wrapper points into a foreign/freed heap region.Minimal repro (
tests/ddl_default_tx_commit_001.phpton branchfix/issue-572-578-ddl-execute-commit, pre-fix build reproduces identically - verified via stash control):Explicitly
fbird_close()-ing the second link before script end avoids it.Notes
5b66543); discovered by the DDL visibility race recurs on v13.2.7 / Firebird 3.0.14 (#570 fix incomplete?) #572/flaky(test): testSetIsolationLevelSerializable 'lock conflict on no wait transaction' (RDB$RELATION_FIELDS) - research-first #578 TDD test (control experiment with my fix stashed reproduced it identically)_php_fbird_close_link/fbc_disconnectinterplay when two wrappers exist - possibly the FORCE_NEW path shares/mis-handles thefb::Connectionallocation or a stale cached pointer in one of the twofbird_db_linkstructsAcceptance criteria