Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to "strace -p" on a running JBoss process

I am trying to use "strace -p" to attach to an already running JBoss process. JBoss is using the 1.5.0_15 Java JDK. Unfortunately, this doesn't work - I only get a single futex() result:

# strace -p 3388
Process 3388 attached - interrupt to quit
[ Process PID=3388 runs in 32 bit mode. ]
futex(0x8f18f7c, FUTEX_WAIT_PRIVATE, 1, NULL <unfinished ...>

Strace works for all other programs but not JBoss. It appears to work fine when I launch the process through strace. It just doesn't work when I try to attach to an already running process.

I'm using 64-bit Linux 2.6.18 with a 32 bit Java JDK (RedHat Enterprise Linux 5.3 if it matters).

Update #1:

I did try running it with "-d", but the output doesn't appear to be any more insightful, at least to me:


[root@]# strace -d -e verbose=all -p 3388
Process 3388 attached - interrupt to quit
 [wait(0x137f) = 3388]
pid 3388 stopped, [SIGSTOP]
 [wait(0x57f) = 3388]
pid 3388 stopped, [SIGTRAP]
[ Process PID=3388 runs in 32 bit mode. ]
futex(0x8f18f7c, FUTEX_WAIT_PRIVATE, 1, NULL
like image 306
curious_george Avatar asked Jan 27 '10 23:01

curious_george


1 Answers

If there's multiple threads within that process, you'll need to give strace multiple -p options, specifying the ID of each one. It looks like you're successfully tracing the original parent thread, and it's doing nothing but waiting for some other threads to finish.

(The reason it works when you start the command from strace is that by default, strace picks up the new child processes created and traces them, too).

like image 181
caf Avatar answered Oct 02 '22 14:10

caf