This is the mail archive of the
mailing list for the Cygwin project.
Re: cygrunsrv V0.95 bug (dll ver 1.3.12-2)
- From: dan ''dante'' tenenbaum <dandante at dandante dot com>
- To: Pavel Tsekov <ptsekov at gmx dot net>
- Cc: cygwin at cygwin dot com
- Date: Wed, 11 Sep 2002 14:41:02 -0700 (PDT)
- Subject: Re: cygrunsrv V0.95 bug (dll ver 1.3.12-2)
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
> 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
> 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
> the -Xrs command-line option must be passed to the JVM. The additional
> 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.
> more background,
> please see at least the last section of the evaluation on the
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Bug reporting: http://cygwin.com/bugs.html