We would like to report the following unexpected behavior:

Using Perl 5.10 compiled for threading, DBI 1.607, DBD::Oracle 1.22
and Moose 0.72, we have the following code executing:

my $sql = $self->config()->value_of('master_poll_stage_sql');
my $sth = $self->poll_conn()->prepare_cached($sql,
                                             {
                                              _dbi_cache_id_info =>
__FILE__.__LINE__
                                             },
                                             1 ## Suppress caching info message
                                            );
my $rsl = $self->poll_conn()->selectall_arrayref($sth,{Slice=>{}});

$self is a Moose object.

$self->poll_conn() holds the previously connected $dbh.

$self->config()->value_of('master_poll_stage_sql') holds the sql, which is

Select  TRAN_STAGE_ID, SECURITY_MASTER_ID, PORTFOLIO_CODE,
TRAN_SOURCE, REC_FUNCTION, TS_BROKER, TS_SEC_TYPE, TS_EXCHANGE,
                case when  tran_source in( 'LZ', 'KX') then 1
                else        0
        end "WEBSVC_CALL"
from lth_tran_stage where UPPER(TRAN_STAGE_STATUS) not in(
'P','M','C','R','E') Order by TRAN_STAGE_ID

Then we prepare and selectall_arrayref, as shown. With this
arrangement, we get intermittent core dumps of the Perl process. The
running time before it dumps ranges from 15 to 45 minutes. The latest
execution frequency of this section of code is once every two minutes.
Changing the frequency from its original rate (10 per second) did not
help the situation.

The core dump we got looks like this:

current thread: t...@1
=>[1] 0x0(0x1743610, 0x1745220, 0x0, 0xc27, 0x0, 0x10), at 0xffffffffffffffff
  [2] ttcdrv(0x1745220, 0x1745604, 0x17436f0, 0x1745688, 0x0, 0x0), at
0xfc4c93e8
  [3] nioqwa(0x17436b4, 0x0, 0xfc4c5e30, 0x1745220, 0x1743638, 0x0),
at 0xfc3b329c
  [4] upirtrc(0x1743610, 0x0, 0x15fa3e0, 0x0, 0x0, 0x1745e60), at 0xfc14ede8
  [5] kpurcsc(0x15f06c4, 0x4e, 0x1745154, 0x1745220, 0x1745e60,
0xfc4ca1a8), at 0xfc1e66b4
  [6] kpuexecv8(0x0, 0x1745154, 0xffbecc62, 0xfc9a8788, 0x1743610,
0xffbecc62), at 0xfc196810
  [7] kpuexec(0xfc931618, 0x17040a8, 0x172c5d8, 0x0, 0x0, 0x0), at 0xfc19946c
  [8] OCIStmtExecute(0x15f06c4, 0x174c6e8, 0x172c5d8, 0x0, 0x0, 0x0),
at 0xfc155b88
  [9] ora_st_execute(0x16b4500, 0x1683e70, 0xfd7cfa54, 0x0, 0x5,
0xfd7cc04c), at 0xfd79ade0
  [10] XS_DBD__Oracle__st_execute(0x1709d8, 0x1106168, 0x110616c,
0x1683e70, 0x1, 0xfd7cc04c), at 0xfd787c78
  [11] XS_DBI_dispatch(0x1709d8, 0x1683e70, 0xc, 0x15575e0, 0x170a1c,
0x1), at 0xfe66141c
  [12] Perl_pp_entersub(0x1709d8, 0x800, 0x3, 0x61ee3c, 0x2a8574,
0xdd2e18), at 0x86634
  [13] Perl_runops_standard(0x1709d8, 0x0, 0x0, 0x85a00, 0x86d94,
0xd9a990), at 0x7ca48
  [14] Perl_call_sv(0xffbed348, 0xffbeda08, 0xffbed380, 0x1709d8,
0x7ca08, 0x1709d8), at 0x78338
  [15] dbixst_bounce_method(0xfd7ccf0c, 0x3, 0x3, 0x2, 0x1106228,
0x1709d8), at 0xfd784bc8
  [16] XS_DBD__Oracle__db_selectall_arrayref(0x1709d8, 0x0, 0x110616c,
0xec0, 0xfd7cc04c, 0x4), at 0xfd7857a4
  [17] XS_DBI_dispatch(0x1709d8, 0x175dae8, 0x0, 0x1557450, 0x170a1c,
0x3), at 0xfe66141c
  [18] Perl_pp_entersub(0x1709d8, 0x800, 0x0, 0xd9f9bc, 0x2a8570,
0xdd00d8), at 0x86634
  [19] Perl_runops_standard(0x1709d8, 0x1709d8, 0x0, 0x85a00, 0x820f8,
0x1262898), at 0x7ca48
  [20] S_run_body(0x1709d8, 0x19ae68, 0x18a958, 0x1, 0x175838, 0x0), at 0x77c74
  [21] perl_run(0x1709d8, 0x53, 0xffbeda08, 0x170bbc, 0x1, 0x0), at 0x7799c
  [22] main(0x16e400, 0xffbedb2c, 0xffbedb38, 0x5dc00, 0x5dc00,
0x16e400), at 0x27268

The first thing we tried was to get rid of the prepare cached call. It
is not a call we use that often here and the cost of re-parsing the
SQL at the server vs. the execution time is not really that critical -
this is not a trading system.

The resulting code is this:

my $sql = $self->config()->value_of('master_poll_stage_sql');
my $sth = $self->poll_conn()->prepare($sql);
my $rsl = $self->poll_conn()->selectall_arrayref($sth,{Slice=>{}});
$sth->finish();

As of this writing, the code has not dumped in the past 14 days.

Does anyone have any insight? We do not have a test environment robust
enough to try and reproduce this and add a DBI trace - probably should
have done that in the production environment where it was failing -
sorry.

Details:

[1509] $ perl -V
Summary of my perl5 (revision 5 version 10 subversion 0) configuration:
  Platform:
    osname=solaris, osvers=2.8, archname=sun4-solaris-thread-multi
    uname='sunos nylux-perl-sol8 5.8 generic_virtual sun4u sparc
sunw,ultra-enterprise '
    config_args='-de -Dusethreads -Dcc=cc -Dprefix=/opt/perl.v5.10.0
-Dhtml1dir=/opt/perl.v5.10.0/html/html1
-Dhtml3dir=/opt/perl.v5.10.0/html/html3 -Dinstallusrbinperl=undef
[email protected]
[email protected]'
    hint=recommended, useposix=true, d_sigaction=define
    useithreads=define, usemultiplicity=define
    useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef
    use64bitint=undef, use64bitall=undef, uselongdouble=undef
    usemymalloc=n, bincompat5005=undef
  Compiler:
    cc='cc', ccflags ='-D_REENTRANT -I/usr/local/include
-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64',
    optimize='-O',
    cppflags='-D_REENTRANT -I/usr/local/include'
    ccversion='Sun C 5.8 2005/10/13', gccversion='', gccosandvers=''
    intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=4321
    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16
    ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t',
lseeksize=8
    alignbytes=8, prototype=define
  Linker and Libraries:
    ld='cc', ldflags =' -L/usr/lib -L/usr/ccs/lib
-L/opt/SUNWspro/prod/lib/v8plus -L/opt/SUNWspro/prod/lib -L/lib
-L/usr/local/lib '
    libpth=/usr/lib /usr/ccs/lib /opt/SUNWspro/prod/lib/v8plus
/opt/SUNWspro/prod/lib /lib /usr/local/lib
    libs=-lsocket -lnsl -ldl -lm -lpthread -lc
    perllibs=-lsocket -lnsl -ldl -lm -lpthread -lc
    libc=/lib/libc.so, so=so, useshrplib=false, libperl=libperl.a
    gnulibc_version=''
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags=' '
    cccdlflags='-KPIC', lddlflags='-G -L/usr/lib -L/usr/ccs/lib
-L/opt/SUNWspro/prod/lib/v8plus -L/opt/SUNWspro/prod/lib -L/lib
-L/usr/local/lib'
Characteristics of this binary (from libperl):
  Compile-time options: MULTIPLICITY PERL_DONT_CREATE_GVSV
                        PERL_IMPLICIT_CONTEXT PERL_MALLOC_WRAP USE_ITHREADS
                        USE_LARGE_FILES USE_PERLIO USE_REENTRANT_API
  Built under solaris
  Compiled at Feb 28 2009 01:19:43
  %ENV:
    
PERL5LIB="/am/common/lib/5.10.0:/am/common/lib/site_perl/5.10.0:/sa/common/lib/5.10.0:/sa/common/lib/site_perl/5.10.0"
  @INC:
    /am/common/lib/5.10.0/sun4-solaris-thread-multi
    /am/common/lib/5.10.0
    /am/common/lib/site_perl/5.10.0/sun4-solaris-thread-multi
    /am/common/lib/site_perl/5.10.0
    /sa/common/lib/5.10.0/sun4-solaris-thread-multi
    /sa/common/lib/5.10.0
    /sa/common/lib/site_perl/5.10.0/sun4-solaris-thread-multi
    /sa/common/lib/site_perl/5.10.0
    /opt/perl.v5.10.0/lib/5.10.0/sun4-solaris-thread-multi
    /opt/perl.v5.10.0/lib/5.10.0
    /opt/perl.v5.10.0/lib/site_perl/5.10.0/sun4-solaris-thread-multi
    /opt/perl.v5.10.0/lib/site_perl/5.10.0

-- 
Matthew O. Persico

Reply via email to