RFR: 8282379: [LOOM] vmTestbase/nsk/jdi/ClassType/invokeMethod/invokemethod011 sometimes fails

Chris Plummer cjplummer at openjdk.org
Mon Feb 6 19:04:50 UTC 2023


On Mon, 6 Feb 2023 00:34:38 GMT, David Holmes <dholmes at openjdk.org> wrote:

> Relying on `sleep(0)` to avoid the problem with virtual threads seems fragile - what if the action of that changes for VTs in the future? In any case the use of `sleep(0)` needs to be documented so it doesn't get changed back, or converted to the logically equivalent `Thread.yield`.

I could just remove the sleep(0) call altogether, or I could make the original sleep(400) call conditional on not being a virtual thread, although I don't like that solution so much. In either case is sounds like you want a comment. A more general one would simply state not to call anything that might block since other threads are suspended. Now that I think of it, it seems like the two display() calls could block since they do I/O, although the way this test is run it seems they never do. I bet if you had some other thread(s) doing display() calls at the same time, and one of them got suspended in the middle of the display, then you might see issues.

-------------

PR: https://git.openjdk.org/jdk/pull/12420


More information about the serviceability-dev mailing list