Do GC pauses and kill -STOP produce the same behavior?

我只是一个虾纸丫 提交于 2019-12-12 13:16:05

问题


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?


回答1:


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.



来源:https://stackoverflow.com/questions/18221158/do-gc-pauses-and-kill-stop-produce-the-same-behavior

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