Hi:
On Linux and Mac OS you can just send a
kill -QUIT <process ID of java>
to trigger a thread dump, which will be printed on the console of the java process.
jps is a helper for getting the process ID, jstack is another way to get the same stack dump.
In the stack dump, you see the call stack of each process, the locks that each thread holds, and the locks that it's waiting on, which usually helps to determine deadlocks.
-Kay
On Nov 12, 2014, at 5:18 AM, Richard Fearn <[email protected]>
wrote:
> Hi Geoff,
>
>> Since I'm new to CSS and Java I'm interested in debugging techniques
>> others have found successful. For example, I was unprepared for not
>> being able to see all the threads as with a C or python program.
>
> Do you mean that you can't see all the threads in the output from top(1) ?
>
> First thing to do is find the pid of the VM itself. You can get this from ps(1) or using the jps tool [1] that comes with the JDK.
>
> This main process is the one that top(1) will show by default. However if you type 'H' (upper case, not lower case) top will switch to showing threads. You will then see one line for each Java thread. This might allow you to identify particular threads that are busy.
>
> Another JDK tool, jstack [2], will give you a thread dump showing what each thread is doing. Unfortunately the process IDs in the jstack output (nid=0xNNNN) are in hex, whereas in jps/top they're decimal :-)
>
> The other thing that jstack might show you, at the bottom of its output, is that there's a deadlock.
>
> Obviously the user has to leave the hanging program running for you to be able to get in there and (try to) diagnose the problem. At Diamond, we developed a simple bash script for users to run that would run jstack a few times and save the output somewhere for us to have a look at.
>
> [1] https://docs.oracle.com/javase/8/docs/technotes/tools/unix/jps.html
>
> [2] https://docs.oracle.com/javase/8/docs/technotes/tools/unix/jstack.html
>
> Rich
>
> --
>
> Richard Fearn
> Senior Software Engineer
> Integrated Control Systems division
> European Spallation Source ESS AB
> [email protected]
- References:
- CSS locks up, debugging suggestions Geoff Savage
- Re: CSS locks up, debugging suggestions Richard Fearn
- Navigate by Date:
- Prev:
Re: CSS locks up, debugging suggestions Richard Fearn
- Next:
Re: related to VDCT programming Hartman, Steven M.
- Index:
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
<2014>
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
- Navigate by Thread:
- Prev:
Re: CSS locks up, debugging suggestions Richard Fearn
- Next:
Problem Related to X-Y graph priya tiwari
- Index:
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
<2014>
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
|