[python-win32] Win32 service not calling SvcShutdown()
Mark Hammond
mhammond at skippinet.com.au
Mon Nov 5 02:33:02 CET 2012
[re-adding python-win32]
On 5/11/2012 12:08 PM, Rob McGillivray wrote:
> Hi Mark,
>
> Much appreciate the feedback! Many thanks.
>
> I'll try writing something to a file and check this out … I never
> thought that the event log service could/would stop(?). Doesn't the
> event log service run continuously and support all Windows services
> logging requests? Or do you get some handle to an 'event logger'
> object upon launch of python service.exe? I do have a book on NT
> Services that I'll peruse a little more based on your feedback.
>
> My understanding from your chapter on services is that the service
> only ceases to 'exist' once SvcDoRun ends, so I thought I was safe
> signaling on SvcShutdown event. If the shutdown is happening so
> quickly, then I am concerned, because the 'cleanup/shutdown' code may
> take 10-15sec to complete. I thought I could advise the SCM of this
> delay, since the default timeout shows a wait hint of 5sec? Clearly
> my understanding is a little foggy here, so any enlightenment would
> be appreciated.
That's generally correct - although you should probably still do the
shutdown work in the DoRun methods - the shutdown notification is likely
to come in on a different thread.
> Also appreciate the comment on the fragility of my use of events.
> It's my first time using them, and much of what I coded I
> 'translated' from the NT Services book (written in C++). Funny thing
> is that I started with sleep function as you describe with a timeout
> of 1000msec, and then 'improved' it to it's current state. I'll
> recode it in the light of your feedback. Thanks again.
>
> PS: I also bought your Programming Python to teach this old(er) dog
> new tricks, and it's been a great read, showing a sense of humor and
> comic relief quite devoid most dev books on my shelf. :-)
Thanks :)
Mark
More information about the python-win32
mailing list