Menu ▾ ▴

#80 -t deletes anchor file which immediately shuts down service

v3.1.2
open-fixed
None
5
2014-08-14
2005-01-24
No

[from mailing list post]

OK, so I have more information on this and know the
problem - it is a bug that I will write up.

When I press the "start" button on MSWindows's Services
GUI, the JBoss instance starts up fine.

Its only when I issue a wrapper.exe -t will the anchor
file come and go quickly.

Looking at the code, wrapper_win.c lines 2745-2751, I
see the anchor file gets created when -c is used.
Lines 2777-2785 create the anchor file with -s (this
is why pressing the start button in the Windows
Services GUI works).

However, look at the -t - there is no code to write
that anchor file. This is probably intentional - since
I think when you start the wrapper, it ends up starting
up with "-s" (in other words, the wrapper process that
starts with -t is a short-lived process - just issues
the start command and exits - it isn't the "true"
wrapper so it should not create the anchor).

However, -t still goes through the same exit routine -
which means appExit() is called (last line in main()).
In appExit(), there is the unlink to remove the anchor
file.

Since -s and -c never return, that appExit() isn't
called until the appropriate time. However, -t exits
immediately and thus deletes the anchor file (the
anchor file is created when the service is started
(with the -s)).

It's a race condition - the -s wrapper service starts,
creates the anchor then the -t process, seeing that the
service started, exits. But it then immediately
deletes the anchor file.

I'll write this up as a bug. Somehow, there needs to
be a global flag to say, "wrapper.exe is exiting, but
don't delete the anchor or pid files". And appExit()
needs to only delete the files if that flag tells it to.

Work around is to pass in on the command line to
wrapper.exe -t a bogus setting for anchorfile (one
different than the real anchorfile setting in .conf).
The -t process should try to delete that bogus file
(and fail) leaving the real anchor file alone:

wrapper.exe -t wrapper.conf wrapper.anchorfile=foo

> -----Original Message-----
> From: John Mazzitelli
> Sent: Monday, January 24, 2005 10:13 AM
> To: 'wrapper-user@lists.sourceforge.net'
> Subject: Anchor file mysteriously getting deleted
immediately
> upon startup
>
> [sorry for dup - originally sent this to Help forum;
just now
> found out that is old and that I should be sending to
this
> mailing list]
>
> I am seeing some weird behavior dealing with the
anchorfile.
> I have my anchorfile set. And under certain
conditions, I
> have seen it work. For example, if I start in -c console
> mode, it works (anchorfile is created and the JVM
will die
> when I specifically delete it).
>
> I can see this work when I install the wrapper as an NT
> service BUT ONLY if i start the service using the
Windows GUI
> utility (the Services GUI from Administration tools).
If,
> however, I start the Windows service via the -t wrapper
> option, the JVM starts up fine, but immediately the
> anchorfile gets deleted and the wrapper immediately
shuts the
> JVM down. It is very weird- I have no idea why or who is
> deleting that anchor file - but as soon as it gets
created
> (no more than a second or two delay) that anchor file
gets deleted.
>
> And this only happens if i start the service using
the -t.
> Again, if I start the service using the Winows
Services GUI,
> it all works fine.
>
> See below for my debug log - note the time stamps and
see
> that the anchorfile gets deleted rather quickly after
startup.
>
> Has anyone seen this behavior, or more importantly,
how to fix it?
>
> ----
> INFO | jvm 1 | 2005/01/22 00:53:38 | 00:53:38,567 INFO
> [NamingService] Started jnpPort=1099, rmiPort=1098,
> backlog=50, bindAddress=/0.0.0.0, Client
SocketFactory=null,
> Server
>
SocketFactory=org.jboss.net.sockets.DefaultSocketFactory@ad093076

> STATUS | wrapper | 2005/01/22 00:53:38 | JBoss
[abc-dpl] started.
> INFO | jvm 1 | 2005/01/22 00:53:40 | 00:53:40,120 INFO
> [Server] JBoss (MX MicroKernel) [4.0.0 (build:
> CVSTag=JBoss_4_0_0 date=200412201046)] Started in
2s:604ms
> STATUS | wrapper | 2005/01/22 00:53:41 | Anchor file
deleted.
> Shutting down.
> DEBUG | wrapper | 2005/01/22 00:53:41 |
wrapperStopProcess(0) called.
> DEBUG | wrapper | 2005/01/22 00:53:41 | Sending stop
signal to JVM
>
> FWIW: I set wrapper.anchor.poll_interval to something
higher
> (15 seconds) and it still behaves as I describe in my
first
> post. If I start with -t, the JVM stays up for 15
seconds,
> but the anchor file is gone almost immediately. So,
after the
> 15 seconds are up, since the file is gone, the JVM is
> shutdown. It looks like as soon as the wrapper spits
out the
> log "wrapper | <my service name> started.", that's
when the
> anchor file gets deleted.
>
> Don't know if any of this helps. I looked at the C
code but
> nothing jumped out at me as to a possible problem.
Should I
> write this up as a bug or am I missing something obvious?
>

Discussion

  • Leif Mortenson

    Leif Mortenson - 2005-02-01

    Logged In: YES
    user_id=228081

    Thanks for pointing this out. It is actually a problem with
    the -t, -p, -i, and -r commands for both the Wrapper PID and
    anchor files. This has ben fixed for the 3.2.0 release.

    Cheers,
    Leif

     
  • Leif Mortenson

    Leif Mortenson - 2005-02-01
    • milestone: --> v3.1.2
    • assigned_to: nobody --> mortenson
    • status: open --> open-fixed
     

Log in to post a comment.