delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2008/10/18/14:07:38

X-Recipient: archive-cygwin AT delorie DOT com
X-Spam-Check-By: sourceware.org
X-Authenticated: #19222419
Message-ID: <48FA25A6.6050004@gmx.net>
Date: Sat, 18 Oct 2008 20:06:30 +0200
From: Sybille Ebert <sybille DOT ebert AT gmx DOT net>
User-Agent: Thunderbird 2.0.0.16 (Windows/20080708)
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
Subject: Re: cygserver 1.5.25-15 slows down logoff
References: <1224240805 DOT 27123 DOT ezmlm AT cygwin DOT com> <COL101-W325400D1D6A5B9ED54DE6E62D0 AT phx DOT gbl>
In-Reply-To: <COL101-W325400D1D6A5B9ED54DE6E62D0@phx.gbl>
X-Y-GMX-Trusted: 0
X-FuHaFi: 0.58
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

> Maybe you need to call SetServiceStatus(SERVICE_STOPPED) or exit the
> process or something? What happens when you use net stop to stop the
> service? It stops reasonably fast, or not?

Stopping the service manually is always fast. As for your suggestion to
exit the process: it is not what we want. The service in question is a
webserver and we want to keep it running when the user logs off.

According to http://msdn.microsoft.com/en-us/library/ms683242(VS.85).aspx:

[snip]
When a console application is run as a service, it receives a modified
default console control handler. This modified handler does not call
ExitProcess when processing the CTRL_LOGOFF_EVENT and
CTRL_SHUTDOWN_EVENT signals. This allows the service to continue running
after the user logs off. If the service installs its own console control
handler, this handler is called before the default handler. If the
installed handler calls ExitProcess when processing the
CTRL_LOGOFF_EVENT signal, the service exits when the user logs off.
[snap]

Corinna had written a test that always returned TRUE. This means (unless
there was another handler installed, or some weird 32-to-64-bit TRUE
conversion occured etc.) the OS should consider CTRL_LOGOFF_EVENT as
handled and should not do any additional processing. Yet, the behaviour
seems surprisingly similar to the following...

[snip]
"Return TRUE. In this case, no other handler functions are called, and
the system displays a pop-up dialog box that asks the user whether to
terminate the process. The system also displays this dialog box if the
process does not respond within a certain time-out period (5 seconds for
CTRL_CLOSE_EVENT, and 20 seconds for CTRL_LOGOFF_EVENT or
CTRL_SHUTDOWN_EVENT)."
[snap]

If it really a bug in the OS, it should also apply to any other
console-based service. I plan to investigate this when I have time.

S


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019