JDK-8145085 : SA agent fails to attach to process
  • Type: Bug
  • Component: hotspot
  • Sub-Component: svc
  • Priority: P3
  • Status: Closed
  • Resolution: Withdrawn
  • Submitted: 2015-12-10
  • Updated: 2015-12-10
  • Resolved: 2015-12-10
Related Reports
Relates :  
Description
I run the following command:

java sun.jvm.hotspot.CLHSDB

and attach to a process (running the same java binary) I get the following:

hsdb> attach 28473
Attaching to process 28473, please wait...
Unable to connect to process ID 28473:

sun.jvm.hotspot.debugger.DebuggerException: Can't attach to the process
sun.jvm.hotspot.debugger.DebuggerException: sun.jvm.hotspot.debugger.DebuggerException: Can't attach to the process
	at sun.jvm.hotspot.debugger.linux.LinuxDebuggerLocal$LinuxDebuggerLocalWorkerThread.execute(LinuxDebuggerLocal.java:163)
	at sun.jvm.hotspot.debugger.linux.LinuxDebuggerLocal.attach(LinuxDebuggerLocal.java:278)
	at sun.jvm.hotspot.HotSpotAgent.attachDebugger(HotSpotAgent.java:677)
	at sun.jvm.hotspot.HotSpotAgent.setupDebuggerLinux(HotSpotAgent.java:617)
	at sun.jvm.hotspot.HotSpotAgent.setupDebugger(HotSpotAgent.java:339)
	at sun.jvm.hotspot.HotSpotAgent.go(HotSpotAgent.java:306)
	at sun.jvm.hotspot.HotSpotAgent.attach(HotSpotAgent.java:142)
	at sun.jvm.hotspot.CLHSDB.attachDebugger(CLHSDB.java:180)
	at sun.jvm.hotspot.CLHSDB.access$300(CLHSDB.java:33)
	at sun.jvm.hotspot.CLHSDB$2.attach(CLHSDB.java:75)
	at sun.jvm.hotspot.CommandProcessor$2.doit(CommandProcessor.java:406)
	at sun.jvm.hotspot.CommandProcessor.executeCommand(CommandProcessor.java:1957)
	at sun.jvm.hotspot.CommandProcessor.executeCommand(CommandProcessor.java:1927)
	at sun.jvm.hotspot.CommandProcessor.run(CommandProcessor.java:1807)
	at sun.jvm.hotspot.CLHSDB.run(CLHSDB.java:99)
	at sun.jvm.hotspot.CLHSDB.main(CLHSDB.java:40)
Caused by: sun.jvm.hotspot.debugger.DebuggerException: Can't attach to the process
	at sun.jvm.hotspot.debugger.linux.LinuxDebuggerLocal.attach0(Native Method)
	at sun.jvm.hotspot.debugger.linux.LinuxDebuggerLocal.access$100(LinuxDebuggerLocal.java:62)
	at sun.jvm.hotspot.debugger.linux.LinuxDebuggerLocal$1AttachTask.doit(LinuxDebuggerLocal.java:269)
	at sun.jvm.hotspot.debugger.linux.LinuxDebuggerLocal$LinuxDebuggerLocalWorkerThread.run(LinuxDebuggerLocal.java:138)
Error: java.lang.RuntimeException: VM.initialize() was not yet called



Comments
It works as root. Closing this bug.
10-12-2015

The last message about "VM.initialize()" is just noise caused by the real problem: lack of privileges to attach to the process. Run SA as root and it should work.
10-12-2015