Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Killing a program started from the dock



Hi Greg & Mike,

The application is the NetBeans IDE (6.0 M10). When it installs, it puts an icon in the dock, and that is what I use to start it. The NetBeans.app file actually starts running a Bash shell script, which collects a bunch of information, then starts the JVM (1.6 in this case) with a meter-long string of parameters. At that point it becomes a fully GUI application.

Thanks for explaining that QUIT only generates a thread dump. That was not mentioned in the man page. My experiences on prior Unix systems was that a kill of any kind would stop the program, unless trapped. That was my misunderstanding. Thus, the QUIT was working properly after all, without being root.

You bring up the second aspect of my problem - where to find the dump. I found a binary file at /private/tmp/hsperfdata_travis/10626. (10626 was the pid at the time.) It is about 32 KB in size. Obviously, I need something to translate it into text. Can you give me a nudge about which program might do that? Dogpile and searching MacOSXHints didn't find anything useful. I tried to use jstack, but reading core files is apparently not implemented in OS X. I also ran into another problem which NDA forbids me from describing here.

The context of my questions is that I am trying to create documentation when a certain condition happens after several hours of use. Thus, I want to disturb the way NetBeans starts and runs as little as possible. That is also why I don't want to start it from Terminal if I can avoid it.

Since I have apparently found the output of the trace, I don't think I need to download the massive amount of source code and start sticking printlns in it.

Thanks for the good questions. Hope my answers are clear. If you have more, bring them on. 8-)

Travis


Greg Guerin wrote:
Travis Risner wrote:

I am trying to kill a program via kill -QUIT <pid>. However, the signal is
ignored, even when sent by root. An ordinary kill <pid> works fine. The
program is started from a bash shell, which then invokes the JVM to start a
Java program. I am trying to create a thread dump of the program (the
reason for the -QUIT signal).

Are you sure the QUIT signal is being ignored, as opposed to the thread-dump going somewhere you haven't discovered yet? That is, the program could be producing the thread-dump, but if the output stream is redirected, the data gets lost. Or the data gets written to a file, but you don't know which file it's in.

If you add a couple of System.out.println() and System.err.println()
statements to your app, where does that output show up?  Or does it not
show up at all?

Exactly how are you starting the app from a bash shell? Do you mean from a
shell script? In foreground or background? Using 'nohup'? Any other
redirection of I/O streams?


The Subject line says "started from the dock", so how does "from a bash
shell" fit with the Dock?


By the way, a QUIT signal will ONLY generate a thread-dump. It does NOT
terminate the Java program. So when you wrote "I am trying to kill a
program...", if you meant "generate a thread dump then terminate it", then
a QUIT signal will only do the former, not the latter.


A 'kill <pid>' sends a TERM signal, which is different from QUIT, which are
both different from INT, HUP, or KILL.



Is this enough information to reproduce the problem? Is there a better
forum to ask this question? Is there an alternative way to get a thread
dump?

The ctrl-\ key sends the QUIT signal, if the program is still attached to a
terminal. However, if the app isn't attached to a terminal, or its output
is redirected, then it won't make a difference. Sending a QUIT signal from
a different origin doesn't address the issue of redirected output, assuming
that's the problem.


  -- GG


_______________________________________________ Do not post admin requests to the list. They will be ignored. Java-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/java-dev/email@hidden

This email sent to email@hidden



_______________________________________________ Do not post admin requests to the list. They will be ignored. Java-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/java-dev/email@hidden

This email sent to email@hidden
References: 
 >Re: Killing a program started from the dock (From: Greg Guerin <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.