ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> modperl
modperl
Re: okay, I give, I'm stumped
by Greg Rumple other posts by this author
Jul 28 2002 5:49PM messages near this date
Re: okay, I give, I'm stumped | RE: apache mod_perl + suid question
* David Kaufman (gigawatt@optonline.net) [020728 00:55]:
>  again, just a shot in the dark, but why not try the more mod_perl specific
>  Apache::DBI instead of plain ole DBI?

Okay I have tried this.  I also edited the Apache/DBI.pm and enabled
both Apache::DBI and DBI debugging at level 2 so I could get a better
idea of what is going on before it dies.  I also put a line at the top
of my perl file and the end of my perl file defining the begin and end.
Here's what I see before it dies.

    DBI 1.21-nothread dispatch trace level set to 2
    Note: perl is running without the recommended perl -w option
------------ BEGIN -----------
    ->  DBI->Apache::DBI::connect(dbi:Informix:test, test, ****)
    ->  DBI->install_driver(Informix) for linux perl=5.006001 pid=17059
ruid=1000 euid=1000
       install_driver: DBD::Informix version 1.00.PC2 loaded from
/usr/local/lib/perl/5.6.1/DBD/Informix.pm
    <- install_driver= DBI::dr=HASH(0x819f0a8)
    <- FETCH= 'Informix' ('Name' from cache) at DBI.pm line 64
17059 Apache::DBI             skipping connection during server startup,
read the docu !!
    ->  connect for DBD::Informix::dr (DBI::dr=HASH(0x819f0a8)~0x81f50a0
'test' 'test' **** HASH(0x817d044))
--> > DBD::Informix::dbd_ix_db_preset()
AutoCommit set to 1
<<-- DBD::Informix::dbd_ix_db_preset()
--> > DBD::Informix::dbd_ix_db_login()
CONNECT TO 'test' with user info
<<-- DBD::Informix::dbd_ix_db_login()
    <- connect= DBI::db=HASH(0x81d4204) at DBI.pm line 83
    ->  STORE for DBD::Informix::db (DBI::db=HASH(0x81e1b68)~INNER
'PrintError' 1)
--> > DBD::Informix::dbd_ix_db_STORE_attrib()
<<-- DBD::Informix::dbd_ix_db_STORE_attrib()
    <- STORE= 1 at DBI.pm line 513
    ->  STORE for DBD::Informix::db (DBI::db=HASH(0x81e1b68)~INNER
'AutoCommit' 1)
--> > DBD::Informix::dbd_ix_db_STORE_attrib()
<<-- DBD::Informix::dbd_ix_db_STORE_attrib()
    <- STORE= 1 at DBI.pm line 513
    <- connect= DBI::db=HASH(0x81d4204)
------------ END -----------
    ->  DESTROY for DBD::Informix::db (DBI::db=HASH(0x81e1b68)~INNER)
--> > DBD::Informix::dbd_ix_db_disconnect()
DBD::Informix::dbd_ix_db_disconnect -- delete statements
--> > DBD::Informix::dbd_ix_link_delchain()
<<-- DBD::Informix::dbd_ix_link_delchain()
DBD::Informix::dbd_ix_db_disconnect -- statements deleted
DISCONNECT (x_000000000)
DISCONNECT -- STATUS 0
<<-- DBD::Informix::dbd_ix_db_disconnect()
--> > DBD::Informix::dbd_ix_db_destroy()
<<-- DBD::Informix::dbd_ix_db_destroy()
    <- DESTROY= undef

Than it cores, all new core dump.

#0  0x40260194 in Perl_share_hek () from /usr/lib/libperl.so.5.6
#1  0x4025e919 in Perl_hv_store () from /usr/lib/libperl.so.5.6
#2  0x4025e56a in Perl_hv_fetch () from /usr/lib/libperl.so.5.6
#3  0x4021fa44 in Perl_gv_fetchpv () from /usr/lib/libperl.so.5.6
#4  0x40225a1c in Perl_yylex () from /usr/lib/libperl.so.5.6
#5  0x402374f0 in Perl_yyparse () from /usr/lib/libperl.so.5.6
#6  0x4028bc49 in Perl_sv_compile_2op () from /usr/lib/libperl.so.5.6
#7  0x4028cf6c in Perl_pp_require () from /usr/lib/libperl.so.5.6
#8  0x40262411 in Perl_runops_standard () from /usr/lib/libperl.so.5.6
#9  0x4021ab2c in perl_call_sv () from /usr/lib/libperl.so.5.6
#10 0x4021a89e in perl_call_sv () from /usr/lib/libperl.so.5.6
#11 0x4021e1db in Perl_call_list () from /usr/lib/libperl.so.5.6
#12 0x4021de4f in Perl_call_list () from /usr/lib/libperl.so.5.6
#13 0x40242b92 in Perl_newATTRSUB () from /usr/lib/libperl.so.5.6
#14 0x4023face in Perl_utilize () from /usr/lib/libperl.so.5.6
#15 0x4023829a in Perl_yyparse () from /usr/lib/libperl.so.5.6
#16 0x4028bc49 in Perl_sv_compile_2op () from /usr/lib/libperl.so.5.6
#17 0x4028cf6c in Perl_pp_require () from /usr/lib/libperl.so.5.6
#18 0x40262411 in Perl_runops_standard () from /usr/lib/libperl.so.5.6
#19 0x4021ab2c in perl_call_sv () from /usr/lib/libperl.so.5.6
#20 0x4021a89e in perl_call_sv () from /usr/lib/libperl.so.5.6
#21 0x4021e1db in Perl_call_list () from /usr/lib/libperl.so.5.6
#22 0x4021de4f in Perl_call_list () from /usr/lib/libperl.so.5.6
#23 0x40242b92 in Perl_newATTRSUB () from /usr/lib/libperl.so.5.6
#24 0x4023face in Perl_utilize () from /usr/lib/libperl.so.5.6
#25 0x4023829a in Perl_yyparse () from /usr/lib/libperl.so.5.6
#26 0x4028bc49 in Perl_sv_compile_2op () from /usr/lib/libperl.so.5.6
#27 0x4028cf6c in Perl_pp_require () from /usr/lib/libperl.so.5.6
#28 0x40262411 in Perl_runops_standard () from /usr/lib/libperl.so.5.6
#29 0x4021ab2c in perl_call_sv () from /usr/lib/libperl.so.5.6
#30 0x4021a89e in perl_call_sv () from /usr/lib/libperl.so.5.6
#31 0x4021e1db in Perl_call_list () from /usr/lib/libperl.so.5.6
#32 0x4021de4f in Perl_call_list () from /usr/lib/libperl.so.5.6
#33 0x40242b92 in Perl_newATTRSUB () from /usr/lib/libperl.so.5.6
#34 0x4023face in Perl_utilize () from /usr/lib/libperl.so.5.6
#35 0x4023829a in Perl_yyparse () from /usr/lib/libperl.so.5.6
#36 0x4028bc49 in Perl_sv_compile_2op () from /usr/lib/libperl.so.5.6
#37 0x4028cf6c in Perl_pp_require () from /usr/lib/libperl.so.5.6
#38 0x40262411 in Perl_runops_standard () from /usr/lib/libperl.so.5.6
#39 0x4021ab2c in perl_call_sv () from /usr/lib/libperl.so.5.6
#40 0x4021a89e in perl_call_sv () from /usr/lib/libperl.so.5.6
#41 0x4021e1db in Perl_call_list () from /usr/lib/libperl.so.5.6
#42 0x4021de4f in Perl_call_list () from /usr/lib/libperl.so.5.6
#43 0x40242b92 in Perl_newATTRSUB () from /usr/lib/libperl.so.5.6
#44 0x4023face in Perl_utilize () from /usr/lib/libperl.so.5.6
#45 0x4023829a in Perl_yyparse () from /usr/lib/libperl.so.5.6
#46 0x4028bc49 in Perl_sv_compile_2op () from /usr/lib/libperl.so.5.6
#47 0x4028cf6c in Perl_pp_require () from /usr/lib/libperl.so.5.6
#48 0x40262411 in Perl_runops_standard () from /usr/lib/libperl.so.5.6
#49 0x4021ab2c in perl_call_sv () from /usr/lib/libperl.so.5.6
#50 0x4021acce in perl_eval_sv () from /usr/lib/libperl.so.5.6
#51 0x404856e4 in perl_require_module (name=0x404abd64 "Apache", s=0x8094c04) at perl_util.c
:550
#52 0x4047e9d7 in perl_cmd_module (parms=0xbffff8fc, dummy=0x8096904, arg=0x82147fc "Apache:
:DBI") at perl_config.c:591
#53 0x08054e7d in invoke_cmd (cmd=0x404b3090, parms=0xbffff8fc, mconfig=0x8096904, args=0xbf
ffd872 "") at http_config.c:946
#54 0x08055301 in ap_handle_command (parms=0xbffff8fc, config=0x8095134, l=0xbfffd85c "PerlM
odule Apache::DBI") at http_config.c:1079
#55 0x0805539d in ap_srm_command_loop (parms=0xbffff8fc, config=0x8095134) at http_config.c:
1093
#56 0x08055a69 in ap_process_resource_config (s=0x8094c04, fname=0x808d700 "/var/tmp/test.co
nf", p=0x8094bdc, ptemp=0x809f2fc) at http_config.c:1355
#57 0x080563bc in ap_read_config (p=0x8094bdc, ptemp=0x809f2fc, confname=0x808d700 "/var/tmp
/test.conf") at http_config.c:1647
#58 0x08060c43 in standalone_main (argc=6, argv=0xbffffa64) at http_main.c:5158
#59 0x080615cc in main (argc=6, argv=0xbffffa64) at http_main.c:5558

So for grins, I than decided I would try postgres to just verify this is
an Informix issue.

I commented out the Informix lines in my startup perl script, and added
the 4 lines necessary to connect to a local postgres database, and sure
enough it works.  Here's what the output looks like.

    DBI 1.21-nothread dispatch trace level set to 2
    Note: perl is running without the recommended perl -w option
------------ BEGIN -----------
    -> 
DBI-> Apache::DBI::connect(dbi:Pg:dbname=ftf;host=grumple;port=6110, ,
****)
    ->  DBI->install_driver(Pg) for linux perl=5.006001 pid=17070
ruid=1000 euid=1000
       install_driver: DBD::Pg version 1.11 loaded from
/home/grumple/src/ftf.newshit/ext/lib/perl5/DBD/Pg.pm
    <- install_driver= DBI::dr=HASH(0x819f0a8)
    <- FETCH= 'Pg' ('Name' from cache) at DBI.pm line 64
17070 Apache::DBI             skipping connection during server startup,
read the docu !!
    ->  connect for DBD::Pg::dr (DBI::dr=HASH(0x819f0a8)~0x81f656c
'dbname=ftf;host=grumple;port=6110' '' **** HASH(0x817d044))
pg_db_login
pg_db_login: conn_str = > dbname=ftf host=grumple port=6110<
    <- connect= DBI::db=HASH(0x81f6530) at DBI.pm line 83
    ->  STORE for DBD::Pg::db (DBI::db=HASH(0x81f6518)~INNER 'PrintError'
1)
dbd_db_STORE
    <- STORE= 1 at DBI.pm line 513
    ->  STORE for DBD::Pg::db (DBI::db=HASH(0x81f6518)~INNER 'AutoCommit'
1)
dbd_db_STORE
dbd_db_STORE: initialize AutoCommit to on
    <- STORE= 1 at DBI.pm line 513
    <- connect= DBI::db=HASH(0x81f6530)
------------ END -----------
    ->  DESTROY for DBD::Pg::db (DBI::db=HASH(0x81f6518)~INNER)
Database handle destroyed without explicit disconnect.
dbd_db_disconnect
dbd_db_destroy
    <- DESTROY= undef

It seems to just look good, and work all dandy.  Yet the Informix
driver just blows up horribly.
>  
>  > use DBD::Informix;
>  
>  i don't think you need this use statement at all.  the DBI->connect() call
>  should load the "correct" DBD Driver, for you, not that it *should* make any
>  difference... but hey.

Me either, just put it in there just in case.  Makes NO difference.

>  i would certainly suggest adding:
>  
>      or die DBI::errstr;
>  
>  to that connect() call!

Yeah, was just throwing together a sample program.  Not trying to put
together something to be "production" quality.  :-)

>  
>  > $dbh->disconnect();
>  
>  um, okay but why disconnect at all, if you know the segfault is caused by
>  the connect and/or disconnect calls? have you tries simply *not*
>  disconnecting?  one of The Features/Advantages of Apache::DBI (over plain
>  ole DBI) is that disconnect calls simlpy destroy the connection *object*
>  (the perl data structure) without actually disconnecting from the DB, and
>  therby maintaining a pool of cached connections, and therby speeding things
>  up nicely.

I have removed the disconnect, but it makes no difference as suspected.

I will note that once the server is started, it has 0 problems
communicating with Informix, it's only in this startup script that it
blows up badly.

-- 
Greg Rumple
grumple@zaphon.llamas.net
Thread:
Greg Rumple
Geoffrey Young
Stas Bekman
Stas Bekman
simran
Geoffrey Young
simran
simran
Kyle Dawkins
Greg Rumple
Drew Taylor
Greg Rumple
David Kaufman
Greg Rumple

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved