You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Faisal Nasim <wh...@nasim.org> on 2004/11/22 20:01:34 UTC

mod_perl woes! frequent 500!

Hi,

I have recently developed a project in Perl and it works great but it
works pretty slow because of forking. I've used mod_perl in the past,
and have also compiled mod_perl C and Perl modules myself on my
local box. This is the first time I'm trying to use mod_perl in a production
environment and I'm very frustrated! I removed mod_php support from
my server when I read on cpanel info that mod_php has issues with mod_perl
but no avail!

It compiles and it runs great but for no reason it all the scripts randomly gives
a 500 error! I was using XML::Simple so I realized I might have some unclosed
file handles which cause a 500 after several hits. This is what I found in the logs:

[error] Couldn't create file parser context for file "/home/.../xml/Test.xml": No such file or directory at /usr/../LibXML.pm line 427.\n at /usr/../LibXML/SAX.pm line 63\nCompilation failed in require a ...

The XML file exists and it it works fine on the first few runs. I am doing a simple
XMLin() call to generate the hashref structure and thats it! I tweaked my script
to use IO::File to open the xml file and then passed the handle to XMLin(), I haven't
received that 500 error for last 20 hits or so (it might just pop up again anytime!). The
only difference is that I'm using IO::File now and after XMLin(), I'm assigning 'undef'
to it.

There's just one more problem. I am now getting occassional 200 OK message
with this in the error log:

[error] PerlRun: `Undefined subroutine &Apache::ROOTwww_2..._2ecom::testmod::testmod_search_2epl::GetMakes called at /home/.../testmod_search.pl line 19.\n'

You hit refresh and it works great! Sometimes I get that 200 OK error consecutively
for 4-5 times and then it works.

I've tried PerlFreshRestart On/Off both and I've also tried using both Apache::Registry
and Apache::PerlRun.

Can somebody give some pointers? What about that XML::Simple's XMLin() call?
Should I report that?

Regards,

Faisal Nasim
Pakistan



-- 
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html


Re: mod_perl woes! frequent 500!

Posted by Tom Schindl <to...@gmx.at>.
Faisal Nasim wrote:
> I added the IO::File wrapper in two scripts and they worked fine and the third one
> failed occasionally. Now I changed the third and the occasional 500 does not
> show up anymore. I think XML::Simple does not close the file handle after
> simply creating the data structure. I'll have to check that.
> 
> I'm doing libxml = 2.5.8, XML::Simple... latest from CPAN.
> 
> I've now upgraded to libxml 2.6.16.

Your error indicated that it was coming from XML::LibXML which is the 
perl-binding to libxml. Upgrading only libxml doesn't help you there. 
You didn't show us the complete error-message and your version of 
XML::LibXML.

perl -MXML::LibXML -le 'print " VERSION: $XML::LibXML::VERSION";'

Tom

> 
> Regards,
> 
> Faisal Nasim
> http://fnasim.blogspot.com/
> 
> 
> At 02:04 AM 11/23/2004, Perrin Harkins wrote:
> 
>>On Mon, 2004-11-22 at 15:50, Tom Schindl wrote:
>>
>>>Well as Perrin already stated there are issues with XML::LibXML which 
>>>you are using with XML::Simple. Which version do you have installed?
>>>See this thread and a working patch against these libs. Still I would 
>>>upgrade as a first try libxml and XML::LibXML.
>>
>>Or try something faster.  Benchmark:
>>http://perlmonks.org/index.pl?node_id=409517
>>
>>I'm not certain about expat thread-safety, but it might be worth trying.
>>
>>- Perrin
> 
> 


-- 
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html


Re: mod_perl woes! frequent 500!

Posted by Faisal Nasim <wh...@nasim.org>.
I added the IO::File wrapper in two scripts and they worked fine and the third one
failed occasionally. Now I changed the third and the occasional 500 does not
show up anymore. I think XML::Simple does not close the file handle after
simply creating the data structure. I'll have to check that.

I'm doing libxml = 2.5.8, XML::Simple... latest from CPAN.

I've now upgraded to libxml 2.6.16.

Regards,

Faisal Nasim
http://fnasim.blogspot.com/


At 02:04 AM 11/23/2004, Perrin Harkins wrote:
>On Mon, 2004-11-22 at 15:50, Tom Schindl wrote:
>> Well as Perrin already stated there are issues with XML::LibXML which 
>> you are using with XML::Simple. Which version do you have installed?
>> See this thread and a working patch against these libs. Still I would 
>> upgrade as a first try libxml and XML::LibXML.
>
>Or try something faster.  Benchmark:
>http://perlmonks.org/index.pl?node_id=409517
>
>I'm not certain about expat thread-safety, but it might be worth trying.
>
>- Perrin

Re: mod_perl woes! frequent 500!

Posted by Perrin Harkins <pe...@elem.com>.
On Mon, 2004-11-22 at 15:50, Tom Schindl wrote:
> Well as Perrin already stated there are issues with XML::LibXML which 
> you are using with XML::Simple. Which version do you have installed?
> See this thread and a working patch against these libs. Still I would 
> upgrade as a first try libxml and XML::LibXML.

Or try something faster.  Benchmark:
http://perlmonks.org/index.pl?node_id=409517

I'm not certain about expat thread-safety, but it might be worth trying.

- Perrin


-- 
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html


Re: mod_perl woes! frequent 500!

Posted by Tom Schindl <to...@gmx.at>.
Perrin Harkins wrote:

>On Mon, 2004-11-22 at 14:01, Faisal Nasim wrote:
>  
>
>>It compiles and it runs great but for no reason it all the scripts randomly gives
>>a 500 error! I was using XML::Simple so I realized I might have some unclosed
>>file handles which cause a 500 after several hits. This is what I found in the logs:
>>
>>[error] Couldn't create file parser context for file "/home/.../xml/Test.xml": No such file or directory at /usr/../LibXML.pm line 427.\n at /usr/../LibXML/SAX.pm line 63\nCompilation failed in require a ...
>>    
>>
>
>Sometimes this means that you've had a problem earlier in the request
>with a module that has XS code, and now things are screwed up for the
>memory space of that particular child process.  I'd suggest you learn to
>debug with the -X option, as shown here:
>http://perl.apache.org/docs/1.0/guide/porting.html#Sometimes_it_Works__Sometimes_it_Doesn_t
>
>  
>
Well as Perrin already stated there are issues with XML::LibXML which 
you are using with XML::Simple. Which version do you have installed?
See this thread and a working patch against these libs. Still I would 
upgrade as a first try libxml and XML::LibXML.

http://aspn.activestate.com/ASPN/Mail/Message/perl-xml/1998065

But XML::LibXML are definately working under mp1 because AxKit makes 
heavy use of these libs.

Tom




-- 
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html


Re: mod_perl woes! frequent 500!

Posted by Perrin Harkins <pe...@elem.com>.
On Mon, 2004-11-22 at 14:01, Faisal Nasim wrote:
> It compiles and it runs great but for no reason it all the scripts randomly gives
> a 500 error! I was using XML::Simple so I realized I might have some unclosed
> file handles which cause a 500 after several hits. This is what I found in the logs:
> 
> [error] Couldn't create file parser context for file "/home/.../xml/Test.xml": No such file or directory at /usr/../LibXML.pm line 427.\n at /usr/../LibXML/SAX.pm line 63\nCompilation failed in require a ...

Sometimes this means that you've had a problem earlier in the request
with a module that has XS code, and now things are screwed up for the
memory space of that particular child process.  I'd suggest you learn to
debug with the -X option, as shown here:
http://perl.apache.org/docs/1.0/guide/porting.html#Sometimes_it_Works__Sometimes_it_Doesn_t

> There's just one more problem. I am now getting occassional 200 OK message
> with this in the error log:
> 
> [error] PerlRun: `Undefined subroutine &Apache::ROOTwww_2..._2ecom::testmod::testmod_search_2epl::GetMakes called at /home/.../testmod_search.pl line 19.\n'
> 
> You hit refresh and it works great! Sometimes I get that 200 OK error consecutively
> for 4-5 times and then it works.

Again, use -X to debug.  This is probably caused by using a library that
doesn't contain a package declaration.  See this for more:
http://perl.apache.org/docs/1.0/guide/porting.html#Name_collisions_with_Modules_and_libs

> I've tried PerlFreshRestart On/Off

Keep it off.

> both and I've also tried using both Apache::Registry
> and Apache::PerlRun.

Use PerlRun until you have it working smoothly, then try to get it
running under Registry.  PerlRun clears out globals and subs after each
request, so it's slower but safer for ugly code.

> Can somebody give some pointers? What about that XML::Simple's XMLin() call?
> Should I report that?

I doubt there's a problem with XML::Simple, because lots of people use
it.  It is probably caused by something else.

- Perrin


-- 
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html