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 2025 | 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 2025 |
<== Date ==> | <== Thread ==> |
---|
Subject: | Re: CSS locks up, debugging suggestions |
From: | Richard Fearn <[email protected]> |
To: | <[email protected]> |
Date: | Wed, 12 Nov 2014 11:18:02 +0100 |
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]