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

I think I need to explain the situation not just the problem. We have six sites each with windows 2003 servers these servers run an application written by a vendor that processes checks it uses Oracle 9i. The server also runs a complex Perl program called Monitor.pl, it waits for files to drop in to directories and processes the files in to reports. Monitor.pl was written by a guy who retired about 2 years ago. Sense Monitor.pl works fine at the other sites we don't think it's a code issue.
Monitor.pl does NOT access the db. The monitor application is run at system startup using a scheduled task that runs a batch fill the batch file executes Monitor.pl using perl.exe
One site was moved to a new building so we were given servers to install our application and monitor.pl. This site is where we have had the issue. Right off Qwest had DS3 issues, now resolved, we thought it was the network, not so. When the server teams setup our servers they installed Perl 5.8.8 we thought nothing of it, however the other sites are on Perl 5.6.0 both are Active State Perl. For the first few days Monitor.pl did its thing moving files around making reports and keeping the business line happy. End of Day happens around 2:00AM and is triggered by the users when they have completed their work, they click a button it runs a batch file called "endprocday.bat" this batch file triggers several jobs to run on the mainframe that down loads several files (push to server).
The log files show this to be working.

Monitor.pl hangs when waiting for the first file to come down from the mainframe it takes about 5 minutes the file is there but Monitor.pl is hung. We attempt to restart Monitor.pl using Scheduled Tasks but it will not start after stopping, this method works at the other 5 sites, but it will not restart at the 1. We have to restart the server to get Monitor.pl to run again when the restart is done it's about 3 hours work before we can even run End of Day again because of all the background work Monitor does.

To work around this until Qwest put a new cable on the DS3 we have been getting paged before the site runs end of day so we can restart the server. This by the way makes Monitor.pl work fine end of day just works. Last night in a fit of desperation we installed Perl 5.6.0, we will not know until tonight if that is the fix or if we have another problem with something.
I've been through the Perl code, we have had guys from other teams look at the Perl code and it's the same from site to site. I'm not a Perl programmer I do VBS and Java but I can look at code and see a difference.

It's been almost 4 weeks we have been working this issue first the network, then the opteron timing bug, now this I cold really use some sleep.

Does anyone know of an issue with Perl 5.8.8 that would cause it to hang like this?
KISMIF Keep it Simple make it Fun

Replies are listed 'Best First'.
Re: Perl Hanging
by BrowserUk (Patriarch) on Jan 08, 2010 at 23:29 UTC

    There are nearly 10 years and at least 14 versions of differences between 5.60 & 5.8.8. Whilst the perl devs do an amazing job of maintaining backwards compatibility, that is a big leap to make without testing.

    The first thing you need to discover is where in the code it is hanging. And the simplest way to go about that is to set up a non-production machine with perl and an appropriate directory structure so that you can run the script manually and see what happens.

    If you run monitor.pl from the command line like this:

    perl -d:Trace monitor.pl

    You may need to install Devel::Trace if you do not already have it

    Then you will get a line by line trace of the running program output to the screen. Wait until the script reaches the point where it is waiting for files, and then copy an appropriate file into the appropriate subdirectory and see what happens.

    Note: The program will run considerably more slowly than normal, and will produce masses of output. Once you have some idea of where the program is hanging (or looping), you can add use Devel::Trace into the script itself and place

    Devel::Trace::trace('on'); # Enable Devel::Trace::trace('off'); # Disable

    at significant points in the code to limit the output to the important bits.

    You can also re-direct the output to a file:

    perl -d:Trace monitor.pl 2>&1 > monitor.log

    And then load it into an editor to track it through. Make sure you have plenty of disk space available on the machine.

    You should also seriously consider contracting a local Perl programmer to help you out.


    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.