Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CGI process disconnects from web server

Status
Not open for further replies.

jursetti

Programmer
Jun 20, 2002
7
US
I'm getting very strange behavior with a perl CGI. I'm running Apache 2.047 on an AIX 5.3 server. Perl version is 5.8.

When I launch the cgi, it runs partway and stops. The browser says it's done. When you view source, it shows that the html simply stopped in the middle. Meanwhile, there is a process still running, taking 100% of a cpu, with a parent pid of 1.

I've tried restarting the web server. That worked once today but not the second time I tried it.

The cgi is reading a text file and displaying the contents in the browser. Pretty simple. It runs perfectly from the command line. I've looked for weird characters that might have gotten in the file somehow and haven't found anything.

What would cause something like this? And how do I prevent it from happening?

Thanks for your help.
 
Do your error logs give any hints? Running the script from the command line doesn't tell you much. When you run a perl/cgi script from the command line, the cgi part of it doesn't come into play. It just sends its output to the standard output. If this only happens with this particular script, then you may have to take it to the perl/cgi forum here at tek-tips and have them take a look at it. I don't know where the pid files are on your system but is apache creating a lot of them? When you reboot, it may be that these are being left behind. Clean them out by deleting them and restart apache. It sure seems like apache is going spawn crazy and creating runaway child processes. Have you tried setting these to low numbers so if apache goues into a downward tailspin like this it won't take the whole server with it?
 
I didn't see any errors in the error log when this first happened. I just took another look and see a few messages like this:

[Fri Feb 08 09:42:14 2008] [error] [client 10.226.4.89] daemon couldn't find CGI process for connection 21

I think this message is from when I killed the process that was still running with parent PID 1. So it sort of looks like the web server still knew about the process. At least it knew when it was killed.

This isn't taking the whole web server down. Other pages still come up. I just see 1 Apache pid file in /usr/HTTPServer/logs.

I had this same thing happen with a man2html cgi program. It would display part of the information and then stop.

I think this might have something to do with permissions somewhere. I changed the user and group to the user that owns the files and cgi scripts and I haven't had the problem again today. I know that is not recommended but i'm running this inside a firewall and it's just for a group of developers, so I'll probably just leave it.

Thanks.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top