Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

We run several Perl scripts on our Netscape enterprise server (3.5.1) running on NT 4.0 The script processes hang around and, occasionally, bring down the server. Could it be related to some users pressing the 'STOP' button in the browser? How do I ensure that the scripts exit gracefully?

Replies are listed 'Best First'.
Re: Perl processes that never die
by AgentM (Curate) on Apr 18, 2001 at 23:37 UTC
    There are a number of possiblities here
    • the server is doing something wrong or has been improperly configured
    • you have an infinite loop in your program that you don't know about
    • Netscape's handling of perl scripts is EVILLY flawed (?)
    Since we can have no possible way of knowing what your script does, we cannot analyze it. I don't even know if the Netscape server runs the script persistently or not, so it's unlikely that you'll find a solution here. An ugly hack would be to throw in a alarm(x); at the top of your script where x is the maximum amount of time this entire script can take. That's bad- you probably don't want that. Instead, pull apart your code, especially looking at any loops for any bugs.

    Related to the client pushing the STOP button? I dunno. Why don't you try it and find out?

    AgentM Systems nor Nasca Enterprises nor Bone::Easy nor Macperl is responsible for the comments made by AgentM. Remember, you can build any logical system with NOR.
      Just a quick FYI, alarm doesn't work on NT.
Re: Perl processes that never die
by c-era (Curate) on Apr 18, 2001 at 23:36 UTC
    Are you using nsapi-perl with your server? I've found that nsapi-perl has a problem with hanging netscape on NT. You might also look at creating an NT service that monitors your perl processes and ends them if they have been around too long (which can be done in perl thanks to Roth).