jstack can not attach to jvm under linux emulation

YaoCL chunlinyao at gmail.com
Fri Aug 5 07:48:55 UTC 2016


Hi

I am runing a java web application under FreeBSD 10.3, Because some reason we must use the Oracle JDK. It all work fine. Even the  Java Flight Recorder works fine.
I have a monitor tools require to dynamic attach to the JVM. the attach can not work.

# /usr/local/linux-oracle-jdk1.8.0/bin/jstack 20105
Exception in thread "main" java.io.IOException: Broken pipe
	at sun.tools.attach.LinuxVirtualMachine.write(Native Method)
	at sun.tools.attach.LinuxVirtualMachine.writeString(LinuxVirtualMachine.java:311)
	at sun.tools.attach.LinuxVirtualMachine.execute(LinuxVirtualMachine.java:178)
	at sun.tools.attach.HotSpotVirtualMachine.executeCommand(HotSpotVirtualMachine.java:261)
	at sun.tools.attach.HotSpotVirtualMachine.remoteDataDump(HotSpotVirtualMachine.java:218)
	at sun.tools.jstack.JStack.runThreadDump(JStack.java:181)
	at sun.tools.jstack.JStack.main(JStack.java:116)

The unix domain socket (.java_pid20105) created in /tmp folder, but when jstack write to it, It got an error.

I also tried use netcat to connect the unix socket, It also closed immediately.

truss show some message like this
=============
linux_clock_gettime(0x1,0x290cb958)		 = 0 (0x0)
linux_stat64("/tmp/.java_pid20105",0x290cbc7c,0x290cbc7c) = 0 (0x0)
geteuid()					 = 0 (0x0)
getegid()					 = 0 (0x0)
linux_stat64("/tmp/.java_pid20105",0x290cbd18,0x290cbd18) = 0 (0x0)
linux_socketcall(1,{ LINUX_SOCKET, 0x0 })	 = 6 (0x6)
linux_socketcall(3,{ LINUX_GETSOCKNAME, 0x6e })	 = 0 (0x0)
close(6)					 = 0 (0x0)
linux_clock_gettime(0x1,0x290cba3c)		 = 0 (0x0)
linux_clock_gettime(0x1,0x290cb9f8)		 = 0 (0x0)
linux_socketcall(1,{ LINUX_SOCKET, 0x0 })	 = 6 (0x6)
linux_socketcall(3,{ LINUX_GETSOCKNAME, 0x6e })	 = 0 (0x0)
linux_clock_gettime(0x1,0x290cb630)		 = 0 (0x0)
write(6,"1",1)					 ERR#32 'Broken pipe'
SIGNAL 13 (SIGPIPE)
linux_rt_sigreturn(0x290cbc18)			 ERR#32 'Broken pipe'
linux_open("/usr/share/locale/locale.alias",0x0,0666) = 7 (0x7)
linux_fstat64(0x7,0x290cb580)			 = 0 (0x0)
linux_mmap2(0x0,0x1000,0x3,0x22,0xffffffff,0x0)	 = 671535104 (0x2806d000)
read(7,"# Locale name alias data base.\n"...,4096) = 2512 (0x9d0)
linux_clock_gettime(0x1,0x7c39e120)		 = 0 (0x0)
read(7,0x2806d000,4096)				 = 0 (0x0)
close(7)					 = 0 (0x0)
munmap(0x2806d000,4096)				 = 0 (0x0)
===============


My FreeBSD version : 10.3-RELEASE-p6
idk version: linux-oracle-jdk18-8.73
linux base: linux_base-c6-6.7_1

—
YaoCL


More information about the freebsd-emulation mailing list