Subject: | DBD::Firebird Periodically Segfaults on shutdown. |
Date: | Mon, 21 Jan 2019 10:44:08 -0800 |
To: | bug-DBD-Firebird [...] rt.cpan.org |
From: | David Wheeler <david [...] justatheory.com> |
I've been trying to chase down why the Sqitch Travis CI tests regularly hang when testing the Firebird engine. Doing some experimentation on my Mac, I've noticed that Perl segfaults every 2-6 runs. I turned on DBI tracing, and the last bit the DBI emits before the segfault is:
fetch ends: ib_commit_transaction succeed.
<- fetch= ( undef ) [1 items] row4 at t/lib/DBIEngineTest.pm line 1774 via at /Users/david/.plenv/versions/5.28.0/lib/perl5/site_perl/5.28.0/Test/Builder.pm line 339
Show quoted text
>> DESTROY DISPATCH (DBI::st=HASH(0x7ff89eae3388) rc1/1 @1 g2 ima10004 pid#7161) at t/lib/DBIEngineTest.pm line 1781 via at t/lib/DBIEngineTest.pm line 1781
<> DESTROY(DBI::st=HASH(0x7ff89eae3388)) ignored for outer handle (inner DBI::st=HASH(0x7ff89eaf2ee8) has ref cnt 1)
Show quoted text >> DESTROY DISPATCH (DBI::st=HASH(0x7ff89eaf2ee8) rc1/1 @1 g2 ima10004 pid#7161) at t/lib/DBIEngineTest.pm line 1781 via at t/lib/DBIEngineTest.pm line 1781
-> DESTROY for DBD::Firebird::st (DBI::st=HASH(0x7ff89eaf2ee8)~INNER)
dbd_st_destroy
dbd_st_destroy: found in_sqlda..
dbd_st_destroy: freeing in_sqlda..
dbd_st_destroy: isc_dsql_free_statement succeeded.
dbd_st_destroy: sth removed from linked list.
<- DESTROY= ( undef ) [1 items] at t/lib/DBIEngineTest.pm line 1781 via at t/lib/DBIEngineTest.pm line 1781
DESTROY (dbih_clearcom) (sth 0x7ff89eaf2ee8, com 0x7ff89e5d9e10, imp DBD::Firebird::st):
FLAGS 0x188011: COMSET Warn HandleError PrintWarn
PARENT DBI::db=HASH(0x7ff8a13d9798)
KIDS 0 (0 Active)
NUM_OF_FIELDS 2
NUM_OF_PARAMS 1
dbih_clearcom 0x7ff89eaf2ee8 (com 0x7ff89e5d9e10, type 3) done.
Show quoted text >> DESTROY DISPATCH (DBI::db=HASH(0x7ff8a1a70348) rc1/1 @1 g2 ima10004 pid#7161) at t/lib/DBIEngineTest.pm line 1781 via at t/lib/DBIEngineTest.pm line 1781
<> DESTROY(DBI::db=HASH(0x7ff8a1a70348)) ignored for outer handle (inner DBI::db=HASH(0x7ff8a13d9798) has ref cnt 1)
Show quoted text >> DESTROY DISPATCH (DBI::db=HASH(0x7ff8a13d9798) rc1/1 @1 g2 ima10004 pid#7161) at t/lib/DBIEngineTest.pm line 1781 via at t/lib/DBIEngineTest.pm line 1781
-> DESTROY for DBD::Firebird::db (DBI::db=HASH(0x7ff8a13d9798)~INNER)
dbd_db_disconnect
dbd_db_destroy
<- DESTROY= ( undef ) [1 items] at t/lib/DBIEngineTest.pm line 1781 via at t/lib/DBIEngineTest.pm line 1781
DESTROY (dbih_clearcom) (dbh 0x7ff8a13d9798, com 0x7ff8a0b1ef60, imp DBD::Firebird::db):
FLAGS 0x188211: COMSET Warn HandleError PrintWarn AutoCommit
PARENT DBI::dr=HASH(0x7ff8a1a670b8)
KIDS 0 (0 Active)
IMP_DATA HASH(0x7ff8a03dd2a8)
dbih_clearcom 0x7ff8a13d9798 (com 0x7ff8a0b1ef60, type 2) done.
The complete output is attached.
Sqitch has no explicit call to disconnect, so it looks like the DBI is calling disconnect_all on exit. Could there be some kind of memory issue there?
In case you want to try running the Sqitch tests, I'm using Docker to run Firebird:
docker run --name fb --rm -it -d -e ISC_PASSWORD=nix -e FIREBIRD_DATABASE=test.db -p 3050:3050 jacobalberty/firebird:3.0
I've simply added DBI->trace(15) to t/firebird.t, and then run the tests directly via perl rather than prove:
FIREBIRD_URI=db:firebird://sysdba:nix@0.0.0.0//firebird/data/test.db perl -I lib t/firebird.t 2>stderr.log
I simply keep running them until I see
zsh: segmentation fault FIREBIRD_URI=db:firebird://sysdba:nix@0.0.0.0//firebird/data/test.db perl -I
Message body not shown because it is not plain text.