in reply to Debugging Windows Services created with Win32::Daemon
I'd redirect STDERR to a file (and probably do that in a BEGIN block near the top of the main script file). When Perl dies, it almost always says something on the way down. I suspect Win32 is just throwing this information away.
Using threads in Perl sounds like a recipe for having things die rather mysterious to me. So I'm not surprised you've experienced this.
You might want to write a manager that gets run as a service and have it launch and re-launch the script that does the real work. It is also a good idea to have long-running processes restart themselves periodically. If you write the manager, then you could just have the worker script exit when idle if its been running longer than X. Getting the manager restarted periodically is trickier. On Unix, I'd just occasionally do exec($^X,$0,@ARGV), but I recall exec being more like system+exit in Win32 (despite MicroSoft claiming "the new process is placed in the memory previously occupied by the calling process") and that might not play well with the Service Control Manager or other bits.
- tye
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Debugging Windows Services created with Win32::Daemon (STDERR)
by BrowserUk (Patriarch) on Nov 16, 2005 at 18:36 UTC | |
by tye (Sage) on Nov 16, 2005 at 20:04 UTC | |
by BrowserUk (Patriarch) on Nov 16, 2005 at 21:07 UTC | |
by tye (Sage) on Nov 17, 2005 at 00:33 UTC | |
by BrowserUk (Patriarch) on Nov 17, 2005 at 04:58 UTC |