Can‘t attach to the process: ptrace(PTRACE_ATTACH, ..)
.因?yàn)樾掳娴腖inux系統(tǒng)加入了?ptrace-scope?機(jī)制,該機(jī)制的目的是防止用戶訪問正在執(zhí)行的進(jìn)程的內(nèi)存,但是如jinfo,jmap這些調(diào)試類工具本身就是利用ptrace來獲取執(zhí)行進(jìn)程的內(nèi)存等信息。
?
Attaching to process ID 21530, please wait...
Error attaching to process: sun.jvm.hotspot.debugger.DebuggerException: Can't attach to the process: ptrace(PTRACE_ATTACH, ..) failed for 21530: 不允許的操作
sun.jvm.hotspot.debugger.DebuggerException: sun.jvm.hotspot.debugger.DebuggerException: Can't attach to the process: ptrace(PTRACE_ATTACH, ..) failed for 21530: 不允許的操作
?? ?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:671)
?? ?at sun.jvm.hotspot.HotSpotAgent.setupDebuggerLinux(HotSpotAgent.java:611)
?? ?at sun.jvm.hotspot.HotSpotAgent.setupDebugger(HotSpotAgent.java:337)
?? ?at sun.jvm.hotspot.HotSpotAgent.go(HotSpotAgent.java:304)
?? ?at sun.jvm.hotspot.HotSpotAgent.attach(HotSpotAgent.java:140)
?? ?at sun.jvm.hotspot.tools.Tool.start(Tool.java:185)
?? ?at sun.jvm.hotspot.tools.Tool.execute(Tool.java:118)
?? ?at sun.jvm.hotspot.tools.JInfo.main(JInfo.java:138)
?? ?at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
?? ?at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
?? ?at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
?? ?at java.lang.reflect.Method.invoke(Method.java:498)
?? ?at sun.tools.jinfo.JInfo.runTool(JInfo.java:108)
?? ?at sun.tools.jinfo.JInfo.main(JInfo.java:76)
Caused by: sun.jvm.hotspot.debugger.DebuggerException: Can't attach to the process: ptrace(PTRACE_ATTACH, ..) failed for 21530: 不允許的操作
?? ?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)
?
解決方案:
root@Desktop:/home/appleyuchi# sysctl -w kernel.yama.ptrace_scope=0
總結(jié)
以上是生活随笔為你收集整理的Can‘t attach to the process: ptrace(PTRACE_ATTACH, ..)的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 民间传说的故事20个大全
- 下一篇: 小米三款65W氮化镓充电器选哪款 小米氮