Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

never dying perl processes win32

by vbrtrmn (Pilgrim)
on Dec 31, 2002 at 06:16 UTC ( [id://223267]=perlquestion: print w/replies, xml ) Need Help??

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

good evening ladies and gentlemen, i've been kind of troubled in using perl in win32. i like it, i reallly do, but sometimes, when testing some scripts i have problems with perl never dying. i can sometimes have up to 10 instances of it just hanging out in the task manager. further, the Administrator account can't seem to kill them.

I figured out how to kill the processes off, using MS's reskit utilities TLIST and KILL. TLIST functions like the taskmanager or the ps command on *nix platforms. Kill acts the same as 'End Process' in the taskmanager and is similar to the kill command on *nix platforms. These programs are mighty handy, you can kill any system process that's running (as a side note, if you kill one of the processes you will lose the ability to log off/shutdown/reset). Both are available here: ftp://ftp.microsoft.com/services/technet/samples/ps/win98/reskit/diagnose/

I commonly run into this problem, when experimenting in writing web applications, I'll run the script through my browser on my localhost; I'll either have an accidental infinite loop or I'll just stop the session early; this causes the perl process to keep running, though the browser has stopped loading. My question is how do I make my win32 box run more like unix, where the processes just die off by themselves?


--
paul

Replies are listed 'Best First'.
Re: never dying perl processes win32
by dws (Chancellor) on Dec 31, 2002 at 07:15 UTC
    sometimes, when testing some scripts i have problems with perl never dying.

    I get this frequently on Win98 when invoking Perl via an editor during development. <ctrl><alt><del>, select the process and click "End Task", and it's history.

    I will be so glad to retire this machine and upgrade.

      For some reason in both Windows 2000 and Windows XP Pro, the processes can not be killed by the Administrator, the program that is run by <ctrl><alt><del> is the taskmanager. The one on NT machines is a lot more advanced than the crappy (at best) Windows 9x/ME version.

      Administrator suposedly has full control over the system, like root, on *nix systems. Though, in the taskmanager, Administrator cannot kill certain system processes, such as devldr32.exe. On my system, perl.exe runs as a system command, so Administrator does not have permission to kill it. That's where TLIST and KILL come into play. I usually just run a batch file every few hours, which kills all the rogue perl processes; though I'd like to not have to worry about even doing that.


      --
      paul

        That sounds strange. I'm on NT4 sp6a, and I have no trouble killing processes via the task manager, either from a general account if it's the same one the task was run from, or from the Admin account regardless of what account it's running from.

        Your sample script above is a CGI script. Which HTTP server are running it under? Apache, IIS, other?

        If it's IIS, it could well be the permissions used by the server, that £&"^&^$" program is a law unto itself. I encountered several strnge things when I was working on a project with it. More than just bugs I mean, 'features' that worked differently with IIS to any other peice of software, even other MS products.


        Examine what is said, not who speaks.

        The 7th Rule of perl club is -- pearl clubs are easily damaged. Use a diamond club instead.

Re: never dying perl processes win32
by Marza (Vicar) on Dec 31, 2002 at 06:51 UTC

    Eh? I have never run across what you describe. Care to post some code?

    I am especially curious about losing the ability to shutdown/logoff so code would be helpful if that is possible

    As to more unix like? Run linux! ;-p However, you could look into packages like MKS

      the losing the ability to shutdown/logoff doesn't really have anything to do w/ perl, it just happens if you use kill and kill off some of the windows system processes, i just put it in as a note to curious hackers.

      anything could leave a process running permanently, such as:

      #!perl.exe use CGI qw(:all); print header(); if (1=1) { print "blah<BR>"; }

      If I hit escape or hit the stop button, while this infinate loop is running, the browser stops loading, but the perl.exe process continues to run in memory. It just hangs out there and the Administrator account can't kill it for some reason. If I do the same thing with my linux box, yes I have one, the perl process will die off by itself.

      thanks for the mks suggestion, but i'm not paying for any software (yes, i'm cheap and jobless).
      --
      paul

        It shouldn't work that way. I don't have the problem. I am not running Apache but as Browseruk suggested it might be worth upgrading your apache.

        As to a free unix like package, you can go the gnu route and take a look at Cygwin

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://223267]
Approved by rob_au
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (6)
As of 2024-03-28 15:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found