[foreign-jextract] RFR: 8241442: jextract spuriously crashes

Athijegannathan Sundararajan sundar at openjdk.java.net
Mon Mar 23 16:02:20 UTC 2020


On Mon, 23 Mar 2020 13:05:04 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:

> This patch fixes a spurious crash when running jextract; the problem is, again, related to the signal handlers
> installed by libclang. While we disable those by calling clang_toggleCrashRecovery soon after index creation, this
> leaves us exposed for the call to clang_createIndex itself, which set up the alternate handlers soon after function
> enter. This means that, during that call, a bad interaction between hotspot generated signals and libclang signal
> handlers can result in spurious VM crashes. This behavior started to become more apparent after this change:
> https://github.com/openjdk/panama-foreign/pull/40  Although there's nothing wrong with these changes (but they probably
> trigger different optimizations to kick in).  The fix is to set an environment variable
> `LIBCLANG_DISABLE_CRASH_RECOVERY` which is used to gate the signal override behavior, see:
> https://github.com/llvm-mirror/clang/blob/master/tools/libclang/CIndex.cpp#L3281
> 
> We do this using `putenv` on Linux/Mac and `_putenv` on Windows.

Looks good!

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

Marked as reviewed by sundar (Committer).

PR: https://git.openjdk.java.net/panama-foreign/pull/62


More information about the panama-dev mailing list