Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Date: Wed, 11 Sep 2002 14:41:02 -0700 (PDT) From: "dan ''dante'' tenenbaum" X-X-Sender: dandante AT pro DOT netnation DOT com To: Pavel Tsekov cc: cygwin AT cygwin DOT com Subject: Re: cygrunsrv V0.95 bug (dll ver 1.3.12-2) In-Reply-To: Message-ID: X-Filigree-Loquat: Banerjee MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Thank you for your quick response. I was able to solve the problem using Quote 2 below. (I didn't try quote 1 because I don't know how to handle native events in Java). You may want to consider including this information in the documentation for cygrunsrv so that others do not have the same problem when trying to use it with java. Now I have one other problem/question: Now when I try and Stop my new service, it hangs. If I log out and log back in, the service will be stopped. But that is a hassle. There is a competing service wrapper known as JNT which can handle this. I would prefer not to use JNT as it is not as flexible as cygrunsrv. (For one thing, it does not let me log stderr/stdout to a file.) JNT handles this problem by allowing me to specify a method within my program to call when it's time to shut down the service...this kills all the background threads that would otherwise be running after the main() method returns. I know this is sort of beyond the scope of what cygrunsrv is meant to do, but here it is FYI. If you know a workaround for this, please let me know. Thanks. On Wed, 11 Sep 2002, Pavel Tsekov wrote: > On Wed, 11 Sep 2002, dan ''dante'' tenenbaum wrote: > > > I created a couple of services using cygrunsrv V0.95 (cygwin dll version > > 1.3.12-2) under Windows 2000. > > > > When I log off, those services are stopped. > > > > One of the services is a Java application. I understand that there is a > > common bug with many service wrappers, something to do with NT > > CTRL_LOGOFF_EVENT . Is that what this is and is there any way to work > > around it? > > I hope the information below can help... > > Quote 1 (MSDN): > =============== > For WIN32 graphical applications: when the currently logged-in user is > logging-off, all WIN32 top-level windows receive WM_QUERYENDSESSION and > WM_ENDSESSION messages. Some WIN32 applications choose to terminate upon > receipt of such messages. In order for your WIN32 application to survive > logoff, it must not do that: instead, your windows procedure should call > the > default windows procedure on these messages. > For WIN32 Console (i.e. character-mode) applications: when the currently > logged-in user is logging-off, all Console applications receive a > CTRL_LOGOFF_EVENT event from the Console. > > If your Console application has registered a Console event handler (via > SetConsoleCtrlHandler), it must ignore CTRL_LOGOFF_EVENT in order to > survive > the logoff. > > Quote 2: > ======== > Bug 4323062: Any Windows NT Service embedding Java VM aborts when user > logs out > > This bug has been fixed in J2SDK 1.3.1. In order to enable the > fix, > the -Xrs command-line option must be passed to the JVM. The additional > command > line argument is > necessary because the fix necessarily disables the J2SDK 1.3 > shutdown hooks mechanism and forbids the use of the sun.misc.Signal class. > For > more background, > please see at least the last section of the evaluation on the > Bug > Parade: > > > http://developer.java.sun.com/developer/bugParade/bugs/4323062.html > > > -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Bug reporting: http://cygwin.com/bugs.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/