Re: [mp2] Child process exited

2003-08-20 Thread Chuck Tribolet
I just stumbled into this thread, trying to figure out how to fix
the same error, generated by a C module.

Convert 3221225725 to hex, and you get C0FD and THAT's
the code for a stack overflow.  Maybe a recursive function in your
PERL code?




-- 
Chuck Tribolet
[EMAIL PROTECTED]
http://www.almaden.ibm.com/cs/people/triblet



"Jean-Sebastien Guay" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED]
Hello,

I think I've made good steps towards getting my scripts to work (Apache/2.0.47 (Win32) 
mod_perl/1.99_10-dev Perl/v5.8.0). However,
now, when I try to reload one of the pages to test, IE tells me that

"The exception unknown software exception (0xc0fd) occured in the application at 
location 0x2805caa2. Click on OK to terminate
the program, Click on CANCEL to debug the program"

(in a dialog box with the big red X). This is what I get in my error_log:

[Tue Aug 05 11:10:58 2003] [notice] Parent: child process exited with status 
3221225725 -- Restarting.
[Tue Aug 05 11:11:00 2003] [notice] Parent: Created child process 1360

What could I be doing that would make one of the Apache processes crash? Does anyone 
have an idea, or should I post code? The same
thing happens when I try to telnet into the webserver's port 80 and type "GET 
/filename.cgi HTTP/1.0". The specific CGI I want to
test generates valid HTML if run from the command line.

Any ideas? Thanks in advance,

J-S

___
Jean-Sébastien Guay  [EMAIL PROTECTED]
Software Developer, Hybride http://www.hybride.com
Piedmont, Québec, Canada




-- 
Reporting bugs: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html



Re: [mp2] Child process exited

2003-08-14 Thread Jean-Sebastien Guay
> I'll try to make a small test case so you can try to repro. I think it's
> related to DBI (only a hunch), so I'll start there.

Ok, I've got it as simple as I can (I think - 25.1k zip). It isn't related
to DBI, but to template toolkit. So to try my test case, you'll need that
installed.

Should I send the zip to the list or to your private address? I'll also
include the short setup instructions.

Thanks,

J-S

___
Jean-Sébastien Guay  [EMAIL PROTECTED]
Software Developer, Hybride http://www.hybride.com
Piedmont, Québec, Canada




Re: [mp2] Child process exited

2003-08-14 Thread Jean-Sebastien Guay
> Can't get http://whitestar02.webhop.org/Files/ApacheCrash.zip
>
> it resolves to an internal address: 192.168.0.3

Darn, looks like my web server didn't come back up right last night.
I'll have to be there to fix it, because ssh doesn't get through either.

Here's another link, on my ISP's server:
http://pages.infinit.net/jeans13/ApacheCrash.zip

Sorry for the inconvenience,

J-S

___
Jean-Sébastien Guay  [EMAIL PROTECTED]
Software Developer, Hybride http://www.hybride.com
Piedmont, Québec, Canada




Re: [mp2] Child process exited

2003-08-14 Thread Jean-Sebastien Guay
> >>Is it only mp2 that it fails under?
> >>I've tried it under mp1.28/perl5.8.0/apache1.3.27 on WinXP and it
runs
> >
> > fine.
> >
> > I haven't tried other mod_perl versions, since the threading issue
would
> > render the site unusable.
>
> so I assume that there is no point trying it on linux, if Steve can't
see it
> on win. right?

Not at all, Steve didn't see it on Windows with *another* version of
mod_perl... I'm using 1.99_10, he was using 1.28. So if you can test
under Linux with 1.99_10, it might have the same problem.

And if someone else on Windows could test with 1.99_10 as well, I would
be grateful.

Thanks,

J-S

___
Jean-Sébastien Guay  [EMAIL PROTECTED]
Software Developer, Hybride http://www.hybride.com
Piedmont, Québec, Canada




Re: [mp2] Child process exited

2003-08-14 Thread Steve Hay
Jean-Sebastien Guay wrote:

Can't get http://whitestar02.webhop.org/Files/ApacheCrash.zip

it resolves to an internal address: 192.168.0.3
   

Darn, looks like my web server didn't come back up right last night.
I'll have to be there to fix it, because ssh doesn't get through either.
Here's another link, on my ISP's server:
http://pages.infinit.net/jeans13/ApacheCrash.zip
 

Is it only mp2 that it fails under?

I've tried it under mp1.28/perl5.8.0/apache1.3.27 on WinXP and it runs fine.

What version of Template-Toolkit do you have?  It's worth ensuring that 
you're running the latest version (2.10, I think) if you suspect that it 
might be involved in the problem.

- Steve



Re: [mp2] Child process exited

2003-08-14 Thread Steve Hay
Jean-Sebastien Guay wrote:

So, did anyone have time to check this out? This is pretty major for me,
I can't implement mod_perl at my site until I find out what is causing
this crash and fix it. And I really have no idea what could be causing
it.
I'm using CGI.pm 2.98, Template-Toolkit 2.10, Apache/2.0.47 (Win32)
mod_perl/1.99_10-dev Perl/v5.8.0.
I'm willing to try this out using Apache 2 -- I've been meaning to take 
a look at Apache 2 for some now, but just never quite got around to it 
:-( -- but at the moment I can't even build it!

I've download httpd-2.0.47.tar.gz, unpacked it, cd'd to the top-level 
directory and typed "nmake /f makefile.win installr", which I believe 
should build and install (into the default location, C:\apache2) a 
release build of Apache 2.

However, that command produces this output:

==
C:\Temp\httpd-2.0.47>nmake /f makefile.win installr
Microsoft (R) Program Maintenance Utility   Version 6.00.8168.0
Copyright (C) Microsoft Corp 1988-1998. All rights reserved.
Please check out or download and unpack the Apache Portability Runtime
sources (apr, apr-iconv and apr-util) into your \srclib dir.
Apache cannot build without these libraries!
makefile.win(39) : fatal error U1050: Need \srclib\  apr, apr-iconv and 
apr-util

Stop.
==
If I look inside the "srclib" directory then I only find "apr", 
"apr-util" and "pcre", not "apr-iconv".  Where is that supposed to come 
from?

How did you build Apache 2?

Steve



Re: [mp2] Child process exited

2003-08-14 Thread Jean-Sebastien Guay
Steve,

> How did you build Apache 2?

I downloaded the binaries... Sorry, can't help there.

Please keep me posted as to your progress.

Thanks,

J-S


- Original Message - 
From: "Steve Hay" <[EMAIL PROTECTED]>
To: "Jean-Sebastien Guay" <[EMAIL PROTECTED]>
Cc: "Stas Bekman" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Tuesday, August 12, 2003 3:40 AM
Subject: Re: [mp2] Child process exited


> Jean-Sebastien Guay wrote:
>
> >So, did anyone have time to check this out? This is pretty major for
me,
> >I can't implement mod_perl at my site until I find out what is
causing
> >this crash and fix it. And I really have no idea what could be
causing
> >it.
> >
> >I'm using CGI.pm 2.98, Template-Toolkit 2.10, Apache/2.0.47 (Win32)
> >mod_perl/1.99_10-dev Perl/v5.8.0.
> >
> I'm willing to try this out using Apache 2 -- I've been meaning to
take
> a look at Apache 2 for some now, but just never quite got around to it
> :-( -- but at the moment I can't even build it!
>
> I've download httpd-2.0.47.tar.gz, unpacked it, cd'd to the top-level
> directory and typed "nmake /f makefile.win installr", which I believe
> should build and install (into the default location, C:\apache2) a
> release build of Apache 2.
>
> However, that command produces this output:
>
> ==
> C:\Temp\httpd-2.0.47>nmake /f makefile.win installr
>
> Microsoft (R) Program Maintenance Utility   Version 6.00.8168.0
> Copyright (C) Microsoft Corp 1988-1998. All rights reserved.
>
> Please check out or download and unpack the Apache Portability Runtime
> sources (apr, apr-iconv and apr-util) into your \srclib dir.
> Apache cannot build without these libraries!
>
> makefile.win(39) : fatal error U1050: Need \srclib\  apr, apr-iconv
and
> apr-util
>
> Stop.
> ==
>
> If I look inside the "srclib" directory then I only find "apr",
> "apr-util" and "pcre", not "apr-iconv".  Where is that supposed to
come
> from?
>
> How did you build Apache 2?
>
> Steve
>
>
>




Re: [mp2] Child process exited

2003-08-14 Thread Stas Bekman
I can't help you with those things without being able to reproduce the problem :(

but see below regarding the reload confusion.

[...]
# Add the top-level directory for the modules into the module search
path.
use lib qw($ENV{SCRIPT_ROOT});

Apache::Reload didn't seem to want to reload my modules.
because it probably couldn't find them.


I had followed the instructions you stated before, and you can even see
my "use libs" in the startup.pl I included above. Let's say
$ENV{SCRIPT_ROOT} (as set in my httpd.conf with a PerlSetEnv) is set to
"d:/htdocs", that means that a module being use()d as Hybride::Blah
would be found at d:/htdocs/Hybride/Blah.pm right? So Apache::Reload
should find it at the same place, since the "use libs" is in the startup
script.
But Apache::Reload still does not reload my modules... And as I said,
"ReloadDebug On" didn't even tell me if it was trying to reload them.
Nothing in my error_log, same as with the warnings.
No, that won't work, unless you set SCRIPT_ROOT env var in your shell.
PerlSetEnv has an effect only during a request time. You want it during the 
startup time.

You can dump the value of @INC, so see that d:/htdocs is not there (at the 
server startup).

One of the following will work.

PerlSwitches -Id:/htdocs

or

PerlSwitches -Mlib=d:/htdocs

__
Stas BekmanJAm_pH --> Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide ---> http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com


Re: [mp2] Child process exited

2003-08-14 Thread Stas Bekman

It's possible that some of your code or the modules that you use
either misuse

$^W or trap $SIG{__WARN__} which prevents from warnings to be printed.
grep

for these two things.


Remember - there's only the code I showed you. No other modules (other
than Template, strict and warnings which are use()d in index.cgi) and no
other code than the index.cgi I sent you.
You did load things in startup.pl, remember? some module could override 
$SIG{__WARN__}. Don't load those modules if you don't need them.

You could also try to reset it in your code:

perl -wle '$SIG{__WARN__} = sub {}; $SIG{__WARN__} = sub {CORE::warn(@_)}; 
warn "foo"'
foo at -e line 1.

but you need to do that in the BEGIN block, so it'll happen before the 
compilation of the rest of the code is done:

BEGIN {
  $SIG{__WARN__} = sub {CORE::warn(@_)};
}
use strict;
use warnings;
the rest of your code

In any case your problem with variables not staying shared (even though you 
can't see it reported is easy to see).
http://perl.apache.org/docs/general/perl_reference/perl_reference.html#my___Scoped_Variable_in_Nested_Subroutines

You also don't want to initialize $template on every request, see the Template 
docs/list archive to how make it more efficient (which will also remove the 
my() problem).

make $vars and $config global as one of the workarounds.

So if on your side there are warnings and not on my side, with the same
code, then that's a problem too...
Yes, especially since you have a scoped warnings enabled explicitly in your 
file. Does you perl print this warnings when you run a test script from the 
above URL?

Now that I think of it, when I started testing mod_perl (back when my
code was not correct and I was fixing errors to make it work), I
remember that Apache::Reload didn't seem to want to reload my modules.
Even with the ReloadDebug variable on, nothing was ever printed to my
error_log saying that my modules were reloaded... So the warnings issue
could be related to this too.
because it probably couldn't find them. See:
http://perl.apache.org/docs/2.0/api/Apache/Reload.html#Description
or even this:
http://perl.apache.org/docs/2.0/api/Apache/Reload.html#Problems_With_Reloading_Modules_Which_Do_Not_Declare_Their_Package_Name
__
Stas BekmanJAm_pH --> Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide ---> http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com


Re: [mp2] Child process exited

2003-08-14 Thread Jean-Sebastien Guay
Stas,

I just checked, and when the Apache crash occurs, nothing gets written
to access_log. It would seem that the crash happens before the request
is logged.

Also,

> b) why my warnings don't show up in the error_log.

I just moved my mod_perl config from httpd.conf to another file,
mod_perl.conf, and Include that in httpd.conf. (I did that so that I
don't have to comment the whole section for mod_perl when I want to
deactivate it, I just have to comment the Include line).

Now, magically, the warnings and the Apache::Reload debug messages show
up in my error_log! The only other thing I changed between now and
before is that I added the "PerlSwitches -Id:/htdocs" directive. But
that should have no influence on whether warnings are written to the
error_log or not...

What's happening? Is my whole Apache setup whacked? Maybe I should
reinstall Apache and mod_perl?


J-S




Re: [mp2] Child process exited

2003-08-14 Thread Jean-Sebastien Guay
Stas,

Thanks for the quick response.

> You did load things in startup.pl, remember? some module could
override
> $SIG{__WARN__}. Don't load those modules if you don't need them.

I very much doubt anything in my startup.pl would modify the signal
handlers. Here's my startup.pl, for reference:

use strict;
use warnings;

#---

# Default module inclusions as per the Apache
# mod_perl installation instructions
use Apache2 ();
use ModPerl::Util ();
use Apache::RequestRec ();
use Apache::RequestIO ();
use Apache::RequestUtil ();
use Apache::Server ();
use Apache::ServerUtil ();
use Apache::Connection ();
use Apache::Log ();
use Apache::Const -compile => ':common';
use APR::Const -compile => ':common';
use APR::Table ();
use Apache::compat ();
use ModPerl::Registry ();
use CGI ();

#---

# General modules
use Time::localtime;
use Data::Dumper;
use Date::Calc qw(:all);

# Add the top-level directory for the modules into the module search
path.
use lib qw($ENV{SCRIPT_ROOT});

# Hybride:: modules commented out for now, until I resolve the crash
issue...

> You could also try to reset it in your code:

Even with the BEGIN { ... code before anything else in my source, I
still get no warnings.

> > So if on your side there are warnings and not on my side, with the
same
> > code, then that's a problem too...
>
> Yes, especially since you have a scoped warnings enabled explicitly in
your
> file. Does you perl print this warnings when you run a test script
from the
> above URL?

No. I just tried it. It does show the erroneous response (5^2 = 25 6^2 =
25) but no warnings. I also tried with the code to restore
SIG{__WARN__}, and it didn't change anything.

>> Apache::Reload didn't seem to want to reload my modules.
> because it probably couldn't find them.

I had followed the instructions you stated before, and you can even see
my "use libs" in the startup.pl I included above. Let's say
$ENV{SCRIPT_ROOT} (as set in my httpd.conf with a PerlSetEnv) is set to
"d:/htdocs", that means that a module being use()d as Hybride::Blah
would be found at d:/htdocs/Hybride/Blah.pm right? So Apache::Reload
should find it at the same place, since the "use libs" is in the startup
script.

But Apache::Reload still does not reload my modules... And as I said,
"ReloadDebug On" didn't even tell me if it was trying to reload them.
Nothing in my error_log, same as with the warnings.

So that's a bit weird.


Thanks,


J-S




Re: [mp2] Child process exited

2003-08-14 Thread Jean-Sebastien Guay
Stas,

> e.g. I'd check the access_log to see whether it issues only one
request or
> more.
> Also make sure to debug in the single process (thread?) mode
(httpd -X)

I'll check those out this afternoon.

> It's possible that some of your code or the modules that you use
either misuse
> $^W or trap $SIG{__WARN__} which prevents from warnings to be printed.
grep
> for these two things.

Remember - there's only the code I showed you. No other modules (other
than Template, strict and warnings which are use()d in index.cgi) and no
other code than the index.cgi I sent you.

So if on your side there are warnings and not on my side, with the same
code, then that's a problem too...

Now that I think of it, when I started testing mod_perl (back when my
code was not correct and I was fixing errors to make it work), I
remember that Apache::Reload didn't seem to want to reload my modules.
Even with the ReloadDebug variable on, nothing was ever printed to my
error_log saying that my modules were reloaded... So the warnings issue
could be related to this too.

This is my mod_perl section in httpd.conf, is there anything wrong with
it that would make these two things (PerlSwitches -wT and PerlModule
Apache::Reload) not work?

LoadModule  perl_module modules/mod_perl.so
LoadFile"D:/Perl/bin/perl58.dll"

PerlModule  Apache2
PerlModule  Apache::Reload
PerlSetEnv  SCRIPT_ROOT "D:/htdocs/test"
PerlRequire "D:/htdocs/_startup.pl"
PerlSetVar  ReloadAll   On
PerlSetVar  ReloadDebug On
PerlSwitches -wT

  # This is so that we don't have to run mod_perl CGI scripts from
another
  # location than the normal directories (DocumentRoot, etc)
  
 SetHandler perl-script

 PerlResponseHandler ModPerl::Registry
 Options +ExecCGI
 PerlOptions +ParseHeaders +GlobalRequest

 PerlInitHandler Apache::Reload

  

Thanks,

J-S

___
Jean-Sébastien Guay  [EMAIL PROTECTED]
Software Developer, Hybride http://www.hybride.com
Piedmont, Québec, Canada




Re: [mp2] Child process exited

2003-08-14 Thread Stas Bekman
Jean-Sebastien Guay wrote:
So, did anyone have time to check this out? This is pretty major for me,
I can't implement mod_perl at my site until I find out what is causing
this crash and fix it. And I really have no idea what could be causing
it.
I'm using CGI.pm 2.98, Template-Toolkit 2.10, Apache/2.0.47 (Win32)
mod_perl/1.99_10-dev Perl/v5.8.0.
So please, if someone on a similar setup could download the test case at
http://pages.infinit.net/jeans13/ApacheCrash.zip and see if the crash
happens for them too... Remember to read the README file first...
Jean-Sebastien, are you *sure* that what crashes is apache and not your 
client? it seems that you have the client crashing if removing  changes 
everything. What's your error_log says?

BTW, I can't reproduce you problem. You must run your code with warnings 
enabled, add to httpd.conf:

PerlSwitches -wT

and you will see:

Variable "$template" will not stay shared at /tmp/CRUSH/index.cgi line 26.
Variable "$vars" will not stay shared at /tmp/CRUSH/index.cgi line 26.
which is probably unrelated to your problem, but it's very bad. Search 
perl.apache.org for hints how to resolve the latter.

__
Stas BekmanJAm_pH --> Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide ---> http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com


Re: [mp2] Child process exited

2003-08-14 Thread Jean-Sebastien Guay
Steve,

> and the good news for you is that I've reproduced your problem.

GREAT! Thank you so much for persevering through this! So do you have a
traceback or some info that the developers might be able to use to track
this down?

> The "variable will not stay shared" error is a common problem with
> mod_perl scripts that have file-scope lexical variables in them which
> subroutines access.

I know, Stas alerted me to those and I fixed them in my local version.


Thanks for reproducing this. A good first step to a resolution. It's
just good to know it probably isn't my setup.

I'll try removing modules from my startup.pl as Randy Kobes suggested,
see if that changes anything.


Again, thank you.

J-S

___
Jean-Sébastien Guay  [EMAIL PROTECTED]
Software Developer, Hybride http://www.hybride.com
Piedmont, Québec, Canada




Re: [mp2] Child process exited

2003-08-14 Thread Randy Kobes
On Wed, 13 Aug 2003, Stas Bekman wrote:

> Jean-Sebastien Guay wrote:
> > Stas,
> >
> > I just checked, and when the Apache crash occurs, nothing gets written
> > to access_log. It would seem that the crash happens before the request
> > is logged.
>
> That's possible, but at least you can see that it's not IE
> that generates some followup request that causes the
> crash, but the original one.
>
> Now you need to get the crash backtrace. You probably need
> to start the server under debugger and get the backtrace
> from there. (don't ask me how to do that on win32 ;)

I'll be back next week, and I could take a look at it
then ... One can get a (mod_perl) backtrace on Win32
by compiling it with MP_DEBUG=1, and when the crash
happens, an option is presented to call up the debugger.

I haven't been able to follow this in detail yet, but
I noticed that Apache::Reload was being used. Does anything
change if this (or any other non-essential modules) aren't
used? In other words, can you pare things down to a working
version, and then start adding things until a crash is
invoked?

-- 
best regards,
randy


Re: [mp2] Child process exited

2003-08-14 Thread Stas Bekman
Jean-Sebastien Guay wrote:
Stas,


One of the following will work.

PerlSwitches -Id:/htdocs

or

PerlSwitches -Mlib=d:/htdocs


Thanks, I'll try those.

But I still don't know

a) why Apache crashes (I know you can't repro, maybe someone else on
Win32 will, so this is stalled for now).
b) why my warnings don't show up in the error_log.
Do you have anything that could help me find the solution to b) ?
I think Randy should be back soon. He will certainly help with win32. It would 
be really nice to have a few more folks helping mod_perl on win32, to get some 
load off Randy. win32 guys, please come out from the lurker shadows and try to 
give your fellas some help.

As for the warnings, even though you can't see them you can fix them. You 
can't have lexical variables in registry scripts that are used in sub-routines 
defined in the same file. I gave you all the URLs to read more on the topic. 
the simplest solution is to turn them into globals (and make sure that they 
are always initialized, which you already do). if you run 5.6.0 and higher 
just s/my/our/; on all top level vars that are used in the subs defined in the 
same file.

__
Stas BekmanJAm_pH --> Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide ---> http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com


Re: [mp2] Child process exited

2003-08-14 Thread Steve Hay
Jean-Sebastien Guay wrote:

Steve,

 

How did you build Apache 2?
   

I downloaded the binaries... Sorry, can't help there.

Please keep me posted as to your progress.
 

OK, I've now got Apache 2 building (with a little off-list help from 
Randy Kobes - the secret is to use the .zip sources rather than the 
.tar.gz sources!), and I've built mod_perl 1.99_09 (not 1.99_10-dev as 
your have) and the good news for you is that I've reproduced your problem.

The bads news is that I haven't solved it, but I'll keep trying and let 
you know if/when I do.

I don't any Application Error popup window, but my NS7.1 browser says 
"The document contained no data", while IE6.0 gives the usual useless 
"The page cannot be displayed" crap that it always does.

I also get nothing in the access.log.

The error.log contained this:

Variable "$template" will not stay shared at 
C:/apache2/perl-bin/index.cgi line 26.
Variable "$vars" will not stay shared at C:/apache2/perl-bin/index.cgi 
line 26.
[Thu Aug 14 10:37:04 2003] [notice] Parent: child process exited with 
status 128 -- Restarting.

The "variable will not stay shared" error is a common problem with 
mod_perl scripts that have file-scope lexical variables in them which 
subroutines access.  My usual solution is to put the main part of the 
program into a block labelled "MAIN:".  That way they can't be "shared" 
to start with, and I have to explicitly pass them into any subroutines 
that require them.  The attached new version of your "index.cgi" does 
this, and makes these errors go away.  I now have just this in the 
error.log:

[Thu Aug 14 10:41:42 2003] [notice] Parent: child process exited with 
status 128 -- Restarting.

The index.cgi program runs fine in a command prompt (with SCRIPT_ROOT 
set in the environment), so its not an obvious TT error.

TTYL,

Steve
#!D:\perl\bin\perl -w
#---
use strict;
use warnings;

use Template;

MAIN: {
#---
my $vars = {
VERSION => 0.75,
};

# Template toolkit config.
my $config = {
INCLUDE_PATH => $ENV{SCRIPT_ROOT},
INTERPOLATE  => 1,  # expand "$var" in plain text
POST_CHOMP   => 1,  # cleanup whitespace
};

my $template = Template->new($config);
#---

print qq[Content-Type: text/html\n\n];

processTemplate($template, 'header.html.tmpl', $vars);

#print qq[Apache should hopefully 
crash...];

print plural('bottle', $_) . " of beer on the wall, " .
  plural('bottle', $_) . " of beer, " .
  "Take one down and pass it around, " .
  plural('bottle', $_ - 1) . " of beer on the wall.\n"
foreach (reverse (1 .. 99));

print qq[];
}

#---
sub processTemplate {
my $template = shift;
my $t_file = shift;
my $vars = shift;
$template->process($t_file, $vars)
or die("Error pressing $t_file: " . $template->error);
}

sub plural {
my ($word, $number) = @_;
return ($number == 0 ? 'no' : $number) .
   " $word" .
   ($number == 1 ? '' : 's');
}


Re: [mp2] Child process exited

2003-08-14 Thread Stas Bekman
Jean-Sebastien Guay wrote:
Stas,

Thanks for trying out my code.


Jean-Sebastien, are you *sure* that what crashes is apache and not
your

client? it seems that you have the client crashing if removing 
changes

everything. What's your error_log says?


My client is IE, and it stays open and responsive after the crash
message. The crash message itself is a dialog box titled "Apache.exe -
Application Error"... That's pretty much a dead giveaway that it isn't
my client that's crashing.
My error_log says:

   [Tue Aug 05 11:10:58 2003] [notice] Parent: child process exited
with status 3221225725 -- Restarting.
   [Tue Aug 05 11:11:00 2003] [notice] Parent: Created child process
1360
so I'm pretty sure it's either Apache or the Perl instance started by
Apache that's crashing. What's more, from the command line and from
normal CGI, the same script (with identical output) runs without any
crash - client or otherwise.
Good, just a sanity check. it sounds silly that changing an html will break 
the server, but anything could happen. Is it possible that the broken(?) html 
makes IE do silly things, that cause the server crash in the afteraction? e.g. 
I'd check the access_log to see whether it issues only one request or more.

Also make sure to debug in the single process (thread?) mode (httpd -X)

BTW, I can't reproduce you problem.


That's bad news. Of course, this may be platform-specific... Did you try
on Win32?
I don't have win32.

Where should I go from here? This is really preventing me from using
mod_perl at all. As I said, the same things run without problems in
normal CGI.
I'm not a win32 person, so I'm not quite sure how you debug things there. But 
what you need to do is to get the server dump the core file, which will tell 
us where exactly it crushes.

Hopefully Randy will come back from vacation soon and will help you out. Or 
may be someone else.

You must run your code with warnings
enabled, add to httpd.conf:
PerlSwitches -wT

and you will see:

Variable "$template" will not stay shared at /tmp/CRUSH/index.cgi line
26.

Variable "$vars" will not stay shared at /tmp/CRUSH/index.cgi line 26.

which is probably unrelated to your problem, but it's very bad. Search
perl.apache.org for hints how to resolve the latter.


Thanks for the hint. I just modified my httpd.conf to include the
PerlSwitches line, and I don't get the same warning messages you do...
(actually I don't get any warning message) Is there a reason for this?
It's possible that some of your code or the modules that you use either misuse 
$^W or trap $SIG{__WARN__} which prevents from warnings to be printed. grep 
for these two things.

whenever you override $^W, this must be done with:

local $^W = $whatever;

so it won't affect other code. same with $SIG{__WARN__} if possible.

I'd suggest that you first get these warnings working and reported, then you 
fix your code to avoid these warnings (with the non-crashing version of the 
template), then move to solve the original problem.

__
Stas BekmanJAm_pH --> Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide ---> http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com


Re: [mp2] Child process exited

2003-08-14 Thread Stas Bekman
Jean-Sebastien Guay wrote:
I'll try to make a small test case so you can try to repro. I think it's
related to DBI (only a hunch), so I'll start there.


Ok, I've got it as simple as I can (I think - 25.1k zip). It isn't related
to DBI, but to template toolkit. So to try my test case, you'll need that
installed.
25k zip? that's a not quite a short test case ;) Can it possibly be 25 lines 
of code instead?

Should I send the zip to the list or to your private address? I'll also
include the short setup instructions.
Most likely someone on win32 will have to try it. If you can put it online 
somewhere and post the URL to it, that will be the best.

__
Stas BekmanJAm_pH --> Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide ---> http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com


Re: [mp2] Child process exited

2003-08-14 Thread Jean-Sebastien Guay
Sorry about the off-list reply Stas, I'm used to mailing lists that put
their own address in the reply-to field of incoming mails...

> How is it possible that IE pops this window, when Apache crashes?

OK, you got me, it isn't IE that pops the message, it only looked that way
because it would appear directly over the IE window. Sorry for the
mistake...

> we need the core backtrace and/or a short script that Randy or someone
else
> can reproduce the problem with on windows. I can try it on linux as well.

I'll try to make a small test case so you can try to repro. I think it's
related to DBI (only a hunch), so I'll start there.

Keep you posted... Thanks

J-S

- Original Message - 
From: "Stas Bekman" <[EMAIL PROTECTED]>
To: "Jean-Sebastien Guay" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Tuesday, August 05, 2003 12:03 PM
Subject: Re: [mp2] Child process exited


> Jean-Sebastien Guay wrote:
> > Hello,
> >
> > I think I've made good steps towards getting my scripts to work
> > (Apache/2.0.47 (Win32) mod_perl/1.99_10-dev Perl/v5.8.0). However, now,
> > when I try to reload one of the pages to test, IE tells me that
> >
> > "The exception unknown software exception (0xc0fd) occured in the
> > application at location 0x2805caa2. Click on OK to terminate the
> > program, Click on CANCEL to debug the program"
>
> How is it possible that IE pops this window, when Apache crashes?
>
> > (in a dialog box with the big red X). This is what I get in my
error_log:
> >
> > [Tue Aug 05 11:10:58 2003] [notice] Parent: child process exited with
> > status 3221225725 -- Restarting.
> > [Tue Aug 05 11:11:00 2003] [notice] Parent: Created child process 1360
> >
> > What could I be doing that would make one of the Apache processes crash?
> > Does anyone have an idea, or should I post code? The same thing happens
> > when I try to telnet into the webserver's port 80 and type "GET
> > /filename.cgi HTTP/1.0". The specific CGI I want to test generates valid
> > HTML if run from the command line.
> >
> > Any ideas? Thanks in advance,
>
> we need the core backtrace and/or a short script that Randy or someone
else
> can reproduce the problem with on windows. I can try it on linux as well.
>
>
> __
> Stas BekmanJAm_pH --> Just Another mod_perl Hacker
> http://stason.org/ mod_perl Guide ---> http://perl.apache.org
> mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
> http://modperlbook.org http://apache.org   http://ticketmaster.com
>
>
>




Re: [mp2] Child process exited

2003-08-14 Thread Stas Bekman
Jean-Sebastien Guay wrote:
Hello,
 
I think I've made good steps towards getting my scripts to work 
(Apache/2.0.47 (Win32) mod_perl/1.99_10-dev Perl/v5.8.0). However, now, 
when I try to reload one of the pages to test, IE tells me that
 
"The exception unknown software exception (0xc0fd) occured in the 
application at location 0x2805caa2. Click on OK to terminate the 
program, Click on CANCEL to debug the program"
How is it possible that IE pops this window, when Apache crashes?

(in a dialog box with the big red X). This is what I get in my error_log:
 
[Tue Aug 05 11:10:58 2003] [notice] Parent: child process exited with 
status 3221225725 -- Restarting.
[Tue Aug 05 11:11:00 2003] [notice] Parent: Created child process 1360
 
What could I be doing that would make one of the Apache processes crash? 
Does anyone have an idea, or should I post code? The same thing happens 
when I try to telnet into the webserver's port 80 and type "GET 
/filename.cgi HTTP/1.0". The specific CGI I want to test generates valid 
HTML if run from the command line.
 
Any ideas? Thanks in advance,
we need the core backtrace and/or a short script that Randy or someone else 
can reproduce the problem with on windows. I can try it on linux as well.

__
Stas BekmanJAm_pH --> Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide ---> http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com


Re: [mp2] Child process exited

2003-08-14 Thread Jean-Sebastien Guay
> I've actually pinpointed the problem to one HTML tag in the output that
> Template-Toolkit sends to Apache as a result of the cgi script's run.

Actually, I've just found out another thing, which is really weird. If I
just change the amount of whitespace in the template file (see the zip file
linked in my last post), I can make Apache crash or not.

Open up the template file, remove the  and  tags, and refresh
the browser. It should display the page with the header. Go back to the
template file, place the cursor right after the  tag (on the same
line), and press enter 3 times. There should be 3 blank lines between the
title tags and the  tag. Refresh the browser. In my case, it crashes.
Also, 1 or 2 empty lines doesn't crash, but 3 or more does.

I'm beginning to think there must be something very wrong with my own code.
I'm almost sure it isn't something with Apache or TT. I must just not be
seeing it.

Thanks for helping,

J-S

___
Jean-Sébastien Guay  [EMAIL PROTECTED]
Software Developer, Hybride http://www.hybride.com
Piedmont, Québec, Canada




Re: [mp2] Child process exited

2003-08-14 Thread Steve Hay
Jean-Sebastien Guay wrote:

Steve,

 

and the good news for you is that I've reproduced your problem.
   

GREAT! Thank you so much for persevering through this! So do you have a
traceback or some info that the developers might be able to use to track
this down?
Not sure how to get a stack backtrace on Windows.  I don't even get the 
Application Error popup window with a "Debug" button inviting me to have 
go :-(

However, I have massively simplified the test program that reproduces 
the problem.

I've moved the template itself in-core rather than processing an 
external file and removed everything else that I could without the 
problem going away.  I found that almost whatever I removed from the 
template -- not just the  tag -- "fixed" it, and I began to wonder 
about the *size* of the template.

So then I replaced the HTML page content with loads of dots, and sure 
enough, the problem goes away if you reduce the number of dots 
sufficiently.  It seems that the program breaks if the template size is 
> 612 bytes, and works if it is <= 612 bytes!  (Try changing $size from 
613 to 612 in getTemplate() to "fix" it!)

Template-Toolkit's Template::Manual::Config manpage says that Perl will 
segfault using the INTERPOLATE option with templates > 32 kB due to 
limitations in Perl's regex engine, and sure enough another way to "fix" 
the attached program is to change "INTERPOLATE => 1" to "INTERPOLATE => 0".

I don't know where the 612 byte limit comes from, but it's certainly not 
Perl itself that has such a small limit -- the program runs fine in CGI 
and mod_perl 1 environments with $size set way higher than 32 kB on my 
machine.

So a temporary fix would appear to be to not use the INTERPOLATE option 
if you can manage without it.

I might have to leave it to Randy for a fuller explanation of where the 
612 bytes limit is creeping in.

Steve
#!perl

use strict;
use warnings;

use Template;

MAIN: {
print qq[Content-Type: text/html\n\n];
processTemplate();
}

sub processTemplate {
my $template = Template->new({ INTERPOLATE => 1 });
my $t_text = getTemplate();
$template->process($t_text)
or die("Error processing template: " . $template->error());
}

sub getTemplate {
my $size = 612;

my $header = '';
my $footer = '';
my $centre = '.' x ($size - length($header) - length($footer));
my $t_text = $header . $centre . $footer;

return \$t_text;
}


Re: [mp2] Child process exited

2003-08-14 Thread Jean-Sebastien Guay
Stas,

Thanks for trying out my code.

> Jean-Sebastien, are you *sure* that what crashes is apache and not
your
> client? it seems that you have the client crashing if removing 
changes
> everything. What's your error_log says?

My client is IE, and it stays open and responsive after the crash
message. The crash message itself is a dialog box titled "Apache.exe -
Application Error"... That's pretty much a dead giveaway that it isn't
my client that's crashing.

My error_log says:

   [Tue Aug 05 11:10:58 2003] [notice] Parent: child process exited
with status 3221225725 -- Restarting.
   [Tue Aug 05 11:11:00 2003] [notice] Parent: Created child process
1360

so I'm pretty sure it's either Apache or the Perl instance started by
Apache that's crashing. What's more, from the command line and from
normal CGI, the same script (with identical output) runs without any
crash - client or otherwise.

> BTW, I can't reproduce you problem.

That's bad news. Of course, this may be platform-specific... Did you try
on Win32?

Where should I go from here? This is really preventing me from using
mod_perl at all. As I said, the same things run without problems in
normal CGI.

> You must run your code with warnings
> enabled, add to httpd.conf:
>
> PerlSwitches -wT
>
> and you will see:
>
> Variable "$template" will not stay shared at /tmp/CRUSH/index.cgi line
26.
> Variable "$vars" will not stay shared at /tmp/CRUSH/index.cgi line 26.
>
> which is probably unrelated to your problem, but it's very bad. Search
> perl.apache.org for hints how to resolve the latter.

Thanks for the hint. I just modified my httpd.conf to include the
PerlSwitches line, and I don't get the same warning messages you do...
(actually I don't get any warning message) Is there a reason for this?


So what do I do now? For now, I'm continuing development of my
applications under normal CGI, but I'd really like to see them work
under mod_perl...

Anyways, thanks for you help.

J-S

___
Jean-Sébastien Guay  [EMAIL PROTECTED]
Software Developer, Hybride http://www.hybride.com
Piedmont, Québec, Canada




Re: [mp2] Child process exited

2003-08-14 Thread Jean-Sebastien Guay
Stas,

> One of the following will work.
>
> PerlSwitches -Id:/htdocs
>
> or
>
> PerlSwitches -Mlib=d:/htdocs

Thanks, I'll try those.


But I still don't know

a) why Apache crashes (I know you can't repro, maybe someone else on
Win32 will, so this is stalled for now).
b) why my warnings don't show up in the error_log.

Do you have anything that could help me find the solution to b) ?


Thanks,

J-S




Re: [mp2] Child process exited

2003-08-14 Thread Stas Bekman
Jean-Sebastien Guay wrote:
Stas,

I just checked, and when the Apache crash occurs, nothing gets written
to access_log. It would seem that the crash happens before the request
is logged.
That's possible, but at least you can see that it's not IE that generates some 
followup request that causes the crash, but the original one.

Now you need to get the crash backtrace. You probably need to start the server 
under debugger and get the backtrace from there. (don't ask me how to do that 
on win32 ;)

b) why my warnings don't show up in the error_log.


I just moved my mod_perl config from httpd.conf to another file,
mod_perl.conf, and Include that in httpd.conf. (I did that so that I
don't have to comment the whole section for mod_perl when I want to
deactivate it, I just have to comment the Include line).
Now, magically, the warnings and the Apache::Reload debug messages show
up in my error_log! The only other thing I changed between now and
before is that I added the "PerlSwitches -Id:/htdocs" directive. But
that should have no influence on whether warnings are written to the
error_log or not...
What's happening? Is my whole Apache setup whacked? Maybe I should
reinstall Apache and mod_perl?
I can't tell, may be you have cleaned up some things on the way. e.g. you 
could do something that would cause the logs to be written into a different 
log file.

__
Stas BekmanJAm_pH --> Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide ---> http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com


Re: [mp2] Child process exited

2003-08-14 Thread Jean-Sebastien Guay
Steve,

> I found that almost whatever I removed from the
> template -- not just the  tag -- "fixed" it, and I began to
wonder
> about the *size* of the template.

That's what I was wondering too when I reported that just adding 3 line
breaks somewhere in the file "broke" it, and removing them "fixed" it. I
would never have thought that such a small template would break based on
size, though, since I have much larger templates in production using
normal CGI, which work fine. (the largest template is ~20k and the
average is ~6k).

Again, I'll have to remind myself to "never assume"... I kept on telling
myself, "Nah, it can't be the size of the template file...". Thanks a
lot for your troubleshooting, Steve.

> So a temporary fix would appear to be to not use the INTERPOLATE
option
> if you can manage without it.

Good call, that's what I'll do for now. Most of my templates don't need
it. I'll start with that.

> I might have to leave it to Randy for a fuller explanation of where
the
> 612 bytes limit is creeping in.

Looking forward to that.


J-S

___
Jean-Sébastien Guay  [EMAIL PROTECTED]
Software Developer, Hybride http://www.hybride.com
Piedmont, Québec, Canada




Re: [mp2] Child process exited

2003-08-14 Thread Jean-Sebastien Guay
I said, in my last message:
> I'll try removing modules from my startup.pl as Randy Kobes suggested,
> see if that changes anything.

It doesn't. I removed Apache::Reload from my httpd.conf, and put an
empty startup.pl instead of my real one (this one just returns 1;
nothing else) and it still crashes.

J-S

___
Jean-Sébastien Guay  [EMAIL PROTECTED]
Software Developer, Hybride http://www.hybride.com
Piedmont, Québec, Canada




Re: [mp2] Child process exited

2003-08-12 Thread Jean-Sebastien Guay
So, did anyone have time to check this out? This is pretty major for me,
I can't implement mod_perl at my site until I find out what is causing
this crash and fix it. And I really have no idea what could be causing
it.

I'm using CGI.pm 2.98, Template-Toolkit 2.10, Apache/2.0.47 (Win32)
mod_perl/1.99_10-dev Perl/v5.8.0.

So please, if someone on a similar setup could download the test case at
http://pages.infinit.net/jeans13/ApacheCrash.zip and see if the crash
happens for them too... Remember to read the README file first...

Thanks,

J-S

- Original Message - 
From: "Jean-Sebastien Guay" <[EMAIL PROTECTED]>
To: "Stas Bekman" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Friday, August 08, 2003 1:13 PM
Subject: Re: [mp2] Child process exited


> > >>Is it only mp2 that it fails under?
> > >>I've tried it under mp1.28/perl5.8.0/apache1.3.27 on WinXP and it
> runs
> > >
> > > fine.
> > >
> > > I haven't tried other mod_perl versions, since the threading issue
> would
> > > render the site unusable.
> >
> > so I assume that there is no point trying it on linux, if Steve
can't
> see it
> > on win. right?
>
> Not at all, Steve didn't see it on Windows with *another* version of
> mod_perl... I'm using 1.99_10, he was using 1.28. So if you can test
> under Linux with 1.99_10, it might have the same problem.
>
> And if someone else on Windows could test with 1.99_10 as well, I
would
> be grateful.
>
> Thanks,
>
> J-S
>
> ___
> Jean-Sébastien Guay  [EMAIL PROTECTED]
> Software Developer, Hybride http://www.hybride.com
> Piedmont, Québec, Canada
>
>
>
>




Re: [mp2] Child process exited

2003-08-10 Thread Jean-Sebastien Guay
> Is it only mp2 that it fails under?
> I've tried it under mp1.28/perl5.8.0/apache1.3.27 on WinXP and it runs
fine.

I haven't tried other mod_perl versions, since the threading issue would
render the site unusable.

> What version of Template-Toolkit do you have?  It's worth ensuring
that
> you're running the latest version (2.10, I think) if you suspect that
it
> might be involved in the problem.

Yep, I have 2.10.

Nevertheless, thanks a lot for trying it. :-)

J-S




Re: [mp2] Child process exited

2003-08-07 Thread Jean-Sebastien Guay
So, has anyone checked out my test case? Any results (good or bad)?

As I said in my last post, I'm getting this for differing amounts of
whitespace in my template files, so it isn't just one tag to be removed
everywhere. I have something like 30 template files, most of them much
more complex than the one in the test case, so it would take a real long
time to go through each one, trying to get them to work by trial and
error. So I can't really do anything until I know what causes this and
how to work around it.

Looking forward to getting this working... Thanks

J-S

___
Jean-Sébastien Guay  [EMAIL PROTECTED]
Software Developer, Hybride http://www.hybride.com
Piedmont, Québec, Canada




Re: [mp2] Child process exited

2003-08-06 Thread Jean-Sebastien Guay
> 25k zip? that's a not quite a short test case ;) Can it possibly be 25
lines
> of code instead?

You're absolutely right, I've pared it down a lot while waiting for your
answer. I was trying to get my test case to you as fast as possible, that's
why I didn't spend that much time on it before. It's still not quite 25
lines, but it's much shorter.

I've actually pinpointed the problem to one HTML tag in the output that
Template-Toolkit sends to Apache as a result of the cgi script's run. But I
still prefer giving you (or whomever will try this) the code so they can see
for themselves. It's about 3k now... :-)

> Most likely someone on win32 will have to try it. If you can put it online
> somewhere and post the URL to it, that will be the best.

OK, it's at http://whitestar02.webhop.org/Files/ApacheCrash.zip . Please go
easy on the server, it's on a residential cable line...

Inside, you'll find a simple CGI script (50 lines), one template file (26
lines) and a README (123 lines). Considering the readme file is the biggest
of the bunch, and that you can determine if the server crashes or not by
removing 4 tags in the template file, I think it's pretty stripped down.

Please read the README before trying to run it. In it, you'll find details
on my config and a short discussion of what happens in the various cases I
tried. Note that since I found the tags that cause the problem, I can
continue to work without them, but I'd still like to know why it crashes on
a script that ran perfectly in straight CGI.

Thanks a lot for trying to get this sorted.

J-S

___
Jean-Sébastien Guay  [EMAIL PROTECTED]
Software Developer, Hybride http://www.hybride.com
Piedmont, Québec, Canada




[mp2] Child process exited

2003-08-05 Thread Jean-Sebastien Guay



Hello,
 
I think I've made good steps towards getting my 
scripts to work (Apache/2.0.47 (Win32) mod_perl/1.99_10-dev Perl/v5.8.0). 
However, now, when I try to reload one of the pages to test, IE tells me that 

 
"The exception unknown software exception 
(0xc0fd) occured in the application at location 0x2805caa2. Click on OK to 
terminate the program, Click on CANCEL to debug the program" 
 
(in a dialog box with the big red X). This is what I get in my error_log:
 
[Tue Aug 05 11:10:58 2003] [notice] Parent: child 
process exited with status 3221225725 -- Restarting.[Tue Aug 05 11:11:00 
2003] [notice] Parent: Created child process 1360
 
What could I be doing that would make one of the 
Apache processes crash? Does anyone have an idea, or should I post code? The 
same thing happens when I try to telnet into the webserver's port 80 and type 
"GET /filename.cgi HTTP/1.0". The specific CGI I want to test generates valid 
HTML if run from the command line.
 
Any ideas? Thanks in advance,
 
J-S
 
___Jean-Sébastien 
Guay  
[EMAIL PROTECTED]Software 
Developer, Hybride http://www.hybride.comPiedmont, Québec, 
Canada