DBI shim leaves non-JDBC statements inactive and recurses on fallback dispatch
Maintainer antworten meist innerhalb von 1 Tag
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Anfängerfreundlichkeit
- 28/100
Rechercherichtung
Start in the non-JDBC branch of DBI::execute in src/main/perl/lib/DBI.pm, then read DBI::fetchall_arrayref, DBI::disconnect and _dispatch_implementor_method. Reproduce by running t/dbi.t from SQL-Interp-1.28 with its t/lib/DBD/Mock.pm on PERL5LIB. Done means successful SELECTs are fetchable, Active and ActiveKids counts stay correct, a missing implementor method does not recurse, and a new regression test using a small non-JDBC driver passes on system Perl and both PerlOnJava backends.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
Summary
The SQL-Interp 1.28 test suite fails under PerlOnJava when DBIx::Interp wraps a DBI handle backed by the pure-Perl DBD::Mock test driver. The test failures expose two problems in the bundled DBI shim's non-JDBC implementor path: successful execute calls do not mark result statements active, and fallback method resolution can redispatch to DBI's own wrapper instead of reaching a driver implementation.
Reproduction
Run SQL-Interp-1.28's t/dbi.t with the distribution's t/lib/DBD/Mock.pm on PERL5LIB. The test connects to DBI:Mock:, creates a DBIx::Interp wrapper, executes SELECT statements, then reads fetched rows and the mock driver's statement history.
On PerlOnJava, the initial failure is:
Failed test 'selectall_arrayref'
$got = undef
$expected = ARRAY(...)
Related fetchall_arrayref assertions and checks of generated SQL / bound parameters also fail. During teardown, the test emits:
Deep recursion on subroutine "DBI::_dispatch_implementor_method"
Evidence
- CPAN run
20261013-145839-84917; targetDBIx::Interp, distributionSQL-Interp-1.28. - System Perl 5.42.2: all five test programs pass, 184/184 tests.
- PerlOnJava 5.44.1, Java 24.0.2, macOS arm64: the archived JVM run fails 16 assertions in
t/dbi.t; the other four test programs pass. Re-runningt/dbi.twith the archived executable reproduces the same 16 failures on the interpreter backend. - The test driver is in the distribution's own
t/lib;SQL-Interpitself is pure Perl and has no native dependency involved in this failure. - The tested distribution's
.perlonjava-cpan-perl5liboverlay file is empty, so no dependency blib shadows the bundled DBI module. - Duplicate searches for DBD::Mock active-state handling and
_dispatch_implementor_methodfound no matching issue.
Root cause
The failing result-set reads trace to the non-JDBC branch of DBI::execute in the bundled src/main/perl/lib/DBI.pm. That branch dispatches execute to the implementor and populates statement metadata, but it does not update sth->{Active} or the parent's ActiveKids. The bundled DBI::fetchall_arrayref checks sth->{Active} and returns undef when it remains false, so successful DBD::Mock SELECT executions appear to have no rows.
The later recursion is another failure in non-JDBC dispatch. DBI::disconnect sends non-JDBC handles to _dispatch_implementor_method; when the implementor has no concrete disconnect method, can() can resolve an inherited DBI dispatch wrapper, which calls _dispatch_implementor_method again. This test reaches that path during cleanup.
Proposed fix
Bring non-JDBC handle bookkeeping in DBI::execute in line with the existing JDBC path: after a successful implementor call, mark result-returning statements active and update ActiveKids, while keeping DML statements inactive and avoiding double-counting. Adjust implementor method resolution so it does not select a DBI dispatch wrapper as the driver's implementation when the method is absent from the concrete implementor; either dispatch to the actual driver method or report the missing method without recursing.
Add project-owned DBI regression coverage using a small non-JDBC implementor/test driver. Cover successful SELECT execution followed by fetchall_arrayref, repeated execute/finish state transitions, and cleanup where the driver inherits but does not implement disconnect. Validate the regression on system Perl first, then both PerlOnJava backends, and rerun SQL-Interp-1.28's focused test.
Acceptance criteria
- Successful non-JDBC SELECT execution makes its statement fetchable through
fetchall_arrayrefon both PerlOnJava backends. - Active statement counts remain correct across finish, repeated execution, and non-result statements.
- Missing implementor methods do not recurse through DBI's own dispatch wrappers.
- The focused DBI regression and
SQL-Interp-1.28test suite pass on both PerlOnJava backends; system Perl remains green.
- Vorherrschende Sprache
- Perl
- Sterne
- 64
- Forks
- 7
- Ø Merge
- 5 Std. 39 Min.
- Gemergte PRs (30 T.)
- 213
Entwicklungsumgebung
- Enthält ein Dockerfile oder eine Docker-Compose-Datei
- Keine Pull-Request-Vorlage
- Beitragsleitfaden lesen
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus fglock/PerlOnJava
-
bug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
fglock/PerlOnJava#1579 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 3/5 1-2 Tage Anfängerfreundlichkeit 48/100
fglock/PerlOnJava#1835 ·
Maintainer antworten meist innerhalb von 1 Tag
-
area:cpan-port bug
Schwierigkeit 3/5 1-2 Tage Anfängerfreundlichkeit 68/100
fglock/PerlOnJava#1820 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 3/5 Ein halber Tag Anfängerfreundlichkeit 45/100
fglock/PerlOnJava#1808 ·
Maintainer antworten meist innerhalb von 1 Tag
-
area:backend area:cpan-port area:runtime bug
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 30/100
fglock/PerlOnJava#1801 ·
Maintainer antworten meist innerhalb von 1 Tag
Alle Issues in fglock/PerlOnJava
Ähnliche Issues
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 80/100
jimsalterjrs/sanoid#1116 · 1 Reaktion ·
-
Add .gitattributes so share/skel keeps LF on a Windows git checkoutEvtl. vergeben @sadhana-s-codez hat das vor 2 Tagen übernommen. Offen
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 85/100
PerlDancer/Dancer2#1854 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag
-
bug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
major/MySQLTuner-perl#1007 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 88/100
-
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 88/100