On Mon, 17 Jan 2022 20:56:56 GMT, Andrey Turbanov <aturba...@openjdk.org> wrote:
> Method `Thread.dispatchUncaughtException` (called by VM) uses result of of > `getUncaughtExceptionHandler`. Field `uncaughtExceptionHandler` is volatile > and can be changed by another Thread. Which could lead to NPE. > https://github.com/openjdk/jdk/blob/7b6738fa02023825ed9e602555bd5ed2b87a6ca6/src/java.base/share/classes/java/lang/Thread.java#L2007-L2009 > Read field to local variable to avoid double volatile read. This pull request has now been integrated. Changeset: f05ff996 Author: Andrey Turbanov <aturba...@openjdk.org> URL: https://git.openjdk.java.net/jdk/commit/f05ff996543d0239383d8b363fdbba15769c4aae Stats: 3 lines in 1 file changed: 0 ins; 0 del; 3 mod 8280174: Possible NPE in Thread.dispatchUncaughtException Reviewed-by: alanb ------------- PR: https://git.openjdk.java.net/jdk/pull/7117