Subject: | Core-Dump / Segementation fault together with SSL connections |
Date: | Wed, 17 Jun 2009 13:38:25 +0200 |
To: | <bug-DBD-Oracle [...] rt.cpan.org> |
From: | <Hartmut.Vogler [...] t-systems.com> |
Hi,
i get segmentation faults and perl errors, if i use DBD::Oracle together
with SSL connections. I have consolidate the problem in two "mini"
scripts:
TestProg1:
==========
<---------------------------------- cut
------------------------------------->
#!/usr/bin/perl
use strict;
use DBI;
use Net::LDAP;
sub tst1 {
my $ldap=Net::LDAP->new("ldaps://corporate-directory.myorg.com:636
<ldaps://corporate-directory.myorg.com:636> ");
return($ldap);
}
printf("DEBUG: before DBI connect\n");
my $db=DBI->connect("dbi:Oracle:myoracledb","MYACCOUNT","?????");
printf("DEBUG: before function tst1()\n");
tst1();
printf("DEBUG: after function tst1()\n");
<---------------------------------- cut
------------------------------------->
The TestProg1 breaks after call of tst1(); with a segementation fault.
The analyse of this core gives not mutch infos to me:
gdb /usr/bin/perl core
backtrace
#0 0xb6e163d3 in ?? ()
#1 0xb6ef6a7c in ?? ()
#2 0xb0191288 in ?? ()
#3 0xb01912c4 in ?? ()
#4 0xbfe17f18 in ?? ()
#5 0xb6e15ad6 in ?? ()
#6 0xb019129c in ?? ()
#7 0x00000000 in ?? ()
If i run TestProg1 without the Oracle database connection, i works well.
In the second scenario i open a HTTPS connection to a web-server with
LWP::UserAgent :
TestProg2:
==========
<---------------------------------- cut
------------------------------------->
#!/usr/bin/perl
use strict;
use DBI;
use LWP::UserAgent;
sub tst1 {
my $ADDR='https://darwin.telekom.de/darwin/auth/base/menu/root';
my $ua=LWP::UserAgent->new();
my $request = HTTP::Request->new(GET => $ADDR);
my $response = $ua->request($request) or warn "cannot request";
}
printf("DEBUG: before DBI connect\n");
my $db=DBI->connect("dbi:Oracle:myoracledb","MYACCOUNT","?????");
printf("DEBUG: before function tst1()\n");
tst1();
printf("DEBUG: after function tst1()\n");
<---------------------------------- cut
------------------------------------->
This programm results in an "heavy" perl error:
./httpstest.pl
DEBUG: before DBI connect
DEBUG: before function tst1()
*** glibc detected *** /usr/bin/perl: free(): invalid pointer:
0xb7f76190 ***
======= Backtrace: =========
/lib/libc.so.6[0xb7ea5845]
/lib/libc.so.6(cfree+0x9c)[0xb7ea76ec]
/usr/lib/oracle/10.2.0.4/client/lib/libnnz10.so(T_free+0x20)[0xb6f750b4]
/usr/lib/oracle/10.2.0.4/client/lib/libnnz10.so(R_free+0x1c)[0xb6edb738]
/usr/lib/oracle/10.2.0.4/client/lib/libnnz10.so(bn_expand2+0x14f)[0xb6ec
feeb]
/usr/lib/oracle/10.2.0.4/client/lib/libnnz10.so(BN_set_word+0x33)[0xb6ed
01cd]
/usr/lib/i686/cmov/libcrypto.so.0.9.8(BN_MONT_CTX_set+0x91)[0xb2678861]
/usr/lib/i686/cmov/libcrypto.so.0.9.8(BN_MONT_CTX_set_locked+0x108)[0xb2
678c28]
/usr/lib/i686/cmov/libcrypto.so.0.9.8[0xb268e99b]
/usr/lib/i686/cmov/libcrypto.so.0.9.8(RSA_public_decrypt+0x2e)[0xb268f94
e]
/usr/lib/i686/cmov/libcrypto.so.0.9.8(RSA_verify+0x16d)[0xb269079d]
/usr/lib/i686/cmov/libcrypto.so.0.9.8(EVP_VerifyFinal+0x117)[0xb26b8387]
/usr/lib/i686/cmov/libcrypto.so.0.9.8(ASN1_item_verify+0xdb)[0xb26c3abb]
/usr/lib/i686/cmov/libcrypto.so.0.9.8(X509_verify+0x3e)[0xb26e936e]
/usr/lib/i686/cmov/libcrypto.so.0.9.8[0xb26e3960]
/usr/lib/i686/cmov/libcrypto.so.0.9.8(X509_verify_cert+0x7cf)[0xb26e433f
]
/usr/lib/i686/cmov/libssl.so.0.9.8(ssl_verify_cert_chain+0x18e)[0xb2780e
fe]
/usr/lib/i686/cmov/libssl.so.0.9.8(ssl3_get_server_certificate+0x2ca)[0x
b2767b7a]
/usr/lib/i686/cmov/libssl.so.0.9.8(ssl3_connect+0x9d5)[0xb27692f5]
/usr/lib/i686/cmov/libssl.so.0.9.8(SSL_connect+0x2a)[0xb277cc1a]
/usr/lib/i686/cmov/libssl.so.0.9.8(ssl23_connect+0x78a)[0xb277014a]
/usr/lib/i686/cmov/libssl.so.0.9.8(SSL_connect+0x2a)[0xb277cc1a]
/usr/lib/perl5/auto/Crypt/SSLeay/SSLeay.so(XS_Crypt__SSLeay__Conn_connec
t+0x1a2)[0xb27a7c42]
/usr/bin/perl(Perl_pp_entersub+0x552)[0x80b32d2]
/usr/bin/perl(Perl_runops_standard+0x19)[0x80b1879]
/usr/bin/perl(perl_run+0x2e0)[0x80ac6a0]
/usr/bin/perl(main+0xed)[0x8063ddd]
/lib/libc.so.6(__libc_start_main+0xe5)[0xb7e51455]
/usr/bin/perl[0x8063c51]
======= Memory map: ========
08048000-08179000 r-xp 00000000 03:01 540719 /usr/bin/perl
08179000-0817b000 rw-p 00130000 03:01 540719 /usr/bin/perl
0817b000-0859f000 rw-p 0817b000 00:00 0 [heap]
b2400000-b2421000 rw-p b2400000 00:00 0
b2421000-b2500000 ---p b2421000 00:00 0
b25c5000-b25d1000 r-xp 00000000 03:01 737319 /lib/libgcc_s.so.1
b25d1000-b25d2000 rw-p 0000b000 03:01 737319 /lib/libgcc_s.so.1
b25d2000-b25e1000 r-xp 00000000 03:01 742217 /lib/libresolv-2.7.so
b25e1000-b25e3000 rw-p 0000e000 03:01 742217 /lib/libresolv-2.7.so
b25e3000-b25e5000 rw-p b25e3000 00:00 0
b25e5000-b25f9000 r-xp 00000000 03:01 623771
/usr/lib/libz.so.1.2.3.3
b25f9000-b25fa000 rw-p 00013000 03:01 623771
/usr/lib/libz.so.1.2.3.3
b25fa000-b2734000 r-xp 00000000 03:01 2080788
/usr/lib/i686/cmov/libcrypto.so.0.9.8
b2734000-b274a000 rw-p 0013a000 03:01 2080788
/usr/lib/i686/cmov/libcrypto.so.0.9.8
b274a000-b274d000 rw-p b274a000 00:00 0
b274d000-b278f000 r-xp 00000000 03:01 2080776
/usr/lib/i686/cmov/libssl.so.0.9.8
b278f000-b2793000 rw-p 00042000 03:01 2080776
/usr/lib/i686/cmov/libssl.so.0.9.8
b27a2000-b27ac000 r-xp 00000000 03:01 4046886
/usr/lib/perl5/auto/Crypt/SSLeay/SSLeay.so
b27ac000-b27ad000 rw-p 00009000 03:01 4046886
/usr/lib/perl5/auto/Crypt/SSLeay/SSLeay.so
b27ad000-b27f9000 rw-p b27ad000 00:00 0
b27f9000-b2802000 r-xp 00000000 03:01 737378
/lib/libnss_files-2.7.so
b2802000-b2804000 rw-p 00008000 03:01 737378
/lib/libnss_files-2.7.so
b2804000-b280c000 r-xp 00000000 03:01 742104
/lib/libnss_nis-2.7.so
b280c000-b280e000 rw-p 00007000 03:01 742104
/lib/libnss_nis-2.7.so
b280e000-b2815000 r-xp 00000000 03:01 737363
/lib/libnss_compat-2.7.so
b2815000-b2817000 rw-p 00006000 03:01 737363
/lib/libnss_compat-2.7.so
b2817000-b6d65000 r-xp 00000000 03:01 1627229
/usr/lib/oracle/10.2.0.4/client/lib/libociei.so
b6d65000-b6d67000 rw-p 0454d000 03:01 1627229
/usr/lib/oracle/10.2.0.4/client/lib/libociei.so
b6d67000-b6d8a000 rw-p b6d67000 00:00 0
b6d8a000-b6d9d000 r-xp 00000000 03:01 737346 /lib/libnsl-2.7.so
b6d9d000-b6d9f000 rw-p 00012000 03:01 737346 /lib/libnsl-2.7.so
b6d9f000-b6da1000 rw-p b6d9f000 00:00 0
b6da1000-b6da5000 r-xp 00000000 03:01 737373
/lib/libnss_dns-2.7.so
b6da5000-b6da7000 rw-p 00003000 03:01 737373
/lib/libnss_dns-2.7.so
b6da7000-b6daa000 r-xp 00000000 03:01 3621281
/usr/lib/perl/5.10.0/auto/MIME/Base64/Base64.so
b6daa000-b6dab000 rw-p 00002000 03:01 3621281
/usr/lib/perl/5.10.0/auto/MIME/Base64/Base64.so
b6dab000-b6daf000 r-xp 00000000 03:01 3621685
/usr/lib/perl/5.10.0/auto/Socket/Socket.so
b6daf000-b6db0000 rw-p 00004000 03:01 3621685
/usr/lib/perl/5.10.0/auto/Socket/Socket.so
b6db0000-b6f8e000 r-xp 00000000 03:01 1627227
/usr/lib/oracle/10.2.0.4/client/lib/libnnz10.so
b6f8e000-b6fb5000 rw-p 001dd000 03:01 1627227
/usr/lib/oracle/10.2.0.4/client/lib/libnnz10.so
b6fb5000-b6fb6000 rw-p b6fb5000 00:00 0
b6fb6000-b7d3a000 r-xp 00000000 03:01 1627226
/usr/lib/oracle/10.2.0.4/client/lib/libclntsh.so.10.1
b7d3a000-b7d9c000 rw-p 00d84000 03:01 1627226
/usr/lib/oracle/10.2.0.4/client/lib/libclntsh.so.10.1
b7d9c000-b7db1000 rw-p b7d9c000 00:00 0
b7db1000-b7de6000 r-xp 00000000 03:01 3719720
/usr/lib/perl5/auto/DBD/Oracle/Oracle.so
b7de6000-b7de7000 rw-p 00034000 03:01 3719720
/usr/lib/perl5/auto/DBD/Oracle/Oracle.so
b7de7000-b7e07000 r-xp 00000000 03:01 3719221
/usr/lib/perl5/auto/DBI/DBI.so
b7e07000-b7e08000 rw-p 0001f000 03:01 3719221
/usr/lib/perl5/auto/DBI/DBI.so
b7e08000-b7e09000 rw-p b7e08000 00:00 0
b7e09000-b7e12000 r-xp 00000000 03:01 737310 /lib/libcrypt-2.7.so
b7e12000-b7e14000 rw-p 00008000 03:01 737310 /lib/libcrypt-2.7.so
b7e14000-b7e3b000 rw-p b7e14000 00:00 0
b7e3b000-b7f73000 r-xp 00000000 03:01 737308 /lib/libc-2.7.so
b7f73000-b7f74000 r--p 00138000 03:01 737308 /lib/libc-2.7.so
b7f74000-b7f76000 rw-p 00139000 03:01 737308 /lib/libc-2.7.so
b7f76000-b7f79000 rw-p b7f7Aborted
My conclusion is, that DBD::Oracle not works together with
IO::Socket::SSL.
The problem can be reproduce in a standard Debian (Lenny) enviroment:
perl 5.10.0-19
libnet-ssleay-perl 1.35-1
libio-socket-ssl-perl 1.16-1
libnet-ldap-perl 1:0.36-1
libwww-perl 5.813-1
libmime-perl 5.427
libmime-tools-perl 5.427
libdbi-perl 1.605-1
openssl 0.9.8g-15
libssl0.9.8 0.9.8g-15
gcc 4:4.3.2
libgcc1 1:4.3.2-1.1
libglib2.0-0 2.16.6-1
I installed DBD::Oracle from http://oss.oracle.com/debian
<http://oss.oracle.com/debian> :
libdbd-oracle-perl 1.21-2
The packet ...
oracle-instantclient-basic 10.2.0.4-2
... has been downloaded as RPM from ...
http://www.oracle.com/technology/software/tech/oci/instantclient/htdocs/
linuxsoft.html
<http://www.oracle.com/technology/software/tech/oci/instantclient/htdocs
/linuxsoft.html>
... and be converted to deb with "alien";
The o.g. bug also happens with oracle-instantclient-basic version
10.2.0.3-2 .
I also have try to install/link the DBD::Oracle driver by my self with
the following script:
#!/bin/bash
set -x
cd /tmp
rm -Rf DBD-Oracle* 2>/dev/null
wget -O DBD-Oracle.tgz \
http://search.cpan.org/CPAN/authors/id/P/PY/PYTHIAN/DBD-Oracle-1.23.tar.
gz
tar -xzvf DBD-Oracle*.tgz
rm DBD-Oracle*.tgz
cd DBD-Oracle*
export ORACLE_HOME=`echo /usr/lib/oracle/10.*/client/lib`
export LD_LIBRARY_PATH=$ORACLE_HOME
export TNS_ADMIN=/etc/oracle
perl Makefile.PL
make
sudo make install
... the problem is the same, as it happens with the prebuild DBD from
http://oss.oracle.com/debian <http://oss.oracle.com/debian>
The problem with segmentation faults while DBD::Oracle connections and
SSL connections already happens in Debian-etch, but in etch the problem
was not reproducible. On Debian-Etch the segmentation fault happens some
times - i could'nt find a reproducible pattern.
Regards
Hartmut Vogler