perl5-dbi / DBD-Oracle

Oracle database driver for the DBI module
http://search.cpan.org/dist/DBD-Oracle
18 stars 25 forks source link

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

Open CarstenGrohmann opened 7 years ago

CarstenGrohmann commented 7 years ago

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

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
djzort commented 4 years ago

Can you confirm if this is still happening?

CarstenGrohmann commented 4 years ago

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
djzort commented 4 years ago

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' ); 
twata1 commented 2 years ago

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

djzort commented 2 years ago

Please try this again on v1.90_3

twata1 commented 2 years ago

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.