On Wed, 10 Jul 2024 22:29:08 GMT, Daniel D. Daugherty <dcu...@openjdk.org> wrote:
>> Removing log() statements to fix the problem can be risky because someone >> could re-add them in the future. What about my idea of doing a short sleep >> before the vm.suspend() to make sure the main thread has advanced to the >> pipe.readln(), and won't be doing any more log calls until it gets the next >> command from the debugger (which should be "quit"). > > Adding a `sleep()` between two statements does not scale when the test in > question is under different loads or run with different options. All it will > do > is make a hang more rare (and frustrating to analyze). > > We do use short sleeps when we are in a while-loop checking on a condition > of some sort that indicates that the "thing" for which we are waiting to > happen > has happened. I believe we've done quite a few short sleeps like this in the past. Scaling is not really an issue. It should only require at most a few ms, even with -Xcomp, so we wait 1000ms and then never have to think about the timing again. This test is ugly. Sometimes you have to fight ugly with ugly. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/20088#discussion_r1673154099