Subject: Re: Cygwin service doesn't get NT shutdown notification
From: Fred Yankowski <[email-masked]>
To: Paul Garceau <[email-masked]>
Cc: [email-masked]
Date: Fri, 27 Apr 2001 10:41:15 -0500

On Thu, Apr 26, 2001 at 01:23:42PM -0700, Paul Garceau wrote:
> 	Just guessing, but are you including a specific message handling 
> subroutine/module geared to interface between the Cygwin (bash) shell 
> and the NT4 (comspec) shell?

I don't follow your question, but bash isn't involved.  The service
process, a custom program coded in C, is started directly from the NT
Service Control Manager.

> Without being able to draw from 
> experience (another guess  -- hopefully an educated one), there is a 
> possibility that Cygwin registry settings are overwriting PostGreSQL 
> registry settings,

Fair enough guess, but I've been watching the registry and haven't
seen evidence of any such corruption.

> 	It may be that Cygwin doesn't have sufficient Access on your system 
> (user privelege) to actually launch a shut-down event from Cygwin 
> system task (bash).

It's actually the NT SCM (I think) that signals the shutdown event to
the service.  In any case, it's not any Cygwin code generating the
notification. 

> 	Setting up service using Win32api (ie. srvany.exe) from a NTVDM shell 
> (NT Virtual DOS Machine) apart from Cygwin (thereby placing service 
> directly under NT4 specific task/process controls).

I've used that configuration -- well, actually, I used the similar
'invoker' wrapper -- but neither srvany nor invoker seems to provide
any way to do a soft shutdown of the controlled service process.
Also, srvany is not freely available (as you mention later).

If I can't get this to work correctly in Cygwin, I may just write a
wrapper similar to srvany that would call a user-specified program in
the event of the stop or shutdown notifications, giving the managed
service process a chance to shutdown gracefully.

> 	Insight 5.0 might be able to help you winnow out the problem as well.

The hard part is that this problem occurs as the system is being
shutdown, making it hard to use an interactive debugger.  And I
haven't a clue what to breakpoint on.  I've put extensive traces in
the service source code, but as the event notification hander isn't
even being called it's hard to figure out what else I could watch (and
how). 

-- 
Fred Yankowski           [email-masked]      tel: +1.630.879.1312
Principal Consultant     www.OntoSys.com       fax: +1.630.879.1370
OntoSys, Inc             38W242 Deerpath Rd, Batavia, IL 60510, USA

--
Want to unsubscribe from this list?
Check out: http://cygwin.com/ml/#unsubscribe-simple