[prev in list] [next in list] [prev in thread] [next in thread] 

List:       openjdk-2d-dev
Subject:    Re: [OpenJDK 2D-Dev] RFR: 6847157: java.lang.NullPointerException: HDC for component at sun.java2d.l
From:       Sergey Bylokhov <serb () openjdk ! java ! net>
Date:       2020-10-26 20:04:34
Message-ID: zDMg81lT-7FI2DGPLq3NLG30Whj7YcSBbbnB9e8z5fU=.afb6d7bf-5168-40b2-a45a-092854fd9adb () github ! com
[Download RAW message or body]

On Mon, 26 Oct 2020 19:45:49 GMT, Sergey Bylokhov <serb@openjdk.org> wrote:

> This is the fix for one suspicious exception which rarely but time to time occurred \
> on the test systems. As described in a few bug reports the use-cases could be quite \
> different, but I was able to reproduce it in one of them. 
> Steps to reproduce:
> 1. We draw to the frame for the first time or we draw to the frame on the thread \
> where we never draw before 2. As part of step 1. we start initialization of the \
> surface data bounded to this frame for that thread, in the native method 3. jtreg \
> decided to kill the test because the main method ends 4. As part of step 2. we \
> request HDC for the frame via sendMessage which do nothing since AWT is \
> stopping/dies -> HDC=NULL 5. As part of step 1. we try to draw to the surface -> \
> HDC is NULL -> NPE is thrown 
> The solution is to mark the surface at step 4. as invalid:
> - If the AWT will die this surface will never be used and no exception occurs
> - If the application will continue to work and this surface will be accessed then \
> we will throw InvalidPipeException in attempts to recreate the surface and all \
> related data.

test/jdk/java/awt/Paint/RepaintOnAWTShutdown.java line 51:

> 49:  * @run main/othervm -Dsun.java2d.uiScale=2.25 RepaintOnAWTShutdown
> 50:  * @run main/othervm -Dsun.java2d.uiScale=5    RepaintOnAWTShutdown
> 51:  * @run main/othervm -Dsun.java2d.uiScale=10   RepaintOnAWTShutdown

The bug depends on the CPU/GPU performance so I tried to reproduce it by tweaking the \
number of pixels to draw.

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

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


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic