cgi script causing perl loop????

M

mmccaws2

Hi

I'm developing a CGI script on an intel Mac and noticed that I
probably wrote something that is causing hi cpu utilization. Every
time that I submit the form in the browser starts responding and
hanges. So the question is how do I know if it's a perl problem or an
apache problem. And if it's my Perl code how do I find where it's
hanging.

I do have these error messages:

Timeout waiting for output from CGI script /final.cgi, referer:/
final.cgi?page=register (I've left out the directory info)

Premature end of script headers: final.cgi, referer:/final.cgi?
page=register

perl(677) malloc: *** vm_allocate(size=452612096) failed (error
code=3) referer:/final.cgi?page=register
perl(677) malloc: *** error: can't allocate region, referer:/
final.cgi?page=register
perl(677) malloc: *** set a breakpoint in szone_error to debug,
referer:/final.cgi?page=register
Out of memory!
referer:/final.cgi?page=register

These seem to be saying that I've a perl code problem? Right?

Thanks

Mike
 
J

J. Gleixner

mmccaws2 said:
Hi

I'm developing a CGI script on an intel Mac and noticed that I
probably wrote something that is causing hi cpu utilization. Every
time that I submit the form in the browser starts responding and
hanges. So the question is how do I know if it's a perl problem or an
apache problem. And if it's my Perl code how do I find where it's
hanging.

Ahhhh.. run it from the command line, add a few prints, etc. In
other words, debug it like any other perl program.

Maybe this is worth reading:

perldoc perlfaq9
 
M

mmccaws2

Ahhhh.. run it from the command line, add a few prints, etc. In
other words, debug it like any other perl program.

Maybe this is worth reading:

perldoc perlfaq9

I guess the real question is how do I determine the run away process
then stop it in an unix environment. It might be perl or mysql. I
don't want
to have to reboot each time.

Thanks
 
M

mmccaws2

Looks a lot like either an endless loop or a problem with
recursion, as your script is trying to allocate 452 megs of ram.

-Chris

Thanks

it was a subroutine accidentally copied into the subroutine that was
calling it. probably a recursive nightmare.

But I'm stil looking for good techniques on how to identify processes
that run away.

Mike
 
P

Peter J. Holzer

I guess the real question is how do I determine the run away process
then stop it in an unix environment. It might be perl or mysql. I
don't want
to have to reboot each time.

Setting resource limits (size of VM per process, number of processes per
user, etc.) helps to prevent runaway processes from gobbling up all
available resources. Either they will die when they hit the ceiling, or
at least they won't grow further while you still have a useable system,
so you can examine what is going on.

hp
 
J

Joe Smith

mmccaws2 said:
I guess the real question is how do I determine the run away process

You mean you've never heard of 'top' ?
And you've never done anything like 'ps -ef | sort +6 | tail -20' ?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,764
Messages
2,569,567
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top