Unkillable perl processes in windows XP

Posted on 2004-11-05
Last Modified: 2012-06-21
   I am using perl version   v5.6.1 built for MSWin32-x86-multi-thread on cmd window in windows XP.
When i trying to run a relatively simple perl script
And break its execution with Ctrl-C, the follwing happens (not every time, but at 50% of cases)
1) The cmd window seems frozen but can be closed
2) When the cmd window is closed, task manager shows no perl process running
3) When i open another cmd window and execute another or same perl script, the script starts to run and freezes
4) Now i can see perl.exe process running and i can not:
    - Kill the process (after "End process" attempt  by taskmanager,pview,wintasks - process remains and no error message)
    - Kill the cmd window (window remains, no reaction)
    - Shutdown or reboot system (except by reset button :) )
Everything other seems fine, and trying to open new perl script, leaves one more frozen cmd window with one more unkillable perl process.

- How i can kill this process without hardware reboot?
- What i am doing wrong and how i can stop a script without going into the same situation?


Question by:dmitry1
    LVL 16

    Expert Comment

    I think a better question would be how PERL handles Ctrl+c

    LVL 10

    Expert Comment

    In my experience the utilty below is able to kill processes that Task Manager can't.
    LVL 8

    Expert Comment

    Hi dmitry1,

    I think it has nothing to do with the handling of Ctrl-C.  The reason why you can't kill it is most likely due to hardware access.  Let's assume that your perl script is accessing a disk drive, or some other hardware resource.  While you can shut perl script execution down, you can't immediately interrupt the disk access, which is also most likely the reason why you wanted to terminate your script ('cause the hardware access hung your script).  Second time you launch a script, your script tries to access the same hardware, and it of course hung again because that hardware is still busy.  Only when you do reboot can that hardware be reset and get free again.  Try to find out why the hardware access would hung there, or if the I/O simply has to take that long.  If the hardware simply would hang after the operations in your perl script, then there's nothing you could do.  But if it's just that the operation takes a long time, it's best that you wait till it finish instead of trying to kill the perl script, which could lead to hardware hang.

    LVL 6

    Expert Comment

    In addition to inq123 I would like to add other possibilities of freezing:
    If you access a network resource within your script and the network resource is not available it might also contribute to inability of closing Perl.exe process.

    Use pskill.exe from

    And you can kill  99% of all froze windows (use the force method).
    LVL 8

    Expert Comment

    I think rj2's suggest would most likely enable OP to kill his perl process, but that would not help with the second part of the question as relaunch after pskill would run into the hardware problem again as HW was not reset.  In such situations, a reboot is unavoidable.

    Accepted Solution

    PAQed with no points refunded (of 250)

    Community Support Moderator

    Featured Post

    IT, Stop Being Called Into Every Meeting

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Join & Write a Comment

    Email validation in proper way is  very important validation required in any web pages. This code is self explainable except that Regular Expression which I used for pattern matching. I originally published as a thread on my website : http://www…
    In the distant past (last year) I hacked together a little toy that would allow a couple of Manager types to query, preview, and extract data from a number of MongoDB instances, to their tool of choice: Excel (…
    Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
    This video discusses moving either the default database or any database to a new volume.

    732 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now