RFR: 8310228: Improve error reporting for uncaught native exceptions on Windows [v3]

Daniel Jeliński djelinski at openjdk.org
Wed Sep 20 19:47:48 UTC 2023


On Wed, 20 Sep 2023 15:23:29 GMT, Jorn Vernee <jvernee at openjdk.org> wrote:

>> Prevents a stack overflow (or other fatal error) from occurring when handling an unknown exception. See JBS issue for full problem outline.
>> 
>> WRT implementation:
>> - I've refactored `Handle_FLT_Exception` to check the exception code on 64 bit Windows as well. It now returns a boolean indicating whether the exception was recognized and handled. 
>> - For x86, I've created a new Uncaugh_Exception_Handler function which implements the uncaught exception handler. This new function replaces the previous use of `Handle_FLT_Exception` as uncaught exception handler. x86 also supports exception chaining through a previous exception handler stored in `prev_uef_handler`. But, on 64 bit windows this field is never set, so we don't need to try to execute the fallback handler on 64 bit. Hence, it seemed clearer to factor out that bit to a separate function. Both the x86 and 64 bit impls call the `handle_FLT_exception` function.
>> 
>> I've tested this patch locally on Windows x64, I will need some help testing this on Windows x86 (it seems some of the test libraries are failing to build?)
>> 
>> Testing: tier 1-4
>
> Jorn Vernee has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains seven additional commits since the last revision:
> 
>  - use executeTestJvm to forward arguments
>  - Merge branch 'master' into UncaughtExWin
>  - address review comments
>  - Merge branch 'master' into UncaughtExWin
>  - remove uncaught exception string
>  - Improve reporting of uncaught native exceptions
>  - improve uncaught exception handling on Windows

Looks good.

src/hotspot/os/windows/os_windows.cpp line 288:

> 286: #endif
> 287: 
> 288: LONG WINAPI Uncaught_Exception_Handler(struct _EXCEPTION_POINTERS* exceptionInfo);

can you make this method static?

src/hotspot/os/windows/os_windows.cpp line 2539:

> 2537: #if defined(_M_AMD64) || defined(_M_IX86)
> 2538: //-----------------------------------------------------------------------------
> 2539: bool handle_FLT_exception(struct _EXCEPTION_POINTERS* exceptionInfo) {

same here

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

Marked as reviewed by djelinski (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/14523#pullrequestreview-1636372266
PR Review Comment: https://git.openjdk.org/jdk/pull/14523#discussion_r1332095574
PR Review Comment: https://git.openjdk.org/jdk/pull/14523#discussion_r1332095767


More information about the hotspot-runtime-dev mailing list