0

I need to strace a multithreaded Java process that seems to have frozen. Following this advice, I ran ps -efL|grep <Process Name> to get all the threads. However, when I then ran strace -fp <thread_pid> -s 2000 I again got a bunch of lines like this:

[pid  2521] futex(0x7f91c4003c94, FUTEX_WAIT_PRIVATE, 1, NULL <unfinished ...>
[pid  2520] futex(0x7f91ac003c94, FUTEX_WAIT_PRIVATE, 1, NULL <unfinished ...>
...

where 2521, 2520, etc are PIDs of all the threads, not just the one I tried to strace. Ultimately, I am trying to determine what's wrong with the job, and it seems that to find that out, I need detailed info on what the threads are doing. How do I get that?

I Z
  • 5,719
  • 19
  • 53
  • 100
  • Do you have access to the source code of the applicacion? – Luiggi Mendoza Dec 30 '15 at 16:32
  • 5
    Use `jconsole` or `jvisualvm` to attach to the process directly. Java runs in a Virtual Machine - you _will_ get odd results from trying to monitor it directly. – Boris the Spider Dec 30 '15 at 16:33
  • @BoristheSpider Thanks. The machine I am running this on does not have `jvisualvm` installed. It does have `jconsole` but both tools are GUI-based and I only have a text-only connection to the machine. Are there any tools that are not GUI-based? – I Z Dec 30 '15 at 18:01
  • What do you mean by "text based"? SSH? Just use X forwarding... – Boris the Spider Dec 30 '15 at 18:02
  • Yes, SSH. I'll try forwarding – I Z Dec 30 '15 at 18:03
  • Otherwise you can use `kill -3` or `jstack` as described [here](https://confluence.atlassian.com/doc/generating-a-thread-dump-externally-182158040.html). – Boris the Spider Dec 30 '15 at 18:03
  • jconsole and jvisualvm allow remote connections, you just have to enable JMX in your java process. – 11thdimension Jan 01 '16 at 09:44
  • See this answer about debugging the Java process.http://stackoverflow.com/questions/34093471/object-wait-exceeds-timeout/34094144#34094144 – 11thdimension Jan 01 '16 at 10:34

0 Answers0