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 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 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 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: Problem reloading modules

2003-08-14 Thread Jean-Sebastien Guay
> However, there will always be things that Apache::Reload doesn't
> handle.  For example, you might import functions from one module into
> another module, as opposed to importing into a Registry script.

Well, making a given module aware of who imported it (whether it's a
module or a Registry script) would solve that. But again, I don't know
how complicated that would be; I'll have to read up when I try doing it.


> My
> advice is to avoid importing things at all, but I know that many
people
> really love importing and will not want to give it up.

I'm one of them, at least with our present module hierarchy. But I
understand your point of view too.


J-S




Re: Problem reloading modules

2003-08-14 Thread Jean-Sebastien Guay
> How can you tell?  Can you post some sample code?  You might be doing
> something that doesn't work when reloaded, like closures.

Well, here's the code I'm trying to run. (I have verified that
Param('script_root') returns D:/htdocs, as expected). The initial code
was this:

<===>
sub getImage {
my ($project, $shotprefix, $shot) = @_;

$shot =~ s/\./_/;

my $image = Param('script_root') . '/' .
"images/$project/$shotprefix/$shot.jpg";

# Check if the shot-specific image exists
if (!-e $image) {
# If not, use the generic image
$image = Param('script_root') . '/' .
"images/$project/generic.jpg";

if (!-e $image) {
$image = Param('script_root') . '/' . "images/no_image.gif";
}
}

warn "-- image is $image";
return $image;
}
<===>

I changed it to this:

<===>
sub getImage {
my ($project, $shotprefix, $shot) = @_;

$shot =~ s/\./_/;

my $image = "images/$project/$shotprefix/$shot.jpg";

# Check if the shot-specific image exists
if (!-e Param('script_root') . '/' . $image) {
# If not, use the generic image
$image = "images/$project/generic.jpg";

if (!-e Param('script_root') . '/' . $image) {
$image = "images/no_image.gif";
}
}

warn "-- image is $image";
return $image;
}
<===>

The first piece of code would see that, for example,
"D:/htdocs/images/project/prefix/bob.jpg" exists, and return that whole
string.

The second piece of code would see that
"D:/htdocs/images/project/prefix/bob.jpg" exists but only return
"images/project/prefix/bob.jpg". That's what I want.

And I can see in the error_log that $image is still the absolute path
("D:/htdocs/images/project/prefix/bob.jpg" in our example) even after
the change.


J-S




Re: Problem reloading modules

2003-08-14 Thread Jean-Sebastien Guay
Hi Perrin,

> I don't see anything wrong with that chunk of code.  If you restart
the
> server, does it pick up the change?

Yes.


> Is there anything unusual about the
> way you call this sub (AUTOLOAD, function ref, etc.)?

Not at all. It is imported with

use Hybride::Projects qw(getImage );

and the file in which the sub is located is called Projects.pm, in a
directory Hybride, whose parent directory (D:/htdocs) is added to my
@INC by using 'use libs qw(D:/htdocs)' in my startup.pl file AND
'PerlSwitches -ID:/htdocs' in my httpd.conf (I just wanted to make
sure... :-). I can see with perl-status that my @INC is correctly set to
pick up the module, and that the module itself is listed in %INC with
its absolute path on my filesystem, so that should be right.

I get this in my error_log when I refresh the page that runs the CGI
script that uses the sub:

Apache::Reload: Checking mtime of Hybride/Projects.pm
Subroutine listProjects redefined at D:/htdocs/Hybride/Projects.pm line
33.
Subroutine validProject redefined at D:/htdocs/Hybride/Projects.pm line
49.
Subroutine getImage redefined at D:/htdocs/Hybride/Projects.pm line 68.
Subroutine getProjectAbbreviation redefined at
D:/htdocs/Hybride/Projects.pm line 92.
Apache::Reload: process 2392 reloading Hybride/Projects.pm

I believe those warnings are normal since the module is being reloaded
and the subs are being replaced in memory, right? So that tells me that
the module is reloaded. However, the old code is still being used.


> However, your code here looks pretty vanilla and seems like
> it should be working fine with Reload.

I agree. Is there anything else I can check to make sure I'm not missing
anything obvious?


Thank you,

J-S




Re: Problem reloading modules

2003-08-14 Thread Jean-Sebastien Guay
Stas Bekman wrote:
> > OK, I've written a proper entry for the man page, Jean-Sebastien can
you
> > please verify that it all works, as I wrote it without testing.

Great work Stas, you're quick :-)  Other than the little mistake Perrin
pointed out, the suggested change works.


Perrin Harkins wrote:
> If you're interested
> in working on it, we could discuss possible approaches on the list and
> review your patch.

In a week or so I'll have a bit more free time, and I might try
implementing it. I'll start by reading up on mod_perl internals... :-)


Thanks for your help,

J-S




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 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: Problem reloading modules

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

> Apache::Registry?  Just do a touch on the script file and Registry
will
> reload it.

OK, thanks.

> You could hack your own Apache::RegistryNG subclass that
> would just reload everything when Apache::Reload triggers, but it's
> probably not worth it.

Could something in Apache::Registry be implemented to integrate it
better with Apache::Reload? Something along the lines of keeping track
of which modules a certain script use()s, and at request time, checking
if Apache::Reload has reloaded one of those since the last request and
if so, reload the script itself? That would remove the confusion, and
make Apache::Reload's work more transparent, IMO.


Anyways, for now I will do it as you suggested. Once more, thanks for
the help.

J-S




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: Problem reloading modules

2003-08-14 Thread Jean-Sebastien Guay
> I'm asking you to try it and see if it works.

Ok, I tried it and it works.


> A possible solution if that is the problem is to make all the modules
> that import it reload as well.  You can do that with a touch file.

The file that imports it is not a module, it's the actual script. No
other file (that is running currently) needs that sub. Can I get
Apache::Reload to reload the script itself?


Thanks for your help,

J-S




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 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




Problem reloading modules

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

I know this has been discussed before, but I can't seem to find the
information I need to solve my problem.

I'm using Apache::Reload, and I can see that my modified module is
getting reloaded (with ReloadDebug On), but the program still uses the
old code.

I have read
http://perl.apache.org/docs/2.0/api/Apache/Reload.html#Problems_With_Reloading_Modules_Which_Do_Not_Declare_Their_Package_Name
but all my modules declare their package names. I have also checked,
using the perl-status Apache module, and all my modules are in %INC with
absolute paths, not relative ones.

I have also checked, and nothing in
http://perl.apache.org/docs/1.0/guide/porting.html#Using_Apache__Reload
seems to resolve the problem.

What else should I check?

Thanks in advance,

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: Problem reloading modules

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

> > use Hybride::Projects qw(getImage );
>
> I think that's the problem.  You are creating an alias to the sub
here,
> and when it gets reloaded the alias is still pointing to an old
version.

Actually, I just saw that the sub is exported in the EXPORT section of
the Projects module, not the EXPORT_OK section, and is imported with

use Hybride::Projects;

Sorry about that, my mistake... But the sub is still not getting
reloaded.


> Try doing a fully-qualified sub call instead of importing.

Err, that would actually be a pretty massive change to my codebase.
Changing all the  calls to Hybride::Module:: would be
a pain, not to mention too much typing. There has to be another
solution, isn't there?


Thanks,

J-S




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: How to pass parameters from the UNIX command line ?

2003-08-09 Thread Jean-Sebastien Guay
> > http://server.domain.com/cgi-bin/MyProcedure.pl?cust_id=x
> >
> > I'd like to make a cron job to source the above PERL script as from
> > the command line to resemble something like:
> >
> > perl /usr/local/apache/cgi-bin/MyProcedure.pl   << need to pass the
> > parameter here as cust_id=x
>
> [...]
> Or use GET from the commandline with the uri behind it. This
> makes it a proper request to your webserver, issued from the command-
> line (or crontab in this case).

Or 'lynx -source
http://server.domain.com/cgi-bin/MyProcedure.pl?cust_id=x'

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-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


Re: Current directory

2003-08-04 Thread Jean-Sebastien Guay
> On Mon, 2003-08-04 at 12:08, Jean-Sebastien Guay wrote:
> > Doesn't all this require that I actually get a running Apache server
> > first? The error message shows up when I try to start up the Apache
> > service!
>
> What?  That shouldn't happen unless something is calling CGI->new in
> your startup, which is a bad thing to do.  Maybe some script you're
> loading is doing that.  Try to figure out what's doing it.

You're absolutely right... Shame on me. The first homegrown module I was
importing did exactly that. It would try to get the user cookie right on
use(), which of course isn't very good practice. So I've modified it to get
it on first call of a certain method, and to return that same value on
subsequent calls.

Geez...

Now I have to transition all my scripts and other modules to mod_perl. Where
could I find examples of real-life conversion between normal CGI and
mod_perl? (Other than the perl.apache.org docs, which even though they're
great, lack real examples of what needs to be done for the really ugly types
of code...)

Thanks for bearing with me through this...

J-S

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




Re: Current directory

2003-08-04 Thread Jean-Sebastien Guay



Perrin,
 
> First, check your conf file to be sure you 
have this turned on.  There> are docs related to it here:> 
http://perl.apache.org/docs/2.0/user/config/config.html#C_GlobalRequest_
The docs also state that unless it's explicitly 
turned _off_, it's on by default. But I turned it on anyways before I sent my 
last message. Here's the relevant section of my httpd.conf:
 


 begin 

 
LoadModule perl_module 
modules/mod_perl.soLoadFile "D:/Perl/bin/perl58.dll"
 
PerlModule Apache2PerlSetEnv 
SCRIPT_ROOT "D:/htdocs"PerlRequire "D:/htdocs/_startup.pl"
 
   SetHandler 
perl-script PerlResponseHandler 
ModPerl::Registry Options 
+ExecCGI PerlOptions +ParseHeaders 
+GlobalRequest  
 end 

 
And here's my _startup.pl script:
 
 begin 

 
#---# 
Default module inclusions as per the Apache# mod_perl installation 
instructionsuse 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 modulesuse Time::localtime;use Data::Dumper;use Date::Calc 
qw(:all);
 
#---# 
Hybride modules
 
# Add the top-level directory for the 
modules into the module search path.use lib qw(D:/htdocs);
# ... ... The modules I want to pre-load 
are currently all commented out, until  
# ... ... I get a running server to test 
them one at a time...
 
 end 

 
> You can test it by writing a little handler 
(or Registry script) that> calls Apache->request().  That should 
return an Apache::RequestRec> object if all is well.  If it doesn't, 
you may have an old mod_perl 2> build or you may have found a 
bug.> > If you can't get that to work, there is also the direct 
approach which> is to pass a RequestRec object to CGI.pm when you call 
the new()> method.  Registry scripts get a RequestRec object passed 
to them as> their first param, so you can just shift it into a variable 
(usually> called $r) and pass it as CGI->new($r).
Doesn't all this require that I actually get a 
running Apache server first? The error message shows up when I try to start up 
the Apache service! As I understand it, the 
_startup.pl script tries to require() CGI.pm, which gives the error message. So 
I never get a running Apache instance to run any scripts in.
 
If there's anything else I can try, or if you see 
anything in the above config files, please let me know. Thanks for your patience 
on this...
 
J-S
 
___Jean-Sébastien 
Guay  
[EMAIL PROTECTED]Software 
Developer, Hybride http://www.hybride.comPiedmont, Québec, 
Canada
 


Re: Current directory

2003-08-04 Thread Jean-Sebastien Guay
BTW,

> perl -MCGI -e "print $CGI::VERSION;"
2.98

J-S

- Original Message - 
From: "Jean-Sebastien Guay" <[EMAIL PROTECTED]>
To: "Randy Kobes" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Monday, August 04, 2003 9:32 AM
Subject: Re: Current directory


> > One way is to configure the CPAN module:
> >C:\> perl -MCPAN -e shell
> > which, the first time you invoke it, will lead you through
> > a dialogue. You can accept most of the defaults, except
> > for the list of CPAN mirrors to use. Then, at the
> > CPAN.pm shell prompt, you can say
> >   cpan> install CGI
>
> Thanks for answering Randy, but I got a working PPM module of CGI for
HP-UX
> and modified the module's description files to make PPM think it's for
> Win32. Since it's just Perl code, and not XS, should work. If anyone wants
> this PPM, I can make it available. Though it would be more useful on a
known
> repository.
>
> But I still get the same message...
>
> > [Mon Aug 04 09:31:57 2003] [error] Global $r object is not available.
Set:
> > PerlOptions +GlobalRequest
> > in httpd.conf at D:/Perl/lib/CGI.pm line 307.
> > Compilation failed in require at D:/htdocs/_startup.pl line 33.
>
> Is there anything else I can check other than the CGI.pm version?
>
>
>
>




Re: Current directory

2003-08-04 Thread Jean-Sebastien Guay
> One way is to configure the CPAN module:
>C:\> perl -MCPAN -e shell
> which, the first time you invoke it, will lead you through
> a dialogue. You can accept most of the defaults, except
> for the list of CPAN mirrors to use. Then, at the
> CPAN.pm shell prompt, you can say
>   cpan> install CGI

Thanks for answering Randy, but I got a working PPM module of CGI for HP-UX
and modified the module's description files to make PPM think it's for
Win32. Since it's just Perl code, and not XS, should work. If anyone wants
this PPM, I can make it available. Though it would be more useful on a known
repository.

But I still get the same message...

> [Mon Aug 04 09:31:57 2003] [error] Global $r object is not available. Set:
> PerlOptions +GlobalRequest
> in httpd.conf at D:/Perl/lib/CGI.pm line 307.
> Compilation failed in require at D:/htdocs/_startup.pl line 33.

Is there anything else I can check other than the CGI.pm version?




Re: uwinnipeg site down (ppm installation)?

2003-08-01 Thread Jean-Sebastien Guay
> I've copied the ppm packages
> also over to http://perl.apache.org/dist/win32-bin/, so
> they can also be accessed there.

Great, always good to have mirrors.

J-S



Re: Current directory

2003-08-01 Thread Jean-Sebastien Guay
Hi Perrin,

Thanks for both your answers. Indeed, for the other question, I was using
CGI 2.91 instead of 2.93 (because that one isn't yet available for Perl 5.8
via PPM). I'll find a way to upgrade it.

> There are dozens of possible answers to this.
...
> There are also common approaches like passing some kind of application
> root either in an environment variable or in httpd.conf with a
> PerlSetVar.

Unfortunately, this doesn't seem to work. Even if I put the PerlSetVar
statement before my PerlRequire statement like so:

PerlSetVar SCRIPT_ROOT "D:/htdocs"
PerlRequire "D:/htdocs/_startup.pl"

the module, which is then loaded from _startup.pl, sees only undef when I
try to print $ENV{SCRIPT_ROOT}; ... I also tried to do this right before
use()ing my module:

$ENV{SCRIPT_ROOT} = 'D:/htdocs';

and it gives the same result. Could the problem come from the fact that
_startup.pl is trying to load the module before Apache is actually finished
loading, so the environment is not in a valid state at that point? What else
could cause this?

Thanks,

J-S

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




Current directory

2003-08-01 Thread Jean-Sebastien Guay



Hello again,
 
I have another problem trying to get one of my Perl 
modules to load in my startup.pl script for the first time. In a couple places 
in my scripts, I assume that the current directory is the one in which the 
current script is being run. So for example, if my DocumentRoot is D:/htdocs/ 
and someone requests http://myhostname/script.cgi, if I need 
to use some files, my current directory is D:/htdocs.
 
The two things I currently do this for 
are
a) configuration file, which is loaded on startup 
by the module I am trying to get loaded in my startup.pl script
b) templates (for template-toolkit), which I 
specify to be in the directory 'templates' relative to the location where the 
scripts are running, meaning they are in D:/htdocs/templates.
 
I see only disadvantages to having to specify 
absolute paths in both these cases. For one, I have another web server running 
on port 8080, which I use to test my scripts on, and whose DocumentRoot is 
D:/htdocs-dev. So if I had to manually change the paths each time I copied files 
over from the development DocumentRoot to the production one, I would go 
crazy.
 
Is there a way to guarantee that the current 
directory will be the correct one when I need it to? Or does anyone have another 
suggestion? 
 
Thanks!
 
J-S
 
___Jean-Sébastien 
Guay  
[EMAIL PROTECTED]Software 
Developer, Hybride http://www.hybride.comPiedmont, Québec, 
Canada


GlobalRequest

2003-08-01 Thread Jean-Sebastien Guay



Hello,
 
I'm fairly new at mod_perl, and trying to get a 
large number of existing Perl CGI scripts to run on it. I have started by trying 
to start the server with a minimal startup.pl file that just loads one of my 
custom modules (in addition to the ones that were suggested in the mod_perl 
configuration docs). I get this error:
 
[Fri Aug 01 13:49:05 2003] [error] Global 
$r object is not available. Set:    
PerlOptions +GlobalRequestin httpd.conf at D:/Perl/lib/CGI.pm line 
269.Compilation failed in require at D:/htdocs/startup.pl line 32.BEGIN 
failed--compilation aborted at D:/htdocs/startup.pl line 32.Compilation 
failed in require at (eval 1) line 1.
 
[Fri Aug 01 13:49:05 2003] [error] Can't 
load Perl file: D:/htdocs/startup.pl forserver bob.bob.com:80, 
exiting...
 
(of course, startup.pl line 32 is the line where I 
use() my own module) 
Now, from reading the docs (http://perl.apache.org/docs/2.0/user/config/config.html#toc_C_GlobalRequest_), 
I saw : 
 
This setting is enabled by default for sections configured as:
  
  SetHandler perl-script
  ...
  
Which is my case. And even if I 
add +GlobalRequest to the PerlOptions line in my mod_perl Location section, 
I get the same error. Is there anything else I need to do?
 
 
Thanks in advance,
 
J-S
 
 
___Jean-Sébastien 
Guay  
[EMAIL PROTECTED]Software 
Developer, Hybride http://www.hybride.comPiedmont, Québec, 
Canada


Re: uwinnipeg site down (ppm installation)?

2003-08-01 Thread Jean-Sebastien Guay
> Sorry about this - I had a hard disc crash, and am just in
> the process of restoring things. Computers are getting too
> smart - they know when you're vulnerable, and will act
> accordingly ... Hopefully it'll be ready in a day.

Great job Randy! Got mod_perl installed, so I can now start bashing my code
to see how much punishment it needs before agreeing to run on it! :-)

Thanks!

J-S




Re: uwinnipeg site down (ppm installation)?

2003-08-01 Thread Jean-Sebastien Guay
> Sorry about this - I had a hard disc crash, and am just in
> the process of restoring things. Computers are getting too
> smart - they know when you're vulnerable, and will act
> accordingly ... Hopefully it'll be ready in a day.

No worries, things like these happen.

In the mean time, do you know of a mirror where I could get the files? I'm
trying to get mod_perl installed and get all the web scripts we have here
working on it, and I would like to be able to work on it today if
possible...

If not, I'll wait until Monday, no problem.

Thanks,

J-S

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




Re: uwinnipeg site down (ppm installation)?

2003-07-31 Thread Jean-Sebastien Guay



Ok, now the site seems to be back up (it responds 
to pings, whereas it didn't before) but trying to add it to ppm gives 
this:
 
ppm> rep add Apache http://theoryx5.uwinnipeg.ca/cgi-bin/ppmserver?urn:/PPMServer58Error: Unexpected Content-Type '' 
returned
 
Does anyone know of a mirror? please? 
:-)
 
J-S
 

  - Original Message - 
  From: 
  Jean-Sebastien Guay 
  To: [EMAIL PROTECTED] 
  Sent: Thursday, July 31, 2003 1:22 
  PM
  Subject: uwinnipeg site down (ppm 
  installation)?
  
  Hello,
   
  I am trying to install mod_perl 2 (1.99_10) 
  from the http://theoryx5.uwinnipeg.ca/ppms/ site, but it 
  seems to be down. Could anyone point me to a mirror or send me the necessary 
  files off-list? It would be very appreciated, since I am in something of a 
  hurry.
   
  BTW, I am looking forward to using mod_perl and 
  asking+answering questions on this list.
   
  Thanks in advance,
   
  J-S
   
  ___Jean-Sébastien 
  Guay  
  [EMAIL PROTECTED]Software Developer, 
  Hybride http://www.hybride.comPiedmont, Québec, 
  Canada


uwinnipeg site down (ppm installation)?

2003-07-31 Thread Jean-Sebastien Guay



Hello,
 
I am trying to install mod_perl 2 (1.99_10) 
from the http://theoryx5.uwinnipeg.ca/ppms/ site, but it 
seems to be down. Could anyone point me to a mirror or send me the necessary 
files off-list? It would be very appreciated, since I am in something of a 
hurry.
 
BTW, I am looking forward to using mod_perl and 
asking+answering questions on this list.
 
Thanks in advance,
 
J-S
 
___Jean-Sébastien 
Guay  
[EMAIL PROTECTED]Software Developer, 
Hybride http://www.hybride.comPiedmont, Québec, 
Canada