gpt4 book ai didi

deadlock - jvmti代理死锁

转载 作者:行者123 更新时间:2023-12-02 03:56:44 26 4
gpt4 key购买 nike

当我用 java 程序运行我的 jvmti 代理时,jvm 似乎遇到了死锁。在我的 jvmti 代理中,我在 Agent_OnLoad() 中创建了一个原始监视器,并在每个回调函数开始时进入该锁,并在每个回调函数结束时退出该锁。我不知道这个僵局的原因。 jvmti agents还有其他死锁的可能吗?

谢谢。

最佳答案

是的,JVMTI Agent 中可能会出现死锁。 JVMTI Reference状态:

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 applications 是如何实现的。处理原始锁的使用。使用专用函数 enter_critical_sectionexist_critical_section。也许这有帮助,否则尝试通过调试代理找到导致死锁的回调。

关于deadlock - jvmti代理死锁,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12291756/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com