Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 5 Aug 2016 15:48:46 +0800
From:      YaoCL <chunlinyao@gmail.com>
To:        freebsd-emulation@freebsd.org
Subject:   jstack can not attach to jvm under linux emulation
Message-ID:  <EB2A3CFB-C964-478B-BCEB-AE5BFF50938D@gmail.com>

next in thread | raw e-mail | index | archive | help
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(HotSpotVirtualMachin=
e.java:261)
	at =
sun.tools.attach.HotSpotVirtualMachine.remoteDataDump(HotSpotVirtualMachin=
e.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
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
linux_clock_gettime(0x1,0x290cb958)		 =3D 0 (0x0)
linux_stat64("/tmp/.java_pid20105",0x290cbc7c,0x290cbc7c) =3D 0 (0x0)
geteuid()					 =3D 0 (0x0)
getegid()					 =3D 0 (0x0)
linux_stat64("/tmp/.java_pid20105",0x290cbd18,0x290cbd18) =3D 0 (0x0)
linux_socketcall(1,{ LINUX_SOCKET, 0x0 })	 =3D 6 (0x6)
linux_socketcall(3,{ LINUX_GETSOCKNAME, 0x6e })	 =3D 0 (0x0)
close(6)					 =3D 0 (0x0)
linux_clock_gettime(0x1,0x290cba3c)		 =3D 0 (0x0)
linux_clock_gettime(0x1,0x290cb9f8)		 =3D 0 (0x0)
linux_socketcall(1,{ LINUX_SOCKET, 0x0 })	 =3D 6 (0x6)
linux_socketcall(3,{ LINUX_GETSOCKNAME, 0x6e })	 =3D 0 (0x0)
linux_clock_gettime(0x1,0x290cb630)		 =3D 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) =3D 7 (0x7)
linux_fstat64(0x7,0x290cb580)			 =3D 0 (0x0)
linux_mmap2(0x0,0x1000,0x3,0x22,0xffffffff,0x0)	 =3D 671535104 =
(0x2806d000)
read(7,"# Locale name alias data base.\n"...,4096) =3D 2512 (0x9d0)
linux_clock_gettime(0x1,0x7c39e120)		 =3D 0 (0x0)
read(7,0x2806d000,4096)				 =3D 0 (0x0)
close(7)					 =3D 0 (0x0)
munmap(0x2806d000,4096)				 =3D 0 (0x0)
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D


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

=E2=80=94
YaoCL=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?EB2A3CFB-C964-478B-BCEB-AE5BFF50938D>