GC暂停并杀死-STOP会产生相同的行为吗? [英] Do GC pauses and kill -STOP produce the same behavior?

查看:90
本文介绍了GC暂停并杀死-STOP会产生相同的行为吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我看到Java客户端应用程序在现场崩溃,我认为这是因为它连接的服务器经历了12秒的完全GC暂停。但是,当我尝试在本地从Eclipse运行客户机/服务器并使用kill -STOP重新执行行为并杀死-CONT以模拟服务器上的GC暂停时,我无法让客户机应用程序崩溃 - 它只是旋转,直到我杀了-CONT。



我想弄清楚GC停顿是否真的是问题(如果不是,我需要潜入看看还有什么可以进行的代码)。在长时间的GC暂停和接收kill -STOP之后再执行kill -CONT有什么不同?

解决方案

是一个区别。至少,垃圾收集器在GC暂停期间正在操作和分析对象,并且在 kill -STOP 过程中不会这样做。



此外,垃圾回收器将调用可能存在崩溃错误位置的终结器,并且此行为不会通过 kill -STOP


I'm seeing a Java client application crash in the field, and I think it's because the server it's connecting to experienced a 12 second full GC pause. However, when I try to run the client / server locally out of Eclipse and reproduce the behavior using kill -STOP and kill -CONT to simulate a GC pause on the server, I'm not able to get the client application to crash--it just spins until I do kill -CONT.

I'd like to figure out if the GC pause is actually the issue (if not I'll need to dive into the code to see what else could be going on). Is there a difference in behavior between undergoing a long GC pause and receiving kill -STOP followed by kill -CONT?

解决方案

There certainly is a difference. At the very least, the garbage collector is operating and parsing objects during a GC pause, and it is not doing so during a kill -STOP.

Furthermore, the garbage collector will be calling finalizers which could potentially be where your crash bug is located, and this behaviour would not be duplicatable via kill -STOP.

这篇关于GC暂停并杀死-STOP会产生相同的行为吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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