Jim Fiori
2010-08-13 13:45:27 UTC
Hi,
I'm using the rexit/stop()/prun() dance to capture process exit in order to grab various procfs commands on exit. Works fine for simple program like "sleep". But for Java (and other threaded customer apps) it runs one or 2 of the p-commands, but the process goes away before I can get all I want:
$ cat exit.d
#!/usr/sbin/dtrace -qws
syscall::rexit:entry
/execname == "sleep" || execname == "java"/
{
stop();
system("pargs %d",pid);
system ("pldd %d",pid);
system ("pfiles %d",pid);
system ("pstack %d",pid);
system ("prun %d",pid);
}
$ ./exit.d&
[1] 22487
OK, now test a "sleep" exit:
bash-3.00$ sleep 5
22488: sleep 5
argv[0]: sleep
argv[1]: 5
22488: sleep 5
/lib/libc.so.1
/usr/lib/locale/en_US.ISO8859-1/en_US.ISO8859-1.so.3
22488: sleep 5
Current rlimit: 256 file descriptors
0: S_IFCHR mode:0620 dev:287,0 ino:12582952 uid:5667 gid:7 rdev:24,18
O_RDWR
/devices/pseudo/***@0:18
1: S_IFCHR mode:0620 dev:287,0 ino:12582952 uid:5667 gid:7 rdev:24,18
O_RDWR
/devices/pseudo/***@0:18
2: S_IFCHR mode:0620 dev:287,0 ino:12582952 uid:5667 gid:7 rdev:24,18
O_RDWR
/devices/pseudo/***@0:18
22488: sleep 5
feea4d18 ecvt (2, 8047290, 8047296, 0, 8047298, 8047306)
Looks like all the p-commands completed. But for java:
0$ /usr/java/bin/java -version
java version "1.5.0_20"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_20-b02)
Java HotSpot(TM) Client VM (build 1.5.0_20-b02, mixed mode, sharing)
22513: /usr/java/bin/java -version
argv[0]: /usr/java/bin/java
argv[1]: -version
22513: /usr/java/bin/java -version
/lib/libthread.so.1
/lib/libdl.so.1
/lib/libc.so.1
/usr/jdk/instances/jdk1.5.0/jre/lib/i386/client/libjvm.so
/lib/libsocket.so.1
/usr/lib/libsched.so.1
/usr/lib/libCrun.so.1
/lib/libm.so.1
/lib/libnsl.so.1
/lib/libm.so.2
/lib/libscf.so.1
/lib/libdoor.so.1
/lib/libuutil.so.1
/lib/libgen.so.1
/lib/libmd.so.1
/lib/libmp.so.2
/usr/jdk/instances/jdk1.5.0/jre/lib/i386/native_threads/libhpi.so
/usr/jdk/instances/jdk1.5.0/jre/lib/i386/libverify.so
/usr/jdk/instances/jdk1.5.0/jre/lib/i386/libjava.so
/usr/jdk/instances/jdk1.5.0/jre/lib/i386/libzip.so
/usr/lib/locale/en_US.ISO8859-1/en_US.ISO8859-1.so.3
bash-3.00$ pfiles: cannot examine 22513: no such process
pstack: cannot examine 22513: no such process or core file
prun: cannot control 22513: no such process
Any ideas? Something is telling the process to continue.
Jim
I'm using the rexit/stop()/prun() dance to capture process exit in order to grab various procfs commands on exit. Works fine for simple program like "sleep". But for Java (and other threaded customer apps) it runs one or 2 of the p-commands, but the process goes away before I can get all I want:
$ cat exit.d
#!/usr/sbin/dtrace -qws
syscall::rexit:entry
/execname == "sleep" || execname == "java"/
{
stop();
system("pargs %d",pid);
system ("pldd %d",pid);
system ("pfiles %d",pid);
system ("pstack %d",pid);
system ("prun %d",pid);
}
$ ./exit.d&
[1] 22487
OK, now test a "sleep" exit:
bash-3.00$ sleep 5
22488: sleep 5
argv[0]: sleep
argv[1]: 5
22488: sleep 5
/lib/libc.so.1
/usr/lib/locale/en_US.ISO8859-1/en_US.ISO8859-1.so.3
22488: sleep 5
Current rlimit: 256 file descriptors
0: S_IFCHR mode:0620 dev:287,0 ino:12582952 uid:5667 gid:7 rdev:24,18
O_RDWR
/devices/pseudo/***@0:18
1: S_IFCHR mode:0620 dev:287,0 ino:12582952 uid:5667 gid:7 rdev:24,18
O_RDWR
/devices/pseudo/***@0:18
2: S_IFCHR mode:0620 dev:287,0 ino:12582952 uid:5667 gid:7 rdev:24,18
O_RDWR
/devices/pseudo/***@0:18
22488: sleep 5
feea4d18 ecvt (2, 8047290, 8047296, 0, 8047298, 8047306)
Looks like all the p-commands completed. But for java:
0$ /usr/java/bin/java -version
java version "1.5.0_20"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_20-b02)
Java HotSpot(TM) Client VM (build 1.5.0_20-b02, mixed mode, sharing)
22513: /usr/java/bin/java -version
argv[0]: /usr/java/bin/java
argv[1]: -version
22513: /usr/java/bin/java -version
/lib/libthread.so.1
/lib/libdl.so.1
/lib/libc.so.1
/usr/jdk/instances/jdk1.5.0/jre/lib/i386/client/libjvm.so
/lib/libsocket.so.1
/usr/lib/libsched.so.1
/usr/lib/libCrun.so.1
/lib/libm.so.1
/lib/libnsl.so.1
/lib/libm.so.2
/lib/libscf.so.1
/lib/libdoor.so.1
/lib/libuutil.so.1
/lib/libgen.so.1
/lib/libmd.so.1
/lib/libmp.so.2
/usr/jdk/instances/jdk1.5.0/jre/lib/i386/native_threads/libhpi.so
/usr/jdk/instances/jdk1.5.0/jre/lib/i386/libverify.so
/usr/jdk/instances/jdk1.5.0/jre/lib/i386/libjava.so
/usr/jdk/instances/jdk1.5.0/jre/lib/i386/libzip.so
/usr/lib/locale/en_US.ISO8859-1/en_US.ISO8859-1.so.3
bash-3.00$ pfiles: cannot examine 22513: no such process
pstack: cannot examine 22513: no such process or core file
prun: cannot control 22513: no such process
Any ideas? Something is telling the process to continue.
Jim
--
This message posted from opensolaris.org
This message posted from opensolaris.org