in reply to Freakish Perl hangs when run by Windows Service

Screamer has a couple of good points on permissions of services. I've run into several instances where I did not have permission to read/write to a folder. I was not catching/logging the exception correctly. If you use a tool like PerlApp/PerlSvc, they will do some logging to the Windows Event Log for you. If you are rolling your own logging, might I suggest the CPAN (Win32::EventLog).

Even though your 3rd-party-service-program-runner-thingy works for other executables, you may be running into trouble running a script through Perl. You might try moving your parent script to be a service itself and starting/stopping it through the services API, which is quite dandy. If you go this route, there are two modules that make the job quite easy, Win32::Daemon and Win32::Process. I've had a lot of success using these two modules together -- in conjunction with the afore mentioned logging module.

If you would like more specific help rather than random, "hey try this" advice, post some code so we can dig through it!

Good Luck!
Casey
  • Comment on Re: Freakish Perl hangs when run by Windows Service

Replies are listed 'Best First'.
Re: Re: Freakish Perl hangs when run by Windows Service
by bradlepc (Initiate) on Jun 18, 2002 at 16:57 UTC
    These are some good thoughts. I think I need to provide some more details though. The perl script doesn't always hang. It often does, but not always. Also, there are several different scripts that all hang from time to time. Usually the first few times after a reboot work; eventually I get the hang. Making the Perl its own service is not an option because I need other features of the service. An easy way to think of this (and I've demonstrated the hang this way) is RSHing the script on a host.