perl5-dbi / dbi

DBI - The Perl 5 Database Interface
Other
83 stars 58 forks source link

segmentation fault with DBI->connect #157

Open rwfranks opened 1 month ago

rwfranks commented 1 month ago

Transcribed verbatim from CPAN RT#125567, warts and all.

Tue Jun 12 10:33:50 2018 richard.tomasso [...] exfo.com - Ticket created Subject: segmentation fault with DBI->connect

Date: Tue, 12 Jun 2018 14:10:59 +0000 To: "bug-DBI@rt.cpan.org" bug-DBI@rt.cpan.org From: Richard Tomasso richard.tomasso@exfo.com

So I've got a weird problem that may be in the DBI library. Two servers, one can connect to Oracle database and one cannot. The Oracle client setup and our code are identical on both machines. This is using Perl 5.20 connecting to Oracle 12.1 running on RHEL 7.3. I can connect to Oracle via SQLPlus on this machine. The strangest part is DBI->connect() is resulting in a segfault, I would have expected an error/exception to be raised but nothing, even setting that Attribute. No external connection is made.

Here is the trace. The GetDBHandle module just validates the arguments and makes the call to connect to return the dbh. I used all formats for the dsn and always get the same thing. I removed the attributes from the connect() call and it looks the same.

Any ideas?

bash-4.2$ export DBI_TRACE=9

bash-4.2$ perl the-script.pl -db db1 -user dbuser -pass ***

    DBI 1.636-ithread default trace level set to 0x0/9 (pid 22036 pi 92a7008) at DBI.pm line 296 via GetDBHandle.pm line 48

    > DBI>connect(dbi:Oracle:db1, dbuser, ****, HASH(0x92aa668))

    > DBI>install_driver(Oracle) for linux perl=5.020003 pid=22036 ruid=1009 euid=1009

       install_driver: DBD::Oracle version 1.74 loaded from /prod/perl/lib/site_perl/5.20.3/i686-linux-thread-multi/DBD/Oracle.pm

    New 'DBI::dr' (for DBD::Oracle::dr, parent='', id=undef)

    dbih_setup_handle(DBI::dr=HASH(0xe8d8ec8)=>DBI::dr=HASH(0xe8d8f28), DBD::Oracle::dr, 0, Null!)

    dbih_make_com(Null!, 0, DBD::Oracle::dr, 104, 0) thr#92a7008

    dbih_setup_attrib(DBI::dr=HASH(0xe8d8f28), Err, Null!) SCALAR(0x9ffae30) (already defined)

    dbih_setup_attrib(DBI::dr=HASH(0xe8d8f28), State, Null!) SCALAR(0x9d2e410) (already defined)

    dbih_setup_attrib(DBI::dr=HASH(0xe8d8f28), Errstr, Null!) SCALAR(0x9ffae60) (already defined)

    dbih_setup_attrib(DBI::dr=HASH(0xe8d8f28), TraceLevel, Null!) 0 (already defined)

    dbih_setup_attrib(DBI::dr=HASH(0xe8d8f28), FetchHashKeyName, Null!) 'NAME' (already defined)

    >> STORE       DISPATCH (DBI::dr=HASH(0xe8d8ec8) rc1/1 @3 g2 ima41c pid#22036) at /prod/perl/lib/site_perl/5.20.3/i686-linux-thread-multi/DBD/Oracle.pm line 81 via  at /prod/Modules/GetDBHandle.pm line 129

    -> STORE in DBD::_::common for DBD::Oracle::dr (DBI::dr=HASH(0xe8d8ec8)~0xe8d8f28 'ShowErrorStatement' 1) thr#92a7008

    STORE DBI::dr=HASH(0xe8d8f28) 'ShowErrorStatement' => 1

    <- STORE= ( 1 ) [1 items] at /prod/perl/lib/site_perl/5.20.3/i686-linux-thread-multi/DBD/Oracle.pm line 81 via  at /prod/Modules/GetDBHandle.pm line 129

    <- install_driver= DBI::dr=HASH(0xe8d8ec8)

    >> connect     DISPATCH (DBI::dr=HASH(0xe8d8ec8) rc2/3 @5 g2 ima8001 pid#22036) at /prod/perl/lib/site_perl/5.20.3/i686-linux-thread-multi/DBI.pm line 684 via  at /prod/Modules/GetDBHandle.pm line 129

    -> connect for DBD::Oracle::dr (DBI::dr=HASH(0xe8d8ec8)~0xe8d8f28 'db1' 'dbuser' **** HASH(0x9cf5588)) thr#92a7008

    New 'DBI::db' (for DBD::Oracle::db, parent=DBI::dr=HASH(0xe8d8f28), id=undef)

    dbih_setup_handle(DBI::db=HASH(0xe8df1e8)=>DBI::db=HASH(0xe8df138), DBD::Oracle::db, 9d39c48, Null!)

    dbih_make_com(DBI::dr=HASH(0xe8d8f28), 92c9918, DBD::Oracle::db, 240, e8df168) thr#92a7008

    dbih_setup_attrib(DBI::db=HASH(0xe8df138), Err, DBI::dr=HASH(0xe8d8f28)) SCALAR(0x9d39e18) (already defined)

    dbih_setup_attrib(DBI::db=HASH(0xe8df138), State, DBI::dr=HASH(0xe8d8f28)) SCALAR(0x9d39e78) (already defined)

    dbih_setup_attrib(DBI::db=HASH(0xe8df138), Errstr, DBI::dr=HASH(0xe8d8f28)) SCALAR(0x9d39e48) (already defined)

    dbih_setup_attrib(DBI::db=HASH(0xe8df138), TraceLevel, DBI::dr=HASH(0xe8d8f28)) 0 (already defined)

    dbih_setup_attrib(DBI::db=HASH(0xe8df138), FetchHashKeyName, DBI::dr=HASH(0xe8d8f28)) 'NAME' (already defined)

    dbih_setup_attrib(DBI::db=HASH(0xe8df138), HandleSetErr, DBI::dr=HASH(0xe8d8f28)) undef (not defined)

    dbih_setup_attrib(DBI::db=HASH(0xe8df138), HandleError, DBI::dr=HASH(0xe8d8f28)) undef (not defined)

    dbih_setup_attrib(DBI::db=HASH(0xe8df138), Profile, DBI::dr=HASH(0xe8d8f28)) undef (not defined)

        OCIAttrSet(0,OCI_HTYPE_SESSION, f6d8bcd2,11,Attr=OCI_ATTR_DRIVER_NAME,0)=INVALID_HANDLE
rwfranks commented 1 month ago

Thu Jan 10 03:55:14 2019 almir.abrarov [...] gmail.com - Correspondence added

Втр Июн 12 10:33:50 2018, richard.tomasso@exfo.com писал:

So I've got a weird problem that may be in the DBI library. Two servers, one can connect to Oracle database and one cannot. The Oracle client setup and our code are identical on both machines. This is using Perl 5.20 connecting to Oracle 12.1 running on RHEL 7.3. I can connect to Oracle via SQLPlus on this machine. The strangest part is DBI->connect() is resulting in a segfault, I would have expected an error/exception to be raised but nothing, even setting that Attribute. No external connection is made.

Here is the trace. The GetDBHandle module just validates the arguments and makes the call to connect to return the dbh. I used all formats for the dsn and always get the same thing. I removed the attributes from the connect() call and it looks the same.

Any ideas?

bash-4.2$ export DBI_TRACE=9

bash-4.2$ perl the-script.pl -db db1 -user dbuser -pass ***

DBI 1.636-ithread default trace level set to 0x0/9 (pid 22036 pi 92a7008) at DBI.pm line 296 via GetDBHandle.pm line 48

DBI> connect(dbi:Oracle:db1, dbuser, ****, HASH(0x92aa668))

DBI> install_driver(Oracle) for linux perl=5.020003 pid=22036 DBI> ruid=1009 euid=1009

install_driver: DBD::Oracle version 1.74 loaded from /prod/perl/lib/site_perl/5.20.3/i686-linux-thread-multi/DBD/Oracle.pm

New 'DBI::dr' (for DBD::Oracle::dr, parent='', id=undef)

dbih_setup_handle(DBI::dr=HASH(0xe8d8ec8)=>DBI::dr=HASH(0xe8d8f28), DBD::Oracle::dr, 0, Null!)

dbih_make_com(Null!, 0, DBD::Oracle::dr, 104, 0) thr#92a7008

dbih_setup_attrib(DBI::dr=HASH(0xe8d8f28), Err, Null!) SCALAR(0x9ffae30) (already defined)

dbih_setup_attrib(DBI::dr=HASH(0xe8d8f28), State, Null!) SCALAR(0x9d2e410) (already defined)

dbih_setup_attrib(DBI::dr=HASH(0xe8d8f28), Errstr, Null!) SCALAR(0x9ffae60) (already defined)

dbih_setup_attrib(DBI::dr=HASH(0xe8d8f28), TraceLevel, Null!) 0 (already defined)

dbih_setup_attrib(DBI::dr=HASH(0xe8d8f28), FetchHashKeyName, Null!) 'NAME' (already defined)

STORE DISPATCH (DBI::dr=HASH(0xe8d8ec8) rc1/1 @3 g2 ima41c pid#22036) at /prod/perl/lib/site_perl/5.20.3/i686-linux-thread- multi/DBD/Oracle.pm line 81 via at /prod/Modules/GetDBHandle.pm line 129

-> STORE in DBD::_::common for DBD::Oracle::dr (DBI::dr=HASH(0xe8d8ec8)~0xe8d8f28 'ShowErrorStatement' 1) thr#92a7008

STORE DBI::dr=HASH(0xe8d8f28) 'ShowErrorStatement' => 1

<- STORE= ( 1 ) [1 items] at /prod/perl/lib/site_perl/5.20.3/i686- linux-thread-multi/DBD/Oracle.pm line 81 via at /prod/Modules/GetDBHandle.pm line 129

<- install_driver= DBI::dr=HASH(0xe8d8ec8)

connect DISPATCH (DBI::dr=HASH(0xe8d8ec8) rc2/3 @5 g2 ima8001 pid#22036) at /prod/perl/lib/site_perl/5.20.3/i686-linux-thread- multi/DBI.pm line 684 via at /prod/Modules/GetDBHandle.pm line 129

-> connect for DBD::Oracle::dr (DBI::dr=HASH(0xe8d8ec8)~0xe8d8f28 'db1' 'dbuser' **** HASH(0x9cf5588)) thr#92a7008

New 'DBI::db' (for DBD::Oracle::db, parent=DBI::dr=HASH(0xe8d8f28), id=undef)

dbih_setup_handle(DBI::db=HASH(0xe8df1e8)=>DBI::db=HASH(0xe8df138), DBD::Oracle::db, 9d39c48, Null!)

dbih_make_com(DBI::dr=HASH(0xe8d8f28), 92c9918, DBD::Oracle::db, 240, e8df168) thr#92a7008

dbih_setup_attrib(DBI::db=HASH(0xe8df138), Err, DBI::dr=HASH(0xe8d8f28)) SCALAR(0x9d39e18) (already defined)

dbih_setup_attrib(DBI::db=HASH(0xe8df138), State, DBI::dr=HASH(0xe8d8f28)) SCALAR(0x9d39e78) (already defined)

dbih_setup_attrib(DBI::db=HASH(0xe8df138), Errstr, DBI::dr=HASH(0xe8d8f28)) SCALAR(0x9d39e48) (already defined)

dbih_setup_attrib(DBI::db=HASH(0xe8df138), TraceLevel, DBI::dr=HASH(0xe8d8f28)) 0 (already defined)

dbih_setup_attrib(DBI::db=HASH(0xe8df138), FetchHashKeyName, DBI::dr=HASH(0xe8d8f28)) 'NAME' (already defined)

dbih_setup_attrib(DBI::db=HASH(0xe8df138), HandleSetErr, DBI::dr=HASH(0xe8d8f28)) undef (not defined)

dbih_setup_attrib(DBI::db=HASH(0xe8df138), HandleError, DBI::dr=HASH(0xe8d8f28)) undef (not defined)

dbih_setup_attrib(DBI::db=HASH(0xe8df138), Profile, DBI::dr=HASH(0xe8d8f28)) undef (not defined)

OCIAttrSet(0,OCI_HTYPE_SESSION, f6d8bcd2,11,Attr=OCI_ATTR_DRIVER_NAME,0)=INVALID_HANDLE

some problem for me.

for DBD::Oracle 1.74 ..... ! >> DESTROY DISPATCH (DBI::dr=HASH(0x33b3380) rc1/1 @1 g2 ima10004 pid#22496) during global destruction

>> DESTROY DBI::dr=HASH(0x33b3380) clearing 1 CachedKids

! -> DESTROY in DBD::_::common for DBD::Oracle::dr (DBI::dr=HASH(0x33b3380)~INNER) thr#1e57010 ! <- DESTROY= ( undef ) [1 items] during global destruction DESTROY (dbih_clearcom) (drh 0x33b3308, com 0x33e2ff0, imp global destruction): FLAGS 0x102215: COMSET Active Warn PrintWarn ShowErrorStatement AutoCommit PARENT undef KIDS 1 (1 Active) dbih_clearcom 0x33b3308 (com 0x33e2ff0, type 1) done.

! >> DESTROY DISPATCH (DBIx::ContextualFetch::db=HASH(0x33e60c0) rc1/1 @1 g2 ima10004 pid#22496) during global destruction ! -> DESTROY for DBD::Oracle::db (DBIx::ContextualFetch::db=HASH(0x33e60c0)~INNER) thr#1e57010 OCISessionEnd(34b8d98,34b8e80,34f8700,mode=DEFAULT 0)=SUCCESS OCIServerDetach(34b9e40,34b8e80,mode=DEFAULT,0)=SUCCESS OCIHandleFree(34f8700,OCI_HTYPE_SESSION)=SUCCESS OCIHandleFree(34b8d98,OCI_HTYPE_SVCCTX)=SUCCESS OCIHandleFree(34b9e40,OCI_HTYPE_SERVER)=SUCCESS OCIHandleFree(34b8e80,OCI_HTYPE_ERROR)=SUCCESS !T <- DESTROY= ( undef ) [1 items] during global destruction DESTROY (dbih_clearcom) (dbh 0x33e60d8, com 0x33ea690, imp global destruction): FLAGS 0x1e22d1: COMSET Warn ChopBlanks RaiseError PrintWarn ShowErrorStatement AutoCommit TaintIn TaintOut PARENT undef KIDS 0 (0 Active) LongReadLen 2097152 dbih_clearcom 0x33e60d8 (com 0x33ea690, type 2) done.

! >> DESTROY DISPATCH (DBI::dr=HASH(0x33b3308) rc1/1 @1 g2 ima10004 pid#22496) during global destruction ! <> DESTROY for DBI::dr=HASH(0x33b3308) ignored (inner handle gone) ! >> DESTROY DISPATCH (DBIx::ContextualFetch::db=HASH(0x33e60d8) rc1/1 @1 g2 ima10004 pid#22496) during global destruction ! <> DESTROY for DBIx::ContextualFetch::db=HASH(0x33e60d8) ignored (inner handle gone)

for DBD:Oracle 1.76 .... ! >> DESTROY DISPATCH (DBI::dr=HASH(0x556494047aa0) rc1/1 @1 g2 ima10004 pid#28793) during global destruction

>> DESTROY DBI::dr=HASH(0x556494047aa0) clearing 1 CachedKids

! -> DESTROY for DBD::Oracle::dr (DBI::dr=HASH(0x556494047aa0)~INNER) thr#5564920f3010 OCIHandleFree(5564940d2480,OCI_HTYPE_ENV)=SUCCESS ! <- DESTROY= ( undef ) [1 items] during global destruction DESTROY (dbih_clearcom) (drh 0x556494047a28, com 0x55649404b230, imp global destruction): FLAGS 0x102215: COMSET Active Warn PrintWarn ShowErrorStatement AutoCommit PARENT undef KIDS 1 (1 Active) dbih_clearcom 0x556494047a28 (com 0x55649404b230, type 1) done.

! >> DESTROY DISPATCH (DBIx::ContextualFetch::db=HASH(0x55649404e2c0) rc1/1 @1 g2 ima10004 pid#28793) during global destruction ! -> DESTROY for DBD::Oracle::db (DBIx::ContextualFetch::db=HASH(0x55649404e2c0)~INNER) thr#5564920f3010 Segmentation fault

Thu Jan 10 03:55:16 2019 The RT System itself - Status changed from 'new' to 'open'