jvmti代理死锁 [英] jvmti agent deadlock

查看:132
本文介绍了jvmti代理死锁的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我使用Java程序运行jvmti代理时,jvm似乎遇到了死锁。
在我的jvmti代理中,我在Agent_OnLoad()中创建一个原始监视器,并在每个回调函数的开头输入该锁,并在每个回调函数的结尾退出该锁。
我不知道这种僵局的原因。

When I run my jvmti agent with a java program, it seems that jvm encounters a deadlock. In my jvmti agent, I create a single raw monitor in Agent_OnLoad() and enter that lock at the beginning of every callback function and exit that lock at the end of every callback functions. I don't know the reason of this deadlock. Is there any other possibilities of deadlocks in jvmti agents?

谢谢。

推荐答案

是的,JVMTI Agent中可能存在死锁。 JVMTI参考指出:

Yes, there is a possibility of deadlocks in JVMTI Agent. The JVMTI Reference states:


同一线程进入监视器的次数可能超过一次。线程必须
退出监视器,其次数与输入的次数相同。如果在OnLoad期间输入了
监视器(在存在附加线程之前),并且在存在附加线程时没有退出
,则认为该输入是在主线程上发生的

The same thread may enter a monitor more then once. The thread must exit the monitor the same number of times as it is entered. If a monitor is entered during OnLoad (before attached threads exist) and has not exited when attached threads come into existence, the enter is considered to have occurred on the main thread.

在这种情况下进行远程诊断可能很困难,但我建议您看看 demo JVMTI应用程序处理原始锁的使用。使用专用功能 enter_critical_section exist_critical_section 。也许有帮助,否则尝试通过调试代理来查找导致死锁的回调。

It can be difficult to make a remote diagnosis in this case, but I would suggest you take a look at how the demo JVMTI applications handle the use of raw locks. The use dedicated functions enter_critical_section and exist_critical_section. Maybe that helps, otherwise try to find the callback which results in a deadlock by debugging the agent.

这篇关于jvmti代理死锁的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆