RFR: 8282475: SafeFetch should not rely on existence of Thread::current [v6]

Anton Kozlov akozlov at openjdk.java.net
Thu Mar 10 12:34:43 UTC 2022


On Thu, 10 Mar 2022 10:17:31 GMT, David Holmes <dholmes at openjdk.org> wrote:

> Signal handlers are per-process not per-thread, so a thread need not be attached to the VM for our signal handlers to get involved - that is why they call Thread::current_or_null_safe().

Oh, right, thanks. I was too concentrated on thinking another platforms like windows, that missed the example will work for *nix. 

A general question to the bug. The signal mask is per-thread, and a native thread may block the JVM signal. I think safefetch will fail, if somehow we manage to call it on this thread (without jsig). So I'm not sure the safefetch is really safe on all platforms and in all contexts, that is, it always recovers from the read failure if called on a random thread.

Is there a crash that is fixed by the change? I just spotted it is an enhancement, not a bug. Just trying to understand the problem.

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

PR: https://git.openjdk.java.net/jdk/pull/7727


More information about the serviceability-dev mailing list