Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Killing Long Running Fastcgi Processes

I have a Perl Dancer web application which uses the mod_fastcgi serving method from Apache2. The application has to accept uploaded files. When a user is uploading a file and presses the stop button, the fastcgi process hangs, running at 100% until I manually kill the process.

Is there any setting that can automatically kill a process that has hung like this? Is there any way to automatically kill a fastcgi process that has been running for a certain amount of time?

like image 348
mbergins Avatar asked Nov 21 '13 17:11

mbergins


1 Answers

No, it is not supported by mod_fastcgi.

That said, you have several alternatives:

  • Wrap your perl code in a timeout-based module, such as Time::Out.
  • use ulimit -t to have the kernel kill the runaway process once his CPU quota is over.

The second solution will be somewhat difficult to implement, since you don't want to kill the whole apache process. It is explained more in detail in an Unix StackExchange question.

like image 130
Steve Schnepp Avatar answered Nov 16 '22 23:11

Steve Schnepp