[Win32utils-devel] Fwd: [win32-service] 1067 Error on manual stopping of service (#9)

Daniel Berger djberg96 at gmail.com
Fri Aug 2 01:04:44 UTC 2013


---------- Forwarded message ----------
From: Adrian Candaten <notifications at github.com>
Date: Thu, Aug 1, 2013 at 5:46 PM
Subject: [win32-service] 1067 Error on manual stopping of service (#9)
To: djberg96/win32-service <win32-service at noreply.github.com>


Moved my ruby services from winXP to Win7 and when I manually stop my
services, I receive a Windows error: Error 1067 - The process terminated

It seems to be the exit! in the service_stop().

When I looked at the Daemon code, I can see that the program is waiting for
the @@hStopCompletedEvent event for which there is no setEvent().
Possible solution

Instead of the exit! in the `service_stop(), would it not be simpler to add

def service_stop

to the Daemon class and then the subclasses can call super instead of
exit!or not even implement it. Ie.

class RubyDaemon < Daemon
  def service_main
    log "service_main"
    while running?
      # do stuff and wait
      sleep 1
    log "Never gets here"

This approach allows other working examples using the exit! to work, but
allow users to avoid it.
Possible solution # 2

Provide a method to set this event (thus hide the implementation details)
and instruct users to use exit! or the new method in their service_stop().

Thanks for your work (learning heaps looking at your code using ffi to
OSes) and owe you a coffee when you come to Brisbane.

Reply to this email directly or view it on
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/win32utils-devel/attachments/20130801/cbab99be/attachment.html>

More information about the win32utils-devel mailing list