-----Original Message-----
From:   Jonathan Leffler [mailto:[EMAIL PROTECTED]]
Sent:   Sat 04/01/2003 07:26
To:     Maras Michal
Cc:     DBI Users Mailing List
Subject:        Re: mod_perl and connect by DBD::Informix

Maras Michal wrote:
>  I wrote simple Apache::ASP page
> -------
> <HTML>
> <BODY>
> <%
> use DBI;
> use DBD::Informix;

You don't need to 'use DBD::Informix'; it will be automagically loaded 
when you run the connect.

OK

> my $dbh = DBI->connect("DBI:Informix:\@server", "", "",{ PrintError =>
> 0, AutoCommit => 1, });

When there are problems, I'd recommend trying PrintError=>1 and/or 
RaiseError=>1, especially if you aren't prepared to test whether 
you've got a valid $dbh before trying to use it.

I added

> my $rc=$dbh->disconnect;
> %>
> </BODY>
> </HTML>
> -------
> 
> This page (perl asp script) work fine, but only first time on
> apache child process. Second attemp to run this script cause
> segmentation fault of child apache process. When main apache
> process then create new child, all is OK, but only for one script
> run again, and so on.
> 
> What is wrong?
> 
> I run perl 5.6.1 without thread on AIX 4.3, apache 1.3.20  mod_perl/1.26

Apache 1.3.20 should be upgraded to avoid some security bugs (1.3.27 
is current, I believe). You can debate whether Perl should be 5.8.0. 
I don't keep the mod_perl version information at hand.  However, it is 
also entirely fair to say that these versions are not relevant to the 
problem.

You don't say which version of DBD::Informix or DBI you are using;
that would be useful to know. You also don't mention whether you are
using Apache::DBI; that too might be relevant. You don't say which
version of ESQL/C or the Informix database server you are using; those
might be relevant.

 DBI-1.32
DBD-Informix-1.00.PC2 (I try DBD-Informix-1.04.PC1 too
 with same result)
Informix Dynamic Server 2000 Version 9.20.UC4X6
INFORMIX-ESQL Version 9.14.UC1

It also isn't clear to me how you tell that the page works on the 
first pass -- the example does not seem to display anything.

My work up in detail is

My asp page is
----
<HTML>
<BODY>
<%
open(HAN,"ps -ef | grep httpd|grep maras|");
while(<HAN>) {
  print "$_<BR>\n";
  }
close HAN;
print "Process $$<BR>\n";

$dbType = "Informix";
$ENV{"INFORMIXDIR"}="/usr/informix";
$ENV{"INFORMIXSERVER"}="cm1";
use DBI;

 $dbh = DBI->connect("DBI:$dbType:\@cm1", "", "",
{ PrintError => 1, RaiseError=>1, AutoCommit => 1, });
if (!defined($dbh)) {
  print "DBI->connect on ${server_select}","Error connect ($DBI::err): $DBI::err
str";
  return;
  }
print "After connect<BR>\n";
 $rc=$dbh->disconnect;
if (!defined($rc)) {
  print "Error disconnect ($DBI::err): $DBI::errstr<BR>\n";
  }
print "After disconnect<BR>\n";

%>
</BODY>
</HTML>
----
Some httpd configuration dirrectives
KeepAlive On
MaxKeepAliveRequests 10
KeepAliveTimeout 15
MinSpareServers 1
MaxSpareServers 1
StartServers 1
MaxClients 10
MaxRequestsPerChild 0

Apache processes immediately after atache start

informix 28748 36952   0 16:01:18      -  0:00 /u/maras/apache/bin/httpd
    root 36952     1   0 16:01:17      -  0:00 /u/maras/apache/bin/httpd

First pass (after first run asp page)

Browser display.
informix 28748 36952 18 16:01:18 - 0:00 /u/maras/apache/bin/httpd 
root 36952 1 0 16:01:17 - 0:00 /u/maras/apache/bin/httpd 
informix 41720 36952 0 16:02:32 - 0:00 /u/maras/apache/bin/httpd 
Process 28748
After connect
After disconnect

Second pass
Browser display.
informix 28748 36952 0 16:01:18 - 0:00 /u/maras/apache/bin/httpd 
root 36952 1 0 16:01:17 - 0:00 /u/maras/apache/bin/httpd 
informix 41720 36952 25 16:02:32 - 0:00 /u/maras/apache/bin/httpd 
Process 41720
After connect
After disconnect

Next pass (again process 28748, then 41720, but both killed as
in apache error log)
[Sun Jan  5 16:05:31 2003] [notice] child pid 28748 exit signal Segmentation fault (11)
[Sun Jan  5 16:05:32 2003] [notice] child pid 41720 exit signal Segmentation fault (11)
Main apache process create new process 24488, run with it asp script,
and create new spare processes (I don't now why not one only)
Browser display.
informix 24488 36952 25 16:05:31 - 0:00 /u/maras/apache/bin/httpd 
informix 28750 36952 0 16:05:32 - 0:00 /u/maras/apache/bin/httpd 
root 36952 1 0 16:01:17 - 0:00 /u/maras/apache/bin/httpd 
informix 42876 36952 0 16:05:32 - 0:00 /u/maras/apache/bin/httpd 
Process 24488
After connect
After disconnect

Next
Browser display.
informix 24488 36952 0 16:05:31 - 0:00 /u/maras/apache/bin/httpd 
informix 28750 36952 23 16:05:32 - 0:00 /u/maras/apache/bin/httpd 
root 36952 1 0 16:01:17 - 0:00 /u/maras/apache/bin/httpd 
informix 42876 36952 0 16:05:32 - 0:00 /u/maras/apache/bin/httpd 
Process 28750
After connect
After disconnect

Next (again Segmentation fault, and creating new child
processes)
next entries in apache error log is
[Sun Jan  5 16:12:08 2003] [notice] child pid 24488 exit signal Segmentation fault (11)
[Sun Jan  5 16:12:09 2003] [notice] child pid 28750 exit signal Segmentation fault (11)
Browser display.
informix 24490 36952 0 16:12:11 - 0:00 /u/maras/apache/bin/httpd 
informix 28752 36952 25 16:12:10 - 0:00 /u/maras/apache/bin/httpd 
root 36952 1 0 16:01:17 - 0:00 /u/maras/apache/bin/httpd 
informix 42878 36952 0 16:12:11 - 0:00 /u/maras/apache/bin/httpd 
Process 28752
After connect
After disconnect

And  all round

dbx output (from slightly different asp page, whitch
I run from FORM ACTION. In that case only one child apache
process killed, but asp page is little complikated)
platan:/u/maras/apache # dbx /u/maras/apache/bin/httpd core
Type 'help' for help.
reading symbolic information ...
[using memory image in core]

Segmentation fault in sig_coredump at line 2750 in file ""
couldn't read "http_main.c"
(dbx) where
sig_coredump(sig = 11), line 2750 in "http_main.c"
_umalloc(??, ??) at 0xd302769c
replace(??, ??, ??, ??, ??) at 0xd3029134
_urealloc(??, ??) at 0xd302930c
cbase.realloc(??, ??) at 0xd301efc4
Perl_safesysrealloc(0x20127c48, 0xd0), line 129 in "util.c"
Perl_my_setenv(0x20109048, 0x200367b8), line 2010 in "util.c"
unnamed block $b1830, line 1712 in "mod_perl.c"
perl_setup_env(??), line 1712 in "mod_perl.c"
ptrgl._ptrgl(??) at 0xd0ea4cec
unnamed block $b1842, line 1477 in "mod_perl.c"
perl_call_handler(??, ??, ??), line 1477 in "mod_perl.c"
perl_run_stacked_handlers(??, ??, ??), line 1349 in "mod_perl.c"
perl_handler(??), line 875 in "mod_perl.c"
ap_invoke_handler(0x20107848), line 517 in "http_config.c"
process_request_internal(0x20107848), line 1307 in "http_request.c"
ap_process_request(0x20107848), line 1323 in "http_request.c"
unnamed block $b40, line 4209 in "http_main.c"
child_main(child_num_arg = 1), line 4209 in "http_main.c"
make_child(s = 0x2003d088, slot = 1, now = 1041779854), line 4368 in "http_main.c"
perform_idle_server_maintenance(), line 4532 in "http_main.c"
unnamed block $b33, line 4764 in "http_main.c"
standalone_main(argc = 1, argv = 0x2ff22bec), line 4764 in "http_main.c"
main(argc = 1, argv = 0x2ff22bec), line 5010 in "http_main.c"
(dbx)

If I insert command kill 6,$$; in asp code, dbx output
looks (first pass after apache restart)

platan:/u/maras/apache # dbx /u/maras/apache/bin/httpd core
Type 'help' for help.
reading symbolic information ...
[using memory image in core]

IOT/Abort trap in sig_coredump at line 2750 in file ""
couldn't read "http_main.c"
(dbx) where
sig_coredump(sig = 6), line 2750 in "http_main.c"
unnamed block $b1750, line 1565 in "doio.c"
Perl_apply(0x11e, 0x201e8418, 0x201e8418), line 1565 in "doio.c"
Perl_pp_kill(), line 3939 in "pp_sys.c"
Perl_runops_standard(), line 23 in "run.c"
S_call_body(0x2ff224e8, 0x0), line 1824 in "perl.c"
Perl_call_sv(0x2007c0d4, 0x4), line 1742 in "perl.c"
unnamed block $b1846, line 1635 in "mod_perl.c"
perl_call_handler(??, ??, ??), line 1635 in "mod_perl.c"
perl_run_stacked_handlers(??, ??, ??), line 1349 in "mod_perl.c"
perl_handler(??), line 875 in "mod_perl.c"
ap_invoke_handler(0x20107848), line 517 in "http_config.c"
process_request_internal(0x20107848), line 1307 in "http_request.c"
ap_process_request(0x20107848), line 1323 in "http_request.c"
unnamed block $b40, line 4209 in "http_main.c"
child_main(child_num_arg = 0), line 4209 in "http_main.c"
make_child(s = 0x2003d088, slot = 0, now = 1041780110), line 4368 in "http_main.c"
startup_children(number_to_start = 1), line 4395 in "http_main.c"
standalone_main(argc = 1, argv = 0x2ff22bec), line 4683 in "http_main.c"
main(argc = 1, argv = 0x2ff22bec), line 5010 in "http_main.c"
(dbx)




Reply via email to