I have created a multi-threaded Windows Service running on Windows Server 2003 using the Win32::Daemon module from http://www.roth.net/perl/Daemon.

I am using SOAP::Lite to communicate with an Apache CGI/Perl web front end for a MySQL database. In the main loop/thread, I make periodic SOAP requests to the Apache server to see if there are any jobs assigned in the database to the machine running the Windows Service daemon. I create a new thread when a new job request is found.

My problem is that after about two hours the Windows Service is mysteriously stopping without being sent a message to stop. I checked the application, security, and system logs and did not see anything.

I've used ptkdb before to debug Perl script, but what would be the best way to debug a Perl script that is running as a service?

How do I perform exception handling in a multi-threaded Perl script?

Any assistance is greatly appreciated. Thanks.


In reply to Debugging Windows Services created with Win32::Daemon by hackdaddy

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.