You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Todd Finney <tf...@boygenius.com> on 2007/07/03 20:11:19 UTC

script runs from command line and as CGI, not under ePerl/mod_perl

I'm using Business::Shipping to pull rate information from the USPS site 
for our online stores.  This is nothing new, I've been doing this for a 
long time on another server without a hitch.

I have a test script that Dan Browning (author of Business::Shipping) gave 
me.  It runs just fine as a command line script and as a cgi script, and 
gives the expected result.

Source: [http://heavy.boygenius.com/temp/test_cgi.txt]

Result: [http://heavy.boygenius.com/temp/test.cgi]

However, when I take the same script and run it in my Apache/ePerl 
environment, it fails with no errors, no output, no nothing.

Source: [http://heavy.boygenius.com/temp/test_phtml.txt]
(I needed to shut off warnings to eliminate subroutine redefined warnings)

Result: [http://heavy.boygenius.com/temp/test.phtml]

That should sit for a while, then reward you with a plain white screen.  I 
get nothing in the server error logs, and nothing in the B::S logs.

When I su to the web user and run the phtml file through the eperl parser 
via the command line ("eperl -B '<?' -E '!>' test.phtml"), it works just fine.

All of the other phtml files on the server - and there are a lot of them - 
work as expected.

This is running on a fresh debian sarge box using a locally compiled Apache 
1.3.37 and mod_perl.  The ePerl instance was installed via CPAN.  I use 
this same setup on all of my servers, and I've never had a problem like 
this before.

If anyone could offer some advice on what might be happening here, I'd 
really appreciate it.

thanks,
Todd

  


Re: script runs from command line and as CGI, not under ePerl/mod_perl

Posted by Todd Finney <tf...@boygenius.com>.
At 03:39 PM 7/6/2007 -0400, Perrin Harkins wrote:
>   It seems to be a problem between
>Business::Shipping and the perl that mod_perl is using.  It may
>actually be an issue with an SSL socket library that
>Business::Shipping uses.

We've all had this conversation at some point in our careers:

"Hey, my X is [broken/fixed/on fire/lodged in a bus full of orphans]."

"What did you change?"

"Golly, I didn't change anything, honest."

"Sure."

Well, I don't know what I changed, but something's different.   I attempted 
to recompile Apache and mod_perl with debugging flags turned on, failed 
miserably, and went back and recompiled both per my standard 
procedure.  After doing this, I found that the test handler mysteriously 
started working.

So, I don't know what just happened there, but thank you for your help.  I 
really appreciate it.

Todd


Re: script runs from command line and as CGI, not under ePerl/mod_perl

Posted by Perrin Harkins <pe...@elem.com>.
On 7/5/07, Todd Finney <tf...@boygenius.com> wrote:
> With due respect, Perrin, I disagree with the (common, unfortunately)
> belief that a lack of an active release cycle indicates that a package is
> somehow unsuitable.  Sometimes, that just means that it's done.

Sure, but the real problem is that no one else is using it anymore, so
it's hard to get help with it.

> If I comment out the line '$rate_request->submit() or die
> $rate_request->user_error();', I get the hello world output as
> expected.  If I do not comment out that line, I get no output, and my logs
> say this:
>
> [Thu Jul  5 15:38:06 2007] [notice] Apache/1.3.37 (Unix) PHP/4.4.7
> mod_perl/1.30 configured -- resuming normal operations
> [Thu Jul  5 15:38:06 2007] [notice] Accept mutex: sysvsem (Default: sysvsem)
> [Thu Jul  5 15:38:13 2007] [notice] child pid 1013 exit signal Segmentation
> fault (11)

If you can get a stacktrace, someone may be able to help you find
where the problem is.  My shot in the dark is that you either upgraded
perl and didn't recompile something, or mod_perl is not using the same
perl that ePerl is.  It seems to be a problem between
Business::Shipping and the perl that mod_perl is using.  It may
actually be an issue with an SSL socket library that
Business::Shipping uses.

- Perrin

Re: script runs from command line and as CGI, not under ePerl/mod_perl

Posted by Todd Finney <tf...@boygenius.com>.
At 01:38 AM 7/5/2007 -0400, Perrin Harkins wrote:
>Well, the root of your problem is that you're using ePerl.  I haven't
>seen that one in a long time, and I doubt it gets any support releases
>these days.  I also doubt anyone on the list at this point has ever
>used it.  It's just too old.  Time to look at some newer tools, if you
>want to use something that the community can help you with.

With due respect, Perrin, I disagree with the (common, unfortunately) 
belief that a lack of an active release cycle indicates that a package is 
somehow unsuitable.  Sometimes, that just means that it's done.

That said, removing ePerl from the equation is trivial:

[http://heavy.boygenius.com/temp/TestShippingHandler.pm.txt]

[http://heavy.boygenius.com/hello/world]

If I comment out the line '$rate_request->submit() or die 
$rate_request->user_error();', I get the hello world output as 
expected.  If I do not comment out that line, I get no output, and my logs 
say this:

[Thu Jul  5 15:38:06 2007] [notice] Apache/1.3.37 (Unix) PHP/4.4.7 
mod_perl/1.30 configured -- resuming normal operations
[Thu Jul  5 15:38:06 2007] [notice] Accept mutex: sysvsem (Default: sysvsem)
[Thu Jul  5 15:38:13 2007] [notice] child pid 1013 exit signal Segmentation 
fault (11)
[Thu Jul  5 15:38:14 2007] [notice] child pid 1014 exit signal Segmentation 
fault (11)
[Thu Jul  5 15:38:15 2007] [notice] child pid 1015 exit signal Segmentation 
fault (11)
[Thu Jul  5 15:38:17 2007] [notice] child pid 1017 exit signal Segmentation 
fault (11)
[Thu Jul  5 15:38:18 2007] [notice] child pid 1018 exit signal Segmentation 
fault (11)
[Thu Jul  5 15:38:20 2007] [notice] child pid 1019 exit signal Segmentation 
fault (11)
[Thu Jul  5 15:38:21 2007] [notice] child pid 1020 exit signal Segmentation 
fault (11)
[Thu Jul  5 15:38:22 2007] [notice] child pid 1021 exit signal Segmentation 
fault (11)
[Thu Jul  5 15:38:24 2007] [notice] child pid 1022 exit signal Segmentation 
fault (11)
[Thu Jul  5 15:38:25 2007] [notice] child pid 1044 exit signal Segmentation 
fault (11)
[Thu Jul  5 15:38:27 2007] [notice] child pid 1046 exit signal Segmentation 
fault (11)
[Thu Jul  5 15:38:28 2007] [notice] child pid 1047 exit signal Segmentation 
fault (11)
[Thu Jul  5 15:38:30 2007] [notice] child pid 1050 exit signal Segmentation 
fault (11)
[Thu Jul  5 15:38:31 2007] [notice] child pid 1051 exit signal Segmentation 
fault (11)
[Thu Jul  5 15:38:32 2007] [notice] child pid 1052 exit signal Segmentation 
fault (11)
[Thu Jul  5 15:38:34 2007] [notice] child pid 1053 exit signal Segmentation 
fault (11)
[Thu Jul  5 15:38:35 2007] [notice] child pid 1065 exit signal Segmentation 
fault (11)
[Thu Jul  5 15:38:36 2007] [notice] child pid 1009 exit signal Segmentation 
fault (11)
[Thu Jul  5 15:38:38 2007] [notice] child pid 1069 exit signal Segmentation 
fault (11)
[Thu Jul  5 15:38:39 2007] [notice] child pid 1070 exit signal Segmentation 
fault (11)

Until the browser finally stops.

>I don't remember much about how ePerl works, but it's clear you aren't
>sending any headers or generating valid HTML.  That may not be the
>problem though.

ePerl handles the headers without needing to specify them, and the little 
bit of HMTL at the bottom of the script should be plenty.

>Why don't you try taking things out of this until it works?  The last
>thing you take out is the culprit.

I tried that already, using a different script:

[http://heavy.boygenius.com/temp/test2.cgi]
[http://heavy.boygenius.com/temp/test2_cgi.txt]

[http://heavy.boygenius.com/temp/test2.phtml]
[http://heavy.boygenius.com/temp/test2_phtml.txt]

If I comment out '$rate_request->submit() or die 
$rate_request->user_error();', it returns an empty page immediately.

My interpretation of the problem is that it seems to occur when 
Business::Shipping goes out over the wire from inside a mod_perl 
environment.  However, that's probably wrong, because grabbing external 
pages from inside mod_perl seems to work just fine in other cases:

[http://heavy.boygenius.com/temp/test_pagegrab.phtml]
[http://heavy.boygenius.com/temp/test_pagegrab_phtml.txt]

Thusly, I'm stumped.

thanks again,
Todd



Re: script runs from command line and as CGI, not under ePerl/mod_perl

Posted by Perrin Harkins <pe...@elem.com>.
On 7/3/07, Todd Finney <tf...@boygenius.com> wrote:
> However, when I take the same script and run it in my Apache/ePerl
> environment, it fails with no errors, no output, no nothing.

Well, the root of your problem is that you're using ePerl.  I haven't
seen that one in a long time, and I doubt it gets any support releases
these days.  I also doubt anyone on the list at this point has ever
used it.  It's just too old.  Time to look at some newer tools, if you
want to use something that the community can help you with.

> Source: [http://heavy.boygenius.com/temp/test_phtml.txt]
> (I needed to shut off warnings to eliminate subroutine redefined warnings)

A bad sign.

I don't remember much about how ePerl works, but it's clear you aren't
sending any headers or generating valid HTML.  That may not be the
problem though.

Why don't you try taking things out of this until it works?  The last
thing you take out is the culprit.

- Perrin