in reply to PerlSvc Ends With Error 1067

The process terminated unexpectedly

I can't speak from Perl experience (not having written any Win32 perl services), but from maintaining a C++/Java service our company has, I can say a few things about "Unexpected Shutdown". I've chased these kind of defects for weeks! The service must end in 3 seconds after recieving the request to shut down. If you ignore the request or are too slow, you'll see this message. Look at your active state docs and see if you are handling that shutdown hook decently...decent threading should help you somewhat, but make sure all of your threads will end nicely when requested!

Replies are listed 'Best First'.
Re: Re: PerlSvc Ends With Error 1067
by Grygonos (Chaplain) on Mar 03, 2004 at 16:11 UTC
    You can also delay the shutdown in your main thread by requestin more shutdown time from the service manager... Win32::Daemon has a function for this.. so I would imagin PDK does as well. Something like
    my $active_children = 1; while(1) { if($SERVICE_STATE eq "SHUTTING_DOWN") { if($active_children) { requestMoreTime(x); ShutDownChildren(\$active_children); } last if !$active_children; } sleep(x); }
    Just a very high level idea of how you might pull this off... Its very pseudo code and it could be horrible.. but hopefully its on the right track

    Grygonos