Re: DBD::Oracle 1.80 & Oracle client 19c Segfaults on Destroy

[email protected] (Scott) Sat, 20 Jun 2020 15:12:36 -0500
Newsgroups perl.dbi.users
Message-ID <[email protected]>
On 6/20/20 1:51 PM, Scott wrote:
> More info, this error does not occur with DBD::Oracle 1.76.
>
> DBD::Oracle 1.80 => works with 18c client,  but fails with 19c.
> DBD::Oracle 1.76 => works with all client versions.
>
>
> On 6/19/20 5:48 PM, Scott wrote:
>> We have run into an issue when we upgraded to Oracle client 19c. Some 
>> of the users processes are segfaulting on exit.
>>
>> #0  0x00007f82ee84ccc0 in pthread_mutex_lock () from 
>> /lib64/libpthread.so.0
>> #1  0x00007f82e6444f43 in kputxabt () from 
>> /u01/app/oracle/product/19.3.0.0/lib/libclntsh.so.19.1
>> #2  0x00007f82e926e6c3 in ora_db_rollback () from 
>> /usr/local/perl-5.22.0-thr/lib/site_perl/5.22.0/x86_64-linux-thread-multi/auto/DBD/Oracle/Oracle.so
>> #3  0x00007f82e9266b11 in XS_DBD__Oracle__db_DESTROY () from 
>> /usr/local/perl-5.22.0-thr/lib/site_perl/5.22.0/x86_64-linux-thread-multi/auto/DBD/Oracle/Oracle.so
>> #4  0x00007f82ed10291d in XS_DBI_dispatch () from 
>> /usr/local/perl-5.22.0-thr/lib/site_perl/5.22.0/x86_64-linux-thread-multi/auto/DBI/DBI.so
>>
>> I tested the same process on a server still  using the 18c client and 
>> the core dump does not happen.  Our DBA is creating
>> ticket with Oracle, but I wanted to see if anyone else has had the 
>> same issue.
>>
>> Thanks,
>>
>> Scott
>
I assuming this is the change causing the segfault with 19c client.

  Destroy envhp with last dbh (GH#93, GH#89, Dean Hamstead, CarstenGrohmann)

  diff -w ../DBD-Oracle-1.76/dbdimp.c ./dbdimp.c 1
218,222d217
<       if (imp_drh->envhp) {
<               /* Free cached environment handle. */
<               OCIHandleFree_log_stat(imp_drh, imp_drh->envhp, 
OCI_HTYPE_ENV, status);
<       }
<
319c314
<       case ORA_XMLTYPE:               /* SQLT_NTY must be carefull 
here as its value (108) is the same for an embedded object Well realy 
only XML clobs not embedded objects  */
---
 >       case ORA_XMLTYPE:               /* SQLT_NTY must be careful 
here as its value (108) is the same for an embedded object Well really 
only XML clobs not embedded objects */
863c858
<                               session_pool_t pool_data = { };
---
 >                               session_pool_t pool_data = {0};
1258a1254
 >                       /* free session environment handle */
1260a1257,1266
 >                               if ( status == OCI_SUCCESS ) {
 > imp_dbh->envhp = NULL;
 >                               }
 >                       /* free global environment handle during 
destruction of last connection */
 >                       } else if ( (imp_dbh->envhp == imp_drh->envhp) 
&& (SvTRUE(perl_get_sv("DBI::PERL_ENDING",0))) ) {
 > OCIHandleFree_log_stat(imp_dbh, imp_dbh->envhp, OCI_HTYPE_ENV, status);
 >                               if ( status == OCI_SUCCESS ) {
 > imp_dbh->envhp = NULL;
 > imp_drh->envhp = NULL;
 >                               }
3739c3745
<                 as we may have more thatn one exe on a prepare*/
---
 >                 as we may have more than one exe on a prepare*/
4779c4785
<     bool can_taf = 0;
---
 >     boolean can_taf = 0;