Change thread dump location?

Frederic Parain frederic.parain at oracle.com
Thu Apr 17 07:56:38 UTC 2014



On 04/17/2014 03:18 AM, David Holmes wrote:
> On 17/04/2014 1:54 AM, Jaromir Hamala wrote:
>> Hi,
>>
>>
>> On Tue, Apr 15, 2014 at 10:42 AM, David Holmes <david.holmes at oracle.com
>> <mailto:david.holmes at oracle.com>> wrote:
>>
>>     On 15/04/2014 7:36 PM, Staffan Larsen wrote:
>>
>>         I think this is a valid use-case and it would be good to fix it.
>>
>>         Having said that, there is currently work underway to revise the
>>         logging/output from the JVM in JDK 9 (see JEP-158). If that
>>         framework was used for the SIGQUIT threaddumps, then it would be
>>         possible to configure the output to go to a file instead of tty.
>>         Using that would be my preferred solution to this problem.
>>
>>
>>     Agreed.
>>
>>
>>         However, it is unlikely that this framework will be backported
>>         to JDK 8, so perhaps a different solution is needed there.
>>
>>
>>     I'm not convinced this is worthwhile enough to add
>>     yet-another-vm-option to specify the output file.
>>
>> What is an alternative to JVM option?
>
> There isn't one. Basically I don't think this feature is needed enough
> to warrant this change.
>
> Can't tools like jconsole/VisualVM be attached to the process before
> sending the dump request, so you can trap it there?

Could jcmd be useful in this case?

$jcmd <jvmID> Thread.print

jcmd is shipped with JDKs (not JREs) but you can use the jcmd binary
on a JRE VM. The command above prints a thread dump on the standard
output of the jcmd process (not on the output of the VM process).

Hope this help.

Fred

>> Cheers,
>> Jaromir
>>
>>
>>
>>     David
>>
>>
>>         /Staffan
>>
>>         On 15 apr 2014, at 09:45, Jaromir Hamala
>>         <jaromir.hamala at gmail.com <mailto:jaromir.hamala at gmail.com>>
>> wrote:
>>
>>             Hi David,
>>
>>             I mean a response to SIGQUIT. I'd like to add an ability to
>>             specify a
>>             file/directory where threaddumps will be written to even
>>             when stdout/err
>>             are not redirected. I believe having separated threadumps
>>             from rest of the
>>             logs might be useful when troubleshooting. It's actually not
>>             my idea -
>>             there was a user asking how to do it in other mailing-list.
>>
>>             Cheers,
>>             Jaromir
>>
>>
>>             On Tue, Apr 15, 2014 at 7:21 AM, David Holmes
>>             <david.holmes at oracle.com
>>             <mailto:david.holmes at oracle.com>>__wrote:
>>
>>                 Hi Jaromir,
>>
>>
>>                 On 11/04/2014 11:34 PM, Jaromir Hamala wrote:
>>
>>                     I'd like to create a patch allowing to change a
>>                     location of a threaddump
>>                     when it's triggered by sending a signal. My
>>                     understanding is that
>>                     currently
>>                     there is no option to specify a custom path.
>>
>>
>>                 Do you mean the thread-dump in response to SIGQUIT
>>                 (which goes to the VM's
>>                 output stream) or the hs-err log file produced when the
>>                 VM crashes?
>>
>>                 The SIGQUIT thread-dump doesn't go to a file unless you
>>                 happen to be
>>                 redirecting VM output to a file.
>>
>>                 David
>>
>>
>>                 Is this a feature you would consider to accept &
>>                 eventually merge? I'm
>>
>>                     aware one could use eg. jstack to save the
>>                     threaddump into an arbitrary
>>                     location, but this tooling is not always available
>>                     as it's part of JDK and
>>                     not JRE.
>>
>>                     Cheers,
>>                     Jaromir
>>
>>
>>
>>
>>             --
>>             “Perfection is achieved, not when there is nothing more to
>>             add, but when
>>             there is nothing left to take away.”
>>             Antoine de Saint Exupéry
>>
>>
>>
>>
>>
>> --
>> “Perfection is achieved, not when there is nothing more to add, but when
>> there is nothing left to take away.”
>> Antoine de Saint Exupéry

-- 
Frederic Parain - Oracle
Grenoble Engineering Center - France
Phone: +33 4 76 18 81 17
Email: Frederic.Parain at oracle.com


More information about the hotspot-dev mailing list