Java memory dump issue

无人久伴 提交于 2019-12-01 11:29:12

问题


I have tried to create a memory dump using with below code

 **/usr/lib/jvm/j2sdk1.5-sun/bin/jmap -heap 10699**

but i got below mentioned error, anyone can help to me

Attaching to process ID 10699, please wait... Error attaching to process: sun.jvm.hotspot.debugger.DebuggerException: Can't attach to the process

I'm using java 5


回答1:


To be proactive, I'll assume you're running ubuntu. In that case, type the following:

echo 0 | sudo tee /proc/sys/kernel/yama/ptrace_scope

If you're not running ubuntu, I'll recommend that you run jmap as the same user as ran your target process




回答2:


(Assuming you're on ubuntu)

A quick fix is echo 0 | sudo tee /proc/sys/kernel/yama/ptrace_scope.

If you want this to survive a reboot, and you don't want to compromise the protection that a restricted ptrace_scope provides, I recommend using setcap cap_sys_ptrace=eip on the binaries that require ptrace. For a java developer, you can run this command (as root)

find /usr/lib/jvm -type f -perm -o+x -exec setcap cap_sys_ptrace=eip {} \;


来源:https://stackoverflow.com/questions/15810824/java-memory-dump-issue

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!