DBD-Oracle icon indicating copy to clipboard operation
DBD-Oracle copied to clipboard

Issue on t/25plsql.t at line 179: 'expected return length'

Open CarstenGrohmann opened this issue 8 years ago • 6 comments

Hi,

a test in t/25plsql.t:179 is failing. Probably a declared buffer is too small to increase it.

#   Failed test 'expected return length'
#   at t/25plsql.t line 179.
#          got: '5'
#     expected: '200'

Detailed Error message

$ make test
PERL_DL_NONLAZY=1 /usr/bin/perl "-MExtUtils::Command::MM" "-e" "test_harness(0, 'blib/lib', 'blib/arch')" t/*.t
t/000-report-versions-tiny.t .. #
#
# Generated by Dist::Zilla::Plugin::ReportVersions::Tiny v1.10
# perl: 5.016003 (wanted 5.006) on linux from /usr/bin/perl
#
# B                                             => 1.35       (want any version)
# Carp                                          => 1.26       (want any version)
# DBI                                           => 1.627      (want 1.51)
# Data::Dumper                                  => 2.145      (want any version)
# Devel::Peek                                   => 1.08       (want any version)
# DynaLoader                                    => 1.14       (want any version)
# Encode                                        => 2.51       (want any version)
# Exporter                                      => 5.68       (want any version)
# ExtUtils::MakeMaker                           => 6.68       (want any version)
# Math::BigInt                                  => 1.998      (want any version)
# Test::More                                    => 0.98       (want 0.88)
# Thread::Semaphore                             => 2.12       (want any version)
# lib                                           => 0.63       (want any version)
# strict                                        => 1.07       (want any version)
# utf8                                          => 1.09       (want any version)
# vars                                          => 1.02       (want any version)
# warnings                                      => 1.13       (want any version)
#
# Thanks for using my code.  I hope it works for you.
# If not, please try and include this output in the bug report.
# That will help me reproduce the issue and solve your problem.
#
t/000-report-versions-tiny.t .. ok
t/00versions.t ................ # OCI client library version: 12.1.0
t/00versions.t ................ 1/2 # database version: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
t/00versions.t ................ ok
t/01base.t .................... ok
t/10general.t ................. ok
t/12impdata.t ................. ok
[...]
t/25plsql.t ................... 1/82     DBI::st=HASH(0x1052980) trace level set to 0x0/3 (DBI @ 0x0/0) in DBI 1.627-ithread (pid 20995)
    -> bind_param_inout for DBD::Oracle::st (DBI::st=HASH(0x1056f80)~0x1052980 ':arg' SCALAR(0xc912e0) 20) thr#a5f010
dbd_bind_ph(1): bind :arg <== undef (type 0 (DEFAULT (varchar)), inout 0xc912e0, maxlen 20)
dbd_rebind_ph_char() (1): bind :arg <== undef (NULL, size 5/0/20, ptype 6(VARCHAR), otype 1 , inout)
dbd_rebind_ph_char() (2): bind :arg <== undef (size 0/32, otype 1(VARCHAR), indp -1, at_exec 1)
          bind :arg as ftype 1 (VARCHAR)
dbd_rebind_ph(): bind :arg <== undef (inout, not-utf8, csid 1->0->1, ftype 1 (VARCHAR), csform 0(0)->0(0), maxlen 32, maxdata_size 0)
    <- bind_param_inout= ( 1 ) [1 items] at 25plsql.t line 169
    -> execute for DBD::Oracle::st (DBI::st=HASH(0x1056f80)~0x1052980) thr#a5f010
   dbd_st_execute BEGIN (out1, lob0)...
          with :arg = '' (len 0(0)/32, indp -1, otype 1, ptype 6)
Statement Execute Mode is 32 (COMMIT_ON_SUCCESS)
    !! ERROR: 6502 'ORA-06502: PL/SQL: numeric or value error: character string buffer too small
ORA-06512: at line 3 (DBD ERROR: OCIStmtExecute)' (err#1)
    <- execute= ( undef ) [1 items] at 25plsql.t line 173
       ERROR: 6502 'ORA-06502: PL/SQL: numeric or value error: character string buffer too small
ORA-06512: at line 3 (DBD ERROR: OCIStmtExecute)' (err#1)
1   <- FETCH= ( HASH(0x1053670)1keys ) [1 items] at 25plsql.t line 173
    !! ERROR: 6502 CLEARED by call to bind_param_inout method
    -> bind_param_inout for DBD::Oracle::st (DBI::st=HASH(0x1056f80)~0x1052980 ':arg' SCALAR(0xc912e0) 200) thr#a5f010
dbd_bind_ph(1): bind :arg <== undef (type 0 (DEFAULT (varchar)), inout 0xc912e0, maxlen 200)
dbd_rebind_ph_char() (1): bind :arg <== undef (NULL, size 5/32/200, ptype 6(VARCHAR), otype 1 , inout)
dbd_rebind_ph_char() (2): bind :arg <== undef (size 0/200, otype 1(VARCHAR), indp -1, at_exec 1)
          bind :arg as ftype 1 (VARCHAR)
dbd_rebind_ph(): bind :arg <== undef (inout, not-utf8, csid 1->0->1, ftype 1 (VARCHAR), csform 0(0)->0(0), maxlen 200, maxdata_size 0)
    <- bind_param_inout= ( 1 ) [1 items] at 25plsql.t line 177
    -> execute for DBD::Oracle::st (DBI::st=HASH(0x1056f80)~0x1052980) thr#a5f010
   dbd_st_execute BEGIN (out1, lob0)...
          with :arg = '' (len 0(0)/200, indp -1, otype 1, ptype 6)
Statement Execute Mode is 32 (COMMIT_ON_SUCCESS)
        dbd_st_execute BEGIN returned (SUCCESS, rpc1, fn34, out1)
dbd_st_execute(): Analyzing inout  a parameter ':arg of type=1  name=VARCHAR'
  out :arg = 'foo  ' (arcode 0, ind 0, len 5) UNTOUCHED?
    <- execute= ( 1 ) [1 items] at 25plsql.t line 178

#   Failed test 'expected return length'
#   at t/25plsql.t line 179.
#          got: '5'
#     expected: '200'
    -> DESTROY for DBD::Oracle::st (DBI::st=HASH(0x1052980)~INNER) thr#a5f010
    <- DESTROY= ( undef ) [1 items] at 25plsql.t line 337 via  at 25plsql.t line 337
# Looks like you failed 1 test of 82.
t/25plsql.t ................... Dubious, test returned 1 (wstat 256, 0x100)
Failed 1/82 subtests

Used Versions

  • DBD::Oracle 1.75_2
  • OCI client library 12.1.0
  • Oracle Server Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
  • RHEL7 64 bit, 3.10.0-229.4.2.el7.x86_64
  • Perl:
# perl -V
Summary of my perl5 (revision 5 version 16 subversion 3) configuration:

  Platform:
    osname=linux, osvers=2.6.32-504.1.3.el6.x86_64, archname=x86_64-linux-thread-multi
    uname='linux x86-020.build.eng.bos.redhat.com 2.6.32-504.1.3.el6.x86_64 #1 smp fri oct 31 11:37:10 edt 2014 x86_64 x86_64 x86_64 gnulinux '
    config_args='-des -Doptimize=-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches   -m64 -mtune=generic -Dccdlflags=-Wl,--enable-new-dtags -Dlddlflags=-shared -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches   -m64 -mtune=generic -Wl,-z,relro  -DDEBUGGING=-g -Dversion=5.16.3 -Dmyhostname=localhost -Dperladmin=root@localhost -Dcc=gcc -Dcf_by=Red Hat, Inc. -Dprefix=/usr -Dvendorprefix=/usr -Dsiteprefix=/usr/local -Dsitelib=/usr/local/share/perl5 -Dsitearch=/usr/local/lib64/perl5 -Dprivlib=/usr/share/perl5 -Dvendorlib=/usr/share/perl5/vendor_perl -Darchlib=/usr/lib64/perl5 -Dvendorarch=/usr/lib64/perl5/vendor_perl -Darchname=x86_64-linux-thread-multi -Dlibpth=/usr/local/lib64 /lib64 /usr/lib64 -Duseshrplib -Dusethreads -Duseithreads -Dusedtrace=/usr/bin/dtrace -Duselargefiles -Dd_semctl_semun -Di_db -Ui_ndbm -Di_gdbm -Di_shadow -Di_syslog -Dman3ext=3pm -Duseperlio -Dinstallusrbinperl=n -Ubincompat5005 -Uversiononly -Dpager=/usr/bin/less -isr -Dd_gethostent_r_proto -Ud_endhostent_r_proto -Ud_sethostent_r_proto -Ud_endprotoent_r_proto -Ud_setprotoent_r_proto -Ud_endservent_r_proto -Ud_setservent_r_proto -Dscriptdir=/usr/bin -Dusesitecustomize'
    hint=recommended, useposix=true, d_sigaction=define
    useithreads=define, usemultiplicity=define
    useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef
    use64bitint=define, use64bitall=define, uselongdouble=undef
    usemymalloc=n, bincompat5005=undef
  Compiler:
    cc='gcc', ccflags ='-D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64',
    optimize='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic',
    cppflags='-D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include'
    ccversion='', gccversion='4.8.3 20140911 (Red Hat 4.8.3-7)', gccosandvers=''
    intsize=4, longsize=8, ptrsize=8, doublesize=8, byteorder=12345678
    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16
    ivtype='long', ivsize=8, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8
    alignbytes=8, prototype=define
  Linker and Libraries:
    ld='gcc', ldflags =' -fstack-protector'
    libpth=/usr/local/lib64 /lib64 /usr/lib64
    libs=-lresolv -lnsl -lgdbm -ldb -ldl -lm -lcrypt -lutil -lpthread -lc -lgdbm_compat
    perllibs=-lresolv -lnsl -ldl -lm -lcrypt -lutil -lpthread -lc
    libc=, so=so, useshrplib=true, libperl=libperl.so
    gnulibc_version='2.17'
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,--enable-new-dtags -Wl,-rpath,/usr/lib64/perl5/CORE'
    cccdlflags='-fPIC', lddlflags='-shared -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -Wl,-z,relro '


Characteristics of this binary (from libperl):
  Compile-time options: HAS_TIMES MULTIPLICITY PERLIO_LAYERS
                        PERL_DONT_CREATE_GVSV PERL_IMPLICIT_CONTEXT
                        PERL_MALLOC_WRAP PERL_PRESERVE_IVUV USE_64_BIT_ALL
                        USE_64_BIT_INT USE_ITHREADS USE_LARGE_FILES
                        USE_LOCALE USE_LOCALE_COLLATE USE_LOCALE_CTYPE
                        USE_LOCALE_NUMERIC USE_PERLIO USE_PERL_ATOF
                        USE_REENTRANT_API USE_SITECUSTOMIZE
  Locally applied patches:
        Fedora Patch1: Removes date check, Fedora/RHEL specific
        Fedora Patch3: support for libdir64
        Fedora Patch4: use libresolv instead of libbind
        Fedora Patch5: USE_MM_LD_RUN_PATH
        Fedora Patch6: Skip hostname tests, due to builders not being network capable
        Fedora Patch7: Dont run one io test due to random builder failures
        Fedora Patch9: Fix find2perl to translate ? glob properly (RT#113054)
        Fedora Patch10: Fix broken atof (RT#109318)
        Fedora Patch13: Clear $@ before "do" I/O error (RT#113730)
        Fedora Patch14: Do not truncate syscall() return value to 32 bits (RT#113980)
        Fedora Patch15: Override the Pod::Simple::parse_file (CPANRT#77530)
        Fedora Patch16: Do not leak with attribute on my variable (RT#114764)
        Fedora Patch17: Allow operator after numeric keyword argument (RT#105924)
        Fedora Patch18: Extend stack in File::Glob::glob, (RT#114984)
        Fedora Patch19: Do not crash when vivifying $|
        Fedora Patch20: Fix misparsing of maketext strings (CVE-2012-6329)
        Fedora Patch21: Add NAME headings to CPAN modules (CPANRT#73396)
        Fedora Patch22: Fix leaking tied hashes (RT#107000) [1]
        Fedora Patch23: Fix leaking tied hashes (RT#107000) [2]
        Fedora Patch24: Fix leaking tied hashes (RT#107000) [3]
        Fedora Patch25: Fix dead lock in PerlIO after fork from thread (RT#106212)
        Fedora Patch26: Make regexp safe in a signal handler (RT#114878)
        Fedora Patch27: Update h2ph(1) documentation (RT#117647)
        Fedora Patch28: Update pod2html(1) documentation (RT#117623)
        Fedora Patch29: Document Math::BigInt::CalcEmu requires Math::BigInt (CPAN RT#85015)
        RHEL Patch30: Use stronger algorithm needed for FIPS in t/op/crypt.t (RT#121591)
        RHEL Patch31: Make *DBM_File desctructors thread-safe (RT#61912)
        RHEL Patch32: Use stronger algorithm needed for FIPS in t/op/taint.t (RT#123338)
  Built under linux
  Compiled at Dec  1 2014 11:16:58
  @INC:
    /usr/local/lib64/perl5
    /usr/local/share/perl5
    /usr/lib64/perl5/vendor_perl
    /usr/share/perl5/vendor_perl
    /usr/lib64/perl5
    /usr/share/perl5
    .

It would be great if you fix this issue.

Thank you, Carsten

CarstenGrohmann avatar Jan 09 '17 14:01 CarstenGrohmann

Can you confirm if this is still happening?

djzort avatar Sep 03 '20 07:09 djzort

The issue is still happening with current master branch and "Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production 0":

t/25plsql.t ............... 1/82
#   Failed test 'expected return length'
#   at t/25plsql.t line 232.
#          got: '5'
#     expected: '200'
t/25plsql.t ............... 59/82 # Looks like you failed 1 test of 82.
t/25plsql.t ............... Dubious, test returned 1 (wstat 256, 0x100)
Failed 1/82 subtests

CarstenGrohmann avatar Sep 07 '20 08:09 CarstenGrohmann

This seems to be the test. Strange that its not happening in Travis with the 12.2 client

 26 # --- test out buffer being too small                                                                         
 25 ok(                                                                                                           
 24     $csr = $dbh->prepare(                                                                                     
 23         q{                                                                                                    
 22     begin                                                                                                     
 21         select rpad('foo',200) into :arg from dual;                                                           
 20     end;}                                                                                                     
 19     ),                                                                                                        
 18     'prepare test output buffer too small'                                                                    
 17 );                                                                                                            
 16                                                                                                               
 15 #$csr->trace(3);                                                                                              
 14 undef $p1;    # force buffer to be freed                                                                      
 13 ok( $csr->bind_param_inout( ':arg', \$p1, 20 ), 'bind arg' );                                                 
 12                                                                                                               
 11 # Execute fails with:                                                                                         
 10 #        ORA-06502: PL/SQL: numeric or value error                                                            
  9 #        ORA-06512: at line 3 (DBD ERROR: OCIStmtExecute)                                                     
  8 $tmp = $csr->execute;                                                                                         
  7                                                                                                               
  6 #$tmp = undef if DBD::Oracle::ORA_OCI()>=8; # because BindByName given huge max len                           
  5 ok( !defined $tmp, 'output buffer too small' );                                                               
  4                                                                                                               
  3 # rebind with more space - and it should work                                                                 
  2 ok( $csr->bind_param_inout( ':arg', \$p1, 200 ), 'rebind arg with more space' );                              
  1 ok( $csr->execute, 'execute rebind with more space' );                                                        
232 is( length($p1), 200, 'expected return length' ); 

djzort avatar Sep 07 '20 22:09 djzort

In the case of Windows, this issue seems to occur in certain versions of Perl, as seen in the CPAN Testers Matrix.

CPAN Testers Matrix of DBD-Oracle 1.83

Example of FAIL http://www.cpantesters.org/cpan/report/7d1d837a-6db9-1014-8a22-c2d51220662c

Example of PASS http://www.cpantesters.org/cpan/report/13639d33-6db9-1014-9a42-02ba1220662c

twata1 avatar Jan 23 '22 12:01 twata1

Please try this again on v1.90_3

djzort avatar Apr 21 '22 04:04 djzort

Regarding Windows, I just finished testing it. It will show up on the CPAN Testers Matrix of DBD-Oracle 1.90_3 eventually, but the situation doesn't seem to have changed.

twata1 avatar Apr 22 '22 21:04 twata1