A bit more information.  I'm wondering if something is broken with my perl
installation.  Here's a sample program I wrote to test out the fetching of
longs from the sessions table:

#!/usr/local/bin/perl -w

use strict;
use DBI;

my $dbh = DBI->connect( 'dbi:Oracle:SSS', 'websec', 'websec',
                        { LongReadLen => 256000,
                          RaiseError => 1 } );

$| = 1;

for( ;; ) {
    my $stmt = $dbh->prepare_cached(qq{ select a_session from sessions for
update});
    $stmt->execute;
    while( my( $x ) = $stmt->fetchrow_array ) {
        print length( $x ), "\n";
    }
    print "\n";
    $stmt->finish;
}

If LongReadLen is set to a value smaller then the smallest LONG in the
sessions table, I get this error:

        Bad hash at ./test line 15.

Erk!  That's an internal perl error.  If LongReadLen is greater than the
longest long, I see no error.  The script runs forever, gladly fetching the
sessions with no errors.

Now, what makes this even more interesting is that when I trace the above
with LongReadLen set to a small value, I don't get the 'Bad hash' error.
Here's the log at trace level 1:

pink:/home/miller/src> ./test
    DBI::db=HASH(0x8261690) trace level set to 1 in DBI 1.35-nothread
1   <- FETCH('CachedKids')= undef at DBI.pm line 1410
1   <- STORE('CachedKids' HASH(0x81cae14))= 1 at DBI.pm line 1411
1   <- prepare(' select a_session from sessions for update' undef)=
DBI::st=HASH(0x826178c) at DBI.pm line 1423
    <- prepare_cached(' select a_session from sessions for update')=
DBI::st=HASH(0x826178c) at test line 15
    <- execute= '0E0' at test line 16
    !! ERROR: 24345 'ORA-24345: A Truncation or null fetch error occurred
(DBD ERROR: ORA-01406 error on field 1 of 1, ora_type 8, LongReadLen too
small and/or LongTruncOk not set)'
    <- fetchrow_array= ( ) [0 items] row1 at test line 17
Bad hash at ./test line 17.
       error: 24345 'ORA-24345: A Truncation or null fetch error occurred
(DBD ERROR: ORA-01406 error on field 1 of 1, ora_type 8, LongReadLen too
small and/or LongTruncOk not set)'
    <- DESTROY= undef
       error: 24345 'ORA-24345: A Truncation or null fetch error occurred
(DBD ERROR: ORA-01406 error on field 1 of 1, ora_type 8, LongReadLen too
small and/or LongTruncOk not set)'
    <- DESTROY= undef

This is *very* strange....

        -klm.

> -----Original Message-----
> From: Ken Miller [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, March 25, 2003 9:56 AM
> To: Dbi-Users
> Subject: Problem with Apache::Session and LongReadLen
>
>
> I've got a strange problem with Apache::Session, and DBD::Oracle:
>
> [Tue Mar 25 10:01:03 2003] [error] Invoking view:
> /security/list-users.html
> --> DBH LONG READ LEN: 256000 <--
> --> STATEMENT LONG READ LEN: 256000 <--
> [Tue Mar 25 10:01:05 2003] [error] Error trying to access session:
> DBD::Oracle::st fetchrow_arrayref failed: ORA-24345: A Truncation or null
> fetch error occurred (DBD ERROR: ORA-01406 error on field 1 of 1, ora_type
> 8, LongReadLen too small and/or LongTruncOk not set) [for statement ``
>                 SELECT a_session FROM sessions WHERE id = ? FOR UPDATE''
> with params: :p1='eb9d7cb85362e686ed6dacb5bd9caea8']) at
> /home/miller/lib/perl5/site_perl/5.6.1/Apache/Session/Store/Oracle.pm line
> 83.
>
> I looked at the session in question I was tring to fetch, and
> found that the
> length of the session was 8718 bytes.  8718 is a *lot* less than 256000
> bytes, so there should not have been an error.
>
> The strange thing is that this error is not consistent.  I can
> populate the
> session with a large set of data, access a few other pages (which in turn
> causes the session to be loaded), and then it fails. Or, it can
> fail on the
> next request after loading the session.
>
> You can see by the --> <-- delimited comments above that both the database
> handle and statement handle have been set to 256000 bytes.  This
> only seems
> to slightly help the problem, in that the error doesn't occur immediately
> after the session load.
>
> Anyone have any ideas?
>
> I'm running perl 5.6.1, with current (stable) versions of Apache::Session,
> DBI, and DBD::Oracle.  I'm communicating with Oracle 8.1.7.  I've also
> included a trace below showing the error, with the LongReadLen=256000.
>
> Cheers!
>
>    -klm.
>
>     -> FETCH for DBD::Oracle::st (DBI::st=HASH(0x999c810)~0x999a738
> 'Active')
>     .. FETCH DBI::st=HASH(0x999a738) 'Active' = ''
>     <- FETCH= '' at
> /home/miller/lib/perl5/site_perl/5.6.1/i586-linux/DBI.pm
> line 1416 via /home/miller/lib/perl5/s\
> ite_perl/5.6.1/Apache/Session/Store/Oracle.pm line 71
>     -> trace in DBD::_::common for DBD::Oracle::st
> (DBI::st=HASH(0x999c810)~0x999a738 10 '/tmp/dbi.trc')
>     <- trace= 10 at
> /home/miller/lib/perl5/site_perl/5.6.1/Apache/Session/Store/Oracle.pm line
> 77 via /home/miller/\
> lib/perl5/site_perl/5.6.1/Apache/Session.pm line 481
>     <- FETCH= 256000 ('LongReadLen' from cache) at
> /home/miller/lib/perl5/site_perl/5.6.1/Apache/Session/Store/Orac\
> le.pm line 79 via /home/miller/lib/perl5/site_perl/5.6.1/Apache/Session.pm
> line 481
>     -> STORE for DBD::Oracle::st (DBI::st=HASH(0x999a738)~INNER
> 'LongReadLen' 256000)
>     STORE DBI::st=HASH(0x999a738) 'LongReadLen' => 256000
>     <- STORE= 1 at
> /home/miller/lib/perl5/site_perl/5.6.1/Apache/Session/Store/Oracle.pm line
> 80 via /home/miller/l\
> ib/perl5/site_perl/5.6.1/Apache/Session.pm line 481
>     -> bind_param for DBD::Oracle::st (DBI::st=HASH(0x999c810)~0x999a738 1
> '772d2e42c49f776e89906b6f4f30a3c7')
>        bind :p1 <== '772d2e42c49f776e89906b6f4f30a3c7' (type 0)
>        bind :p1 <== '772d2e42c49f776e89906b6f4f30a3c7' (size
> 32/33/0, ptype
> 7, otype 1)
>        bind :p1 <== '772d2e42c49f776e89906b6f4f30a3c7' (size
> 32/32, otype 1,
> indp 0, at_exec 1)
>        bind :p1 done with ftype 1
>     <- bind_param= 1 at
> /home/miller/lib/perl5/site_perl/5.6.1/Apache/Session/Store/Oracle.pm line
> 82 via /home/mil\
> ler/lib/perl5/site_perl/5.6.1/Apache/Session.pm line 481
>     -> execute for DBD::Oracle::st (DBI::st=HASH(0x999c810)~0x999a738)
>     dbd_st_execute SELECT (out0, lob0)...
>        in  ':p1' [0,0]: len 32, ind 0
> OCIStmtExecute(0x94ab4fc,0x99a1d08,0x94ab724,0,0,(nil),(nil),0)=SUCCESS
> OCIAttrGet(0x99a1d08,OCI_HTYPE_STMT,0xbfffed06,(nil),10,0x94ab724)=SUCCESS
>     dbd_st_execute SELECT returned (SUCCESS, rpc0, fn4, out0)
>     <- execute= '0E0' at
> /home/miller/lib/perl5/site_perl/5.6.1/Apache/Session/Store/Oracle.pm line
> 83 via /home/mi\
> ller/lib/perl5/site_perl/5.6.1/Apache/Session.pm line 481
>     -> fetchrow_arrayref for DBD::Oracle::st
> (DBI::st=HASH(0x999c810)~0x999a738)
>     dbd_st_fetch 1 fields...
> OCIStmtFetch(0x99a1d08,0x94ab724,1,2,0)=SUCCESS_WITH_INFO
>     dbd_st_fetch 1 fields SUCCESS_WITH_INFO
> OCIErrorGet(0x94ab724,1,"<NULL>",0xbfffe810,"ORA-24345: A
> Truncation or null
> fetch error occurred
> ",1024,2)=SUCCESS
>     OCIErrorGet after ORA-01406 error on field 1 of 1, ora_type 8,
> LongReadLen too small and/or LongTruncOk not set\
>  (er1:ok): -1, 24345: ORA-24345: A Truncation or null fetch error occurred
>
> OCIErrorGet(0x94ab724,2,"<NULL>",0xbfffe810,"ORA-24345: A
> Truncation or null
> fetch error occurred
> ",1024,2)=NO_DATA
>         0 (rc=1406):
> 'BQQDAAAACgoGbWlsbGVyAAAAB3VzZXJfaWQKAU4AAAAUbXVzdF9jaGFuZ2VfcGFzc
> 3dvcmQKAzQ
> 4
> MAAAABJzZXNzaW9uX3ZhbGlkX3RpbWUKCktlbiBNaWxsZXIAAAAJdXNlcl9uYW1lBA
> MAAAACCgE1
> AAAADGFjY2Vzc19sZXZlbAQCAAAAyQoEMDM1MwoEMDQyNwoEMDQ3MAoEMDU3MAoEMD
> cwMAoEMDcw
> NQoEMDcxMgoEMDczMQoEMDczNAoEMTA1MQoEMTA1MgoEMTEyNQoEMTEzMAoEMTE0OA
> oEMTE1NgoE
> MTE2NgoEMTE2OAoEMTE3MQoEMTE5MgoEMTE5NAoEMTE5OAoEMTIwMgoEMTIwNAoEMT
> IxNgoEMTIx
> OAoEMTIyMA...'
>     !! ERROR: 24345 'ORA-24345: A Truncation or null fetch error occurred
> (DBD ERROR: ORA-01406 error on field 1 of\
>  1, ora_type 8, LongReadLen too small and/or LongTruncOk not set)'
>     <- fetchrow_arrayref= undef row1 at
> /home/miller/lib/perl5/site_perl/5.6.1/Apache/Session/Store/Oracle
> .pm line \
> 85 via /home/miller/lib/perl5/site_perl/5.6.1/Apache/Session.pm line 481
>     >> FETCH       DISPATCH (DBI::st=HASH(0x999a738) rc2/1 @2 g0 ima404
> pid#14891) at /home/miller/lib/perl5/site_p\
> erl/5.6.1/Apache/Session/Store/Oracle.pm line 85 via
> /home/miller/lib/perl5/site_perl/5.6.1/Apache/Session.pm line \
> 481
> 1   -> FETCH for DBD::Oracle::st (DBI::st=HASH(0x999a738)~INNER
> 'ParamValues')
>        error: 24345 'ORA-24345: A Truncation or null fetch error occurred
> (DBD ERROR: ORA-01406 error on field 1 of\
>  1, ora_type 8, LongReadLen too small and/or LongTruncOk not set)'
> 1   <- FETCH= HASH(0x9a063b0)1keys at
> /home/miller/lib/perl5/site_perl/5.6.1/Apache/Session/Store/Oracle.pm line
> 85\
>  via /home/miller/lib/perl5/site_perl/5.6.1/Apache/Session.pm line 481
>
>
> -------------------------------------------
> Kenneth L. Miller
> Consultant, Shetland Software Services Inc.
> Office: 403.750.1790
>   Cell: 403.680.3785
>
>
>

Reply via email to