Re: Threading and DBI in perl 5.8.0

2002-08-17 Thread Scott Alexander


I got this working finally.  I originally grabbed the wrong patch for
DBD::Oracle.  The one that I ended up using was at:
http:[EMAIL PROTECTED]/msg01291.html

Thanks for the pointers on where to find what I needed Tim, and thanks
to Gerald Richter for putting the patch together.

Scott

 On Fri, Aug 09, 2002 at 06:16:08PM +, Scott Alexander wrote:
  I'm doing some testing with perl 5.8.0 and trying to use DBI.  I
  know that the DBI and ithreads are listed as beta and not production
  ready, but the problem I think I'm having is that this fails to even
  make the clone.  It never gets to using the dbi itself.
  
  The script is a Sendmail::Milter filter that I'm working on.  It
  dies right after I make a connection to the sendmail engine.  Thats
  why I'm pretty sure that this is caused by the cloning.
  
  The actual error is:
  Starting Sendmail::Milter 0.18 engine.
  Assertion tbl failed: file sv.c, line 8798
 
 That's Perl_ptr_table_fetch(). A stack trace from the core file
 would be a big help.
 



Re: Threading and DBI in perl 5.8.0

2002-08-12 Thread Tim Bunce

On Fri, Aug 09, 2002 at 06:16:08PM +, Scott Alexander wrote:
 I'm doing some testing with perl 5.8.0 and trying to use DBI.  I know
 that the DBI and ithreads are listed as beta and not production ready,
 but the problem I think I'm having is that this fails to even make the
 clone.  It never gets to using the dbi itself.
 
 The script is a Sendmail::Milter filter that I'm working on.  It dies
 right after I make a connection to the sendmail engine.  Thats why I'm
 pretty sure that this is caused by the cloning.
 
 The actual error is:
 Starting Sendmail::Milter 0.18 engine.
 Assertion tbl failed: file sv.c, line 8798

That's Perl_ptr_table_fetch(). A stack trace from the core file
would be a big help.

 at /home/mm/installs/lib/perl5/site_perl/5.8.0/i686-linux-thread-multi/DBI.pm line 
425.

That's inside the DBI's CLONE sub. Try commenting out this line in DBI.xs:
  DBIS-logfp  = parent_dbis ? fp_dup(parent_dbis-logfp,'',0) : PerlIO_stderr();

 Is this just something where I need to wait for the next version of DBI?

Nope. At this stage I'm not using or testing or developing threads
support for DBI.  I'm just responding to any issues that crop up.

 Does DBD::Oracle not support this yet?

See archives for some changes you can make to DBD::Oracle to improve things.
The next release will be better.

Tim.

 Thanks,  Scott
 
 This is DBI 1.30 with DBD::Oracle 1.12.
 Platform is Redhat 7.3
 perl -V is:
 Summary of my perl5 (revision 5.0 version 8 subversion 0) configuration:
   Platform:
 osname=linux, osvers=2.4.18-3, archname=i686-linux-thread-multi
 uname='linux scotts_lap 2.4.18-3 #1 thu apr 18 07:37:53 edt 2002
 i686 unknown '
 config_args='-Doptimize=-g -Dusethreads -Dprefix=/home/mm/installs
 -de'
 hint=recommended, useposix=true, d_sigaction=define
 usethreads=define use5005threads=undef 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 -D_GNU_SOURCE -DDEBUGGING
 -fno-strict-aliasing -I/usr/local/include -D_LARGEFILE_SOURCE
 -D_FILE_OFFSET_BITS=64 -I/usr/include/gdbm',
 optimize='-g',
 cppflags='-D_REENTRANT -D_GNU_SOURCE -DDEBUGGING
 -fno-strict-aliasing -I/usr/local/include -I/usr/include/gdbm'
 ccversion='', gccversion='2.96 2731 (Red Hat Linux 7.3
 2.96-110)', 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='cc', ldflags =' -L/usr/local/lib'
 libpth=/usr/local/lib /lib /usr/lib
 libs=-lnsl -lndbm -lgdbm -ldl -lm -lpthread -lc -lcrypt -lutil
 perllibs=-lnsl -ldl -lm -lpthread -lc -lcrypt -lutil
 libc=/lib/libc-2.2.5.so, so=so, useshrplib=false, libperl=libperl.a
 gnulibc_version='2.2.5'
   Dynamic Linking:
 dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-rdynamic'
 cccdlflags='-fpic', lddlflags='-shared -L/usr/local/lib'
 
 
 Characteristics of this binary (from libperl):
   Compile-time options: DEBUGGING MULTIPLICITY USE_ITHREADS
 USE_LARGE_FILES PERL_IMPLICIT_CONTEXT
   Built under linux
   Compiled at Jul 30 2002 10:58:24
   INC:
 /home/mm/installs/lib/perl5/5.8.0/i686-linux-thread-multi
 /home/mm/installs/lib/perl5/5.8.0
 /home/mm/installs/lib/perl5/site_perl/5.8.0/i686-linux-thread-multi
 /home/mm/installs/lib/perl5/site_perl/5.8.0
 /home/mm/installs/lib/perl5/site_perl



Re: Threading and DBI in perl 5.8.0

2002-08-12 Thread Scott Alexander

Thanks for the response Tim.

Commenting out this line appears to have fixed the first problem. It no
longer dies when it clones the process.
   DBIS-logfp  = parent_dbis ? fp_dup(parent_dbis-logfp,'',0) :
   PerlIO_stderr();

If you would still like to see the stack trace, I can uncomment the line
and run the program again.  I don't know how to make perl dump the core
on a crash though,  so the specific flag to pass or info about what I
need to do to get stack trace would be appreciated.

I'm still having trouble though with connecting to the database after
each thread starts.

Through the archive,  I found the reference for the ora_init_mode
needing to be OCI_THREADED and OCI_OBJECT or'd together.
#define OCI_THREADED  0x01 /* the application is in threaded
environment */
#define OCI_OBJECT0x02   /* the application is in object
environment */

So I added ora_init_mode = 3 to my connect args.

the basic premise of the code is this:
disconnect the db
start new thread
connect to db inside of thread
whatever I need to do.

I turned tracing to 5 to see If I could get any help from it.  It
reports

disconnecting
connecting to db
DBI 1.30-ithread dispatch trace level set to 5
- DBI-connect(dbi:Oracle:mfm, USERNAME, , HASH(0x8be139c))
- DBI-install_driver(Oracle) for linux perl=5.008 pid=25587
ruid=500 euid=500
   install_driver: DBD::Oracle version 1.12 loaded from
/home/mm/installs/lib/perl5/site_perl/5.8.0/i686-linux-thread-multi/DBD
/Oracle.pm
- install_driver= DBI::dr=HASH(0x8b6cb08)

And then nothing more.  When I do a connection before the threading,
There is a huge amount of output.  I also don't see the connections
establish with netstat -atn.



Scott

On Mon, 12 Aug 2002 08:06:44 +0100
Tim Bunce [EMAIL PROTECTED] wrote:
 On Fri, Aug 09, 2002 at 06:16:08PM +, Scott Alexander wrote:
  I'm doing some testing with perl 5.8.0 and trying to use DBI.  I
  know that the DBI and ithreads are listed as beta and not production
  ready, but the problem I think I'm having is that this fails to even
  make the clone.  It never gets to using the dbi itself.
  
  The script is a Sendmail::Milter filter that I'm working on.  It
  dies right after I make a connection to the sendmail engine.  Thats
  why I'm pretty sure that this is caused by the cloning.
  
  The actual error is:
  Starting Sendmail::Milter 0.18 engine.
  Assertion tbl failed: file sv.c, line 8798
 
 That's Perl_ptr_table_fetch(). A stack trace from the core file
 would be a big help.

  at
  /home/mm/installs/lib/perl5/site_perl/5.8.0/i686-linux-thread-multi
  /DBI.pm line 425.
 
 That's inside the DBI's CLONE sub. Try commenting out this line in
 DBI.xs:
   DBIS-logfp  = parent_dbis ? fp_dup(parent_dbis-logfp,'',0) :
   PerlIO_stderr();


 
  Is this just something where I need to wait for the next version of
  DBI?
 
 Nope. At this stage I'm not using or testing or developing threads
 support for DBI.  I'm just responding to any issues that crop up.
 
  Does DBD::Oracle not support this yet?
 
 See archives for some changes you can make to DBD::Oracle to improve
 things. The next release will be better.
 
 Tim.