You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by "Snook, Adrian (London)" <Ad...@ml.com> on 2007/01/04 11:43:25 UTC

Bug Report

Hi
Not sure if this post belongs in this group but as a newbie to the Apache/mod_perl/Perl/DBI/DBD-Oracle stack I'm not sure where to go first so apologies if this is not the forum for this.  Please see bug report below...

-------------8<---------- Start Bug Report ------------8<----------
1. Problem Description:

  Using Apache 2.2.3 and mod_perl 2.0.3 with DBI-1.53 and DBD-oracle-1.19
  Running on RedHat Linux
  Connecting to Oracle 9i on same box

  Testing web page and Perl script, intermittent seg faults captured in error_log:

[Thu Jan 04 09:39:38 2007] [notice] child pid 13482 exit signal Segmentation fault (11),  possible coredump in /home/finload/www/httpd

  Web page has fields for Oracle id and password then connects, problem occurs every
  now and then when put incorrect id and/or password in - my Perl script is coded
  to handle this and normally writes out DBI::errstr (in this case ORA-01017...).  
  This doesn't always work however, sometimes get "page cannot be displayed" and 
  seg fault as above.  This can be after 3 attempts, 28 attempts, 62 attempts etc, etc
  no pattern as to when it may happen.  Also get the seg fault on occasion when Oracle id and password
  are correct and there's no reason for it not to connect.

  Perl snippet as follows:
***
use strict;

use DBI;

use Apache2::RequestRec();
use Apache2::RequestIO();

use Apache2::Const -compile => qw(OK SERVER_ERROR);

  my $r = shift;

  my $usrname;
  my $password;
  my $database;
  my $breason;
  my $bperson;
  my $strsql;

  my $errmsg;

  my $dbistr='dbi:Oracle:';  #default current env Oracle SID
  my $usrpwd='/';      

  my $retval;  #return val for stored func

  $r->content_type('text/html');

# read params from POST request
  my $buffer;
  my $data;
  while($r->read($buffer,1000))
  {
    $data .= $buffer;
  }

# parse post data and assign out values
  my (@pairs) = split(/[&;]/, $data);
  foreach my $pair(@pairs)
  {
    $pair =~ s/%0D%0A/ /g;
    $pair =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C",hex($1))/eg;
    $pair =~ tr/\n/ /;
    $pair =~ s/\(\+\)/\(AJS\)/g;
    $pair =~ s/\+/ /g;
    $pair =~ s/\(AJS\)/\(\+\)/g;

    my($parameter, $value)=split('=',$pair,2);

    if($parameter eq 'username')
    {
      $usrname=$value;
    }
    elsif($parameter eq 'password')
    {
      $password=$value;
    }
    elsif($parameter eq 'database')
    {
      $database=$value;
    }
    elsif($parameter eq 'breason')
    {
      $breason=$value;
    }
    elsif($parameter eq 'bperson')
    {
      $bperson=$value;
    }
    elsif($parameter eq 'thesql')
    {
      $strsql=$value;
    }
  }

  #check for existence of all required values
  if($usrname eq undef || $password eq undef ||
     $database eq undef || $breason eq undef ||
     $bperson eq undef || $strsql eq undef)
  {
    $r->print("One or more required parameters were missing\n");
    return Apache2::Const::SERVER_ERROR;
  }

  $dbistr .= $database;
  $usrpwd = $usrname . "/" . $password;

  my $dbh=DBI->connect($dbistr,$usrpwd);

  if($dbh==undef)
  {
    $errmsg=$DBI::errstr;
    $r->print("DBI Connect failed: \n$errmsg");
    return Apache2::Const::SERVER_ERROR;
  }
  # ... and so on...
***


2. Used Components and their Configuration:

*** mod_perl version 2.000003

*** using /home/finload/www/perl/lib/site_perl/5.8.8/i686-linux/Apache2/BuildConfig.pm

*** Makefile.PL options:
  MP_APR_LIB      => aprext
  MP_AP_CONFIGURE => --with-mpm=prefork --prefix=/home/finload/www/httpd --with- apr=/home/finload/www/httpd --with-apr-util=/home/finload/www/httpd --enable-maintainer- mode
  MP_AP_PREFIX    => /home/finload/www/src/httpd-2.2.3
  MP_COMPAT_1X    => 1
  MP_GENERATE_XS  => 1
  MP_LIBNAME      => mod_perl
  MP_USE_STATIC   => 1


*** The httpd binary was not found


*** (apr|apu)-config linking info


 -L/home/finload/www/httpd/lib -laprutil-1 -lexpat -L/home/finload/www/httpd/lib

 -L/home/finload/www/httpd/lib -lapr-1 -lrt -lcrypt  -lpthread -ldl 



*** /home/finload/www/perl/bin/perl -V
Summary of my perl5 (revision 5 version 8 subversion 8) configuration:
  Platform:
    osname=linux, osvers=2.4.21-32.0.1.elsmp, archname=i686-linux
    uname='linux elonxapfinmanp1 2.4.21-32.0.1.elsmp #1 smp tue may 17 17:52:23 edt 2005  i686 athlon i386 gnulinux '
    config_args='-Dprefix=/home/finload/www/perl -Doptimize=g'
    hint=previous, useposix=true, d_sigaction=define
    usethreads=undef use5005threads=undef useithreads=undef usemultiplicity=undef
    useperlio=define d_sfio=undef uselargefiles=define usesocks=undef
    use64bitint=undef use64bitall=undef uselongdouble=undef
    usemymalloc=n, bincompat5005=undef
  Compiler:
    cc='gcc', ccflags ='-fno-strict-aliasing -pipe -Wdeclaration-after-statement - I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64',
    optimize='-g',
    cppflags='-fno-strict-aliasing -pipe -Wdeclaration-after-statement - I/usr/local/include -fno-strict-aliasing -pipe -Wdeclaration-after-statement - I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64'
    ccversion='', gccversion='3.2.3 20030502 (Red Hat Linux 3.2.3-52)', gccosandvers=''
    intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234
    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12
    ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8
    alignbytes=4, prototype=define
  Linker and Libraries:
    ld='gcc', ldflags =' -L/usr/local/lib'
    libpth=/usr/local/lib /lib /usr/lib
    libs=-lnsl -ldl -lm -lcrypt -lutil -lc
    perllibs=-lnsl -ldl -lm -lcrypt -lutil -lc
    libc=/lib/libc-2.3.2.so, so=so, useshrplib=false, libperl=libperl.a
    gnulibc_version='2.3.2'
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E'
    cccdlflags='-fpic', lddlflags='-shared -L/usr/local/lib'


Characteristics of this binary (from libperl): 
  Compile-time options: PERL_MALLOC_WRAP USE_LARGE_FILES USE_PERLIO
  Built under linux
  Compiled at Jan  4 2007 09:01:45
  %ENV:
    PERL_LWP_USE_HTTP_10="1"
  @INC:
    /home/finload/www/perl/lib/5.8.8/i686-linux
    /home/finload/www/perl/lib/5.8.8
    /home/finload/www/perl/lib/site_perl/5.8.8/i686-linux
    /home/finload/www/perl/lib/site_perl/5.8.8
    /home/finload/www/perl/lib/site_perl
    .

*** Packages of interest status:

Apache2            : -
Apache2::Request   : -
CGI                : 3.15
ExtUtils::MakeMaker: 6.30
LWP                : 5.805
mod_perl           : -
mod_perl2          : 2.000003


3. This is the core dump trace: (if you get a core dump):

  Core was generated by `/home -k start'.
Program terminated with signal 11, Segmentation fault.
#0  0x002f201e in free () from /lib/tls/libc.so.6
(gdb) bt full
#0  0x002f201e in free () from /lib/tls/libc.so.6
No symbol table info available.
#1  0x0121d0a5 in nnfldlc () from /finman- ds1/ora01/app/oracle/product/9.2.0/lib/libclntsh.so.9.0
No symbol table info available.
#2  0x0121cad7 in nnflrlc () from /finman- ds1/ora01/app/oracle/product/9.2.0/lib/libclntsh.so.9.0
No symbol table info available.
#3  0x0121f485 in nnflqbf () from /finman- ds1/ora01/app/oracle/product/9.2.0/lib/libclntsh.so.9.0
No symbol table info available.
#4  0x0121fdee in nnflrne () from /finman- ds1/ora01/app/oracle/product/9.2.0/lib/libclntsh.so.9.0
No symbol table info available.
#5  0x012cb057 in nnfgrne () from /finman- ds1/ora01/app/oracle/product/9.2.0/lib/libclntsh.so.9.0
No symbol table info available.
#6  0x01356cfb in nlolgobj () from /finman- ds1/ora01/app/oracle/product/9.2.0/lib/libclntsh.so.9.0
No symbol table info available.
#7  0x012c85e3 in nnfun2a () from /finman- ds1/ora01/app/oracle/product/9.2.0/lib/libclntsh.so.9.0
No symbol table info available.
#8  0x012c8110 in nnfsn2a () from /finman- ds1/ora01/app/oracle/product/9.2.0/lib/libclntsh.so.9.0
No symbol table info available.
#9  0x01270dc3 in niqname () from /finman- ds1/ora01/app/oracle/product/9.2.0/lib/libclntsh.so.9.0
No symbol table info available.
#10 0x011df535 in kwfnran () from /finman- ds1/ora01/app/oracle/product/9.2.0/lib/libclntsh.so.9.0
No symbol table info available.
#11 0x011b2301 in kwfcinit () from /finman- ds1/ora01/app/oracle/product/9.2.0/lib/libclntsh.so.9.0
No symbol table info available.
#12 0x0105ed96 in kpuatch () from /finman- ds1/ora01/app/oracle/product/9.2.0/lib/libclntsh.so.9.0
No symbol table info available.
#13 0x010ef2cb in OCIServerAttach () from /finman- ds1/ora01/app/oracle/product/9.2.0/lib/libclntsh.so.9.0
No symbol table info available.
#14 0x00db3a92 in ora_db_login6 (dbh=0x93daa70, imp_dbh=0x920ffe8, dbname=0x9332cc8  "finman",
    uid=0x930f510 "fs_snookadr2003/jg34h8v35g", pwd=0xdc5df0 "", attr=0x9213ae4) at  dbdimp.c:645
        status = 0
        svp = (SV **) 0x0
        shared_dbh_ssv = (shared_sv *) 0x0
        shared_dbh = (imp_dbh_t *) 0x0
        this_ctx = (struct OCIExtProcContext *) 0x920ffe8
        use_proc_connection = 0
        use_proc_connection_sv = (SV **) 0x0
        imp_drh = (imp_drh_t *) 0x9320680
#15 0x00dac626 in XS_DBD__Oracle__db__login (cv=0x93fcc88) at Oracle.xsi:92
        lna = 26
        imp_dbh = (imp_dbh_t *) 0x920ffe8
        u = 0x930f510 "fs_snookadr2003/jg34h8v35g"
        p = 0xdc5df0 ""
        username = (SV *) 0x9213b20
        attribs = (SV *) 0x9213ae4
        dbh = (SV *) 0x93daa70
        dbname = 0x9332cc8 "finman"
        password = (SV *) 0x9213af0
        sp = (SV **) 0x3b3150
        ax = 1
        mark = (SV **) 0x4
        items = 5
#16 0x081344f9 in Perl_pp_entersub () at pp_hot.c:2877
        markix = 0
        sp = (SV **) 0x931e46c
        sv = (SV *) 0x93dab24
        gv = (GV *) 0xbfff7e18
---Type <return> to continue, or q <return> to quit---
        stash = (HV *) 0x8
        cv = (CV *) 0x93fcc88
        cx = (PERL_CONTEXT *) 0x931e46c
        gimme = 0
        hasargs = 1 '\001'
#17 0x0812bb4d in Perl_runops_standard () at run.c:37
No locals.
#18 0x080cfb8d in S_call_body (myop=0xbfff7f70, is_eval=0 '\0') at perl.c:2731
No locals.
#19 0x080cf64a in Perl_call_sv (sv=0x9213b74, flags=0) at perl.c:2607
        sp = (SV **) 0x931e46c
        myop = {op_next = 0x0, op_sibling = 0x0, op_ppaddr = 0, op_targ = 0, op_type = 0,  op_seq = 0,
  op_flags = 66 'B', op_private = 0 '\0', op_first = 0x0, op_other = 0x0}
        method_op = {op_next = 0x933eae8, op_sibling = 0x9213b74, op_ppaddr = 0x93376e4,  op_targ = 154678452,
  op_type = 44052, op_seq = 2365, op_flags = 20 '\024', op_private = 182 '¶', op_first =  0xbfff7fa8}
        oldmark = 0
        retval = 0
        oldscope = 14
        oldcatch = 0 '\0'
        ret = 155036692
        oldop = (OP *) 0x934e830
        cur_env = {je_prev = 0x0, je_buf = {{__jmpbuf = {12, 0, 1439010065, 3231704,  154365928, 12},
      __mask_was_saved = 154367708, __saved_mask = {__val = {12, 154365920, 3221192456,  0, 3683196,
          154995992, 12, 154367708, 154976512, 11211688, 3221192456, 135420624,  154270592, 0, 154996872, 7,
          0, 12, 0, 14162415, 154713064, 154367716, 12, 0, 7, 154367708, 3221192552,  135085529, 154270592,
          154996872, 7, 1}}}}, je_ret = 154076716, je_mustcatch = -20 'ì'}
#20 0x00aa3757 in XS_DBI_dispatch (cv=0x93cdba8) at DBI.xs:3000
        sp = (SV **) 0x931e46c
        ax = 1
        mark = (SV **) 0x931e458
        items = 5
        h = (SV *) 0x933b4b8
        st1 = (SV *) 0x9344608
        st2 = (SV *) 0x9344620
        orig_h = (SV *) 0x9344bd8
        err_sv = (SV *) 0x92909d8
        hook_svp = (SV **) 0x0
        mg = (MAGIC *) 0x933e398
        lna = 3221193608
        gimme = 0
        trace_flags = 0
        trace_level = 0
        is_DESTROY = 0
        is_FETCH = 0
        is_unrelated_to_Statement = 1
        keep_error = 0
        ErrCount = 4294967295
        i = 0
        outitems = 154983312
        call_depth = 1
        profile_t1 = 0
        meth_name = 0x93d1088 "connect"
        ima = (const dbi_ima_t *) 0x93d0fb0
        ima_flags = 1
        imp_xxh = (imp_xxh_t *) 0x9320680
        imp_msv = (SV *) 0x93dac14
        qsv = (SV *) 0x0
---Type <return> to continue, or q <return> to quit---
#21 0x081344f9 in Perl_pp_entersub () at pp_hot.c:2877
        markix = 0
        sp = (SV **) 0x931e46c
        sv = (SV *) 0x93cdba8
        gv = (GV *) 0x931e470
        stash = (HV *) 0x8
        cv = (CV *) 0x93cdba8
        cx = (PERL_CONTEXT *) 0x933bf44
        gimme = 0
        hasargs = 1 '\001'
#22 0x0812bb4d in Perl_runops_standard () at run.c:37
No locals.
#23 0x080cfb8d in S_call_body (myop=0xbfff8510, is_eval=0 '\0') at perl.c:2731
No locals.
#24 0x080cf8db in Perl_call_sv (sv=0x923a738, flags=4) at perl.c:2646
        sp = (SV **) 0x931e460
        myop = {op_next = 0x0, op_sibling = 0x0, op_ppaddr = 0, op_targ = 0, op_type = 0,  op_seq = 0,
  op_flags = 66 'B', op_private = 0 '\0', op_first = 0x0, op_other = 0xbfff8510}
        method_op = {op_next = 0x9220780, op_sibling = 0x923f630, op_ppaddr = 0xbfff8528,
  op_targ = 134879562, op_type = 42580, op_seq = 2339, op_flags = 184 '¸', op_private =  253 'ý',
  op_first = 0x7}
        oldmark = 0
        retval = 0
        oldscope = 3
        oldcatch = 1 '\001'
        ret = 0
        oldop = (OP *) 0x0
        cur_env = {je_prev = 0x81e1fa0, je_buf = {{__jmpbuf = {152523260, 1, 156244936,  -1073773240,
        -1073773600, 135067745}, __mask_was_saved = 0, __saved_mask = {__val =  {153434480, 3, 24, 3891584,
          3889304, 3891584, 1, 3221193848, 3088077, 3891584, 20, 152523260, 1, 156244936,  3221193896,
          135372172, 20, 153355312, 1, 135422672, 153431376, 153262692, 3221193928, 20,  153434488, 153434488,
          3221193928, 135492280, 20, 0, 1, 134863980}}}}, je_ret = 0, je_mustcatch = 1  '\001'}
#25 0x0809b27f in modperl_callback (handler=0x9270790, p=0x9501b90, r=0x9501bc8,  s=0x916b2c8, args=0x922a830)
    at modperl_callback.c:101
        cv = (CV *) 0x923a738
        flags = 4
        sp = (SV **) 0x931e460
        count = 135511475
        status = 0
#26 0x0809b786 in modperl_callback_run_handlers (idx=6, type=4, r=0x9501bc8, c=0x0,  s=0x916b2c8, pconf=0x0,
    plog=0x0, ptemp=0x0, run_mode=MP_HOOK_RUN_FIRST) at modperl_callback.c:262
        scfg = (modperl_config_srv_t *) 0x916c518
        dcfg = (modperl_config_dir_t *) 0x95034f8
        rcfg = (modperl_config_req_t *) 0x9502910
        handlers = (modperl_handler_t **) 0x92707c8
        p = (apr_pool_t *) 0x9501b90
        av = (MpAV *) 0x92707b0
        avp = (MpAV **) 0x9503518
        i = 0
        status = 0
        desc = 0x81b5e24 "PerlResponseHandler"
        av_args = (AV *) 0x922a830
#27 0x0809b9eb in modperl_callback_per_dir (idx=6, r=0x9501bc8,  run_mode=MP_HOOK_RUN_FIRST)
    at modperl_callback.c:369
No locals.
#28 0x0809820c in modperl_response_handler_run (r=0x9501bc8, finish=0) at mod_perl.c:995
        retval = 153190128
---Type <return> to continue, or q <return> to quit---
#29 0x08098448 in modperl_response_handler_cgi (r=0x9501bc8) at mod_perl.c:1090
        dcfg = (modperl_config_dir_t *) 0x95034f8
        h_stdin = (GV *) 0x926ced0
        h_stdout = (GV *) 0x9405c04
        retval = 156251384
        rc = 153605408
        rcfg = (modperl_config_req_t *) 0x9502910
#30 0x0808f056 in ap_run_handler (r=0x9501bc8) at config.c:158
        pHook = (ap_LINK_handler_t *) 0xb7200000
        n = 1
        rv = -1222639616
#31 0x0808f56e in ap_invoke_handler (r=0x9501bc8) at config.c:371
        new_handler = 0x4 <Address 0x4 out of bounds>
        p2 = 0xb7200000 <Address 0xb7200000 out of bounds>
        handler = 0x0
        p = 0xb7200000 <Address 0xb7200000 out of bounds>
        result = 156244936
        old_handler = 0x92702c0 "perl-script"
#32 0x080b9917 in ap_process_request (r=0x9501bc8) at http_request.c:258
        access_status = 4
#33 0x080b7a29 in ap_process_http_connection (c=0x927d0c8) at http_core.c:184
        r = (request_rec *) 0x9501bc8
        csd = (apr_socket_t *) 0x0
#34 0x0809467a in ap_run_process_connection (c=0x927d0c8) at connection.c:43
        pHook = (ap_LINK_process_connection_t *) 0xb7200000
        n = 1
        rv = -1222639616
#35 0x080c9dfa in child_main (child_num_arg=-1222639616) at prefork.c:640
        current_conn = (conn_rec *) 0x927d0c8
        csd = (void *) 0x927cf30
        ptrans = (apr_pool_t *) 0x927cef8
        allocator = (apr_allocator_t *) 0x9239858
        status = 0
        i = -1
        lr = (ap_listen_rec *) 0x927d0c8
        pollset = (apr_pollset_t *) 0x9249720
        sbh = (ap_sb_handle_t *) 0x9249718
        bucket_alloc = (apr_bucket_alloc_t *) 0x927ef00
        last_poll_idx = 0
#36 0x080c9f63 in make_child (s=0x916b2c8, slot=0) at prefork.c:736
        pid = 0
#37 0x080c9fff in startup_children (number_to_start=5) at prefork.c:754
        i = 0
#38 0x080ca92f in ap_mpm_run (_pconf=0x91650a8, plog=0x91a51a8, s=0x916b2c8) at  prefork.c:975
        index = 152482504
        remaining_children_to_start = 5
        rv = -1222639616
#39 0x0807f83c in main (argc=3, argv=0xbfff8984) at main.c:717
        exit_status = 0
        c = 0 '\0'
        configtestonly = 0
        confname = 0x81ac712 "conf/httpd.conf"
        def_server_root = 0x81ac722 "/home/finload/www/httpd"
        temp_error_log = 0x0
        error = 0xb7200000 <Address 0xb7200000 out of bounds>
        process = (process_rec *) 0x9163120
        server_conf = (server_rec *) 0x916b2c8
---Type <return> to continue, or q <return> to quit---
        pglobal = (apr_pool_t *) 0x91630a0
        pconf = (apr_pool_t *) 0x91650a8
        plog = (apr_pool_t *) 0x91a51a8
        ptemp = (apr_pool_t *) 0x916d0c8
        pcommands = (apr_pool_t *) 0x91670b0
        opt = (apr_getopt_t *) 0x9167148
        rv = -1073772332
        mod = (module **) 0xbfff88d4
        optarg = 0x2ab7c3 "\201ÃÕ \020"
        signal_server = (apr_OFN_ap_signal_server_t *) 0x4
(gdb)


This report was generated by /home/finload/www/perl/bin/mp2bug on Thu Jan  4 10:12:29  2007 GMT.

-------------8<---------- End Bug Report --------------8<----------
--------------------------------------------------------

If you are not an intended recipient of this e-mail, please notify the sender, delete it and do not read, act upon, print, disclose, copy, retain or redistribute it. Click here for important additional terms relating to this e-mail.     http://www.ml.com/email_terms/
--------------------------------------------------------

Re: Bug Report

Posted by Robert Landrum <rl...@aol.net>.
Snook, Adrian (London) wrote:
> 3. This is the core dump trace: (if you get a core dump):
> 
>   Core was generated by `/home -k start'.
> Program terminated with signal 11, Segmentation fault.
> #0  0x002f201e in free () from /lib/tls/libc.so.6
> (gdb) bt full
> #0  0x002f201e in free () from /lib/tls/libc.so.6
> No symbol table info available.
> #1  0x0121d0a5 in nnfldlc () from /finman- 
> ds1/ora01/app/oracle/product/9.2.0/lib/libclntsh.so.9.0
> No symbol table info available.
> #2  0x0121cad7 in nnflrlc () from /finman- 
> ds1/ora01/app/oracle/product/9.2.0/lib/libclntsh.so.9.0
> No symbol table info available.

Hmm...  Interesting.  Everything looks good right up until this point, 
which I believe is attempting to resolve names.  Oracle naming 
conventions suck.

Just a shot in the dark...  Try changing tnsnames.ora to connect to the 
IP address rather than the hostname, if that's what you're using.

You should also be able to test this without apache.  Just run a script 
with something like

$|=1;
while(1) {
   $dbh = DBI->connect();
   $dbh->disconnect;
   print "Connected\n";
}

Rob