Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

6847157: java.lang.NullPointerException: HDC for component at sun.java2d.loops.Blit.Blit #870

Closed
wants to merge 2 commits into from

Conversation

mrserb
Copy link
Member

@mrserb mrserb commented Oct 26, 2020

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.

Progress

  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue
  • Change must be properly reviewed

Testing

Linux x32 Linux x64 Windows x64 macOS x64
Build ✔️ (1/1 passed) ✔️ (5/5 passed) ✔️ (2/2 passed) ✔️ (2/2 passed)
Test (tier1) ✔️ (9/9 passed) ✔️ (9/9 passed) ✔️ (9/9 passed)

Issue

  • JDK-6847157: java.lang.NullPointerException: HDC for component at sun.java2d.loops.Blit.Blit

Reviewers

Download

$ git fetch https://git.openjdk.java.net/jdk pull/870/head:pull/870
$ git checkout pull/870

@bridgekeeper
Copy link

bridgekeeper bot commented Oct 26, 2020

👋 Welcome back serb! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk
Copy link

openjdk bot commented Oct 26, 2020

@mrserb The following labels will be automatically applied to this pull request:

  • 2d
  • awt

When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing lists. If you would like to change these labels, use the /label pull request command.

@openjdk openjdk bot added 2d awt labels Oct 26, 2020
* @run main/othervm -Dsun.java2d.uiScale=2 RepaintOnAWTShutdown
* @run main/othervm -Dsun.java2d.uiScale=2.25 RepaintOnAWTShutdown
* @run main/othervm -Dsun.java2d.uiScale=5 RepaintOnAWTShutdown
* @run main/othervm -Dsun.java2d.uiScale=10 RepaintOnAWTShutdown
Copy link
Member Author

@mrserb mrserb Oct 26, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@mrserb
Copy link
Member Author

mrserb commented Oct 26, 2020

/label remove awt

@openjdk openjdk bot removed the awt label Oct 26, 2020
@openjdk
Copy link

openjdk bot commented Oct 26, 2020

@mrserb
The awt label was successfully removed.

@mrserb mrserb marked this pull request as ready for review Oct 26, 2020
@openjdk openjdk bot added the rfr label Oct 26, 2020
@mlbridge
Copy link

mlbridge bot commented Oct 26, 2020

Webrevs

prrace
prrace approved these changes Nov 8, 2020
@openjdk
Copy link

openjdk bot commented Nov 8, 2020

@mrserb This change now passes all automated pre-integration checks.

ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details.

After integration, the commit message for the final commit will be:

6847157: java.lang.NullPointerException: HDC for component at sun.java2d.loops.Blit.Blit

Reviewed-by: prr

You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed.

At the time when this comment was updated there had been 228 new commits pushed to the master branch:

  • f39a2c8: 8256015: Shenandoah: Add missing Shenandoah implementation in WB_isObjectInOldGen
  • ed7526a: 8247872: Upgrade HarfBuzz to the latest 2.7.2
  • 6a183fb: 8255562: delete UseRDPCForConstantTableBase
  • c5462bb: 8255989: Remove explicitly unascribed authorship from Java source files
  • 358f5d2: 6422025: ThemeReader.cpp can be updated for VC7
  • a9dff94: 8254864: vmTestbase/nsk/jvmti/ResourceExhausted/resexhausted001/TestDescription.java timed out
  • 0b7fba7: 8254270: linux 32 bit build doesn't compile libjdwp/log_messages.c
  • f5d36e6: 8246741: NetworkInterface/UniqueMacAddressesTest: mac address uniqueness test failed
  • 688b10b: 8255561: add tests to check binary compatibility rules for records
  • 727a69f: 8255969: Improve java/io/BufferedInputStream/LargeCopyWithMark.java using jtreg tags
  • ... and 218 more: https://git.openjdk.java.net/jdk/compare/b71b5b43754af423f5181ed671e82d083af00b87...master

As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details.

➡️ To integrate this PR with the above commit message to the master branch, type /integrate in a new comment.

@openjdk openjdk bot added the ready label Nov 8, 2020
@mrserb
Copy link
Member Author

mrserb commented Nov 9, 2020

/integrate

@openjdk openjdk bot closed this Nov 9, 2020
@openjdk openjdk bot added integrated and removed ready rfr labels Nov 9, 2020
@openjdk
Copy link

openjdk bot commented Nov 9, 2020

@mrserb Since your change was applied there have been 232 commits pushed to the master branch:

  • 3ce09c0: 8255920: J2DBench should support CS_PYCC color profile
  • 2c8f4e2: 8255799: AArch64: CPU_A53MAC feature may be set incorrectly
  • 2cad836: 8255575: java.awt.color.ICC_ColorSpace is not thread-safe
  • a53b12d: 8255722: Create a new test for rotated blit
  • f39a2c8: 8256015: Shenandoah: Add missing Shenandoah implementation in WB_isObjectInOldGen
  • ed7526a: 8247872: Upgrade HarfBuzz to the latest 2.7.2
  • 6a183fb: 8255562: delete UseRDPCForConstantTableBase
  • c5462bb: 8255989: Remove explicitly unascribed authorship from Java source files
  • 358f5d2: 6422025: ThemeReader.cpp can be updated for VC7
  • a9dff94: 8254864: vmTestbase/nsk/jvmti/ResourceExhausted/resexhausted001/TestDescription.java timed out
  • ... and 222 more: https://git.openjdk.java.net/jdk/compare/b71b5b43754af423f5181ed671e82d083af00b87...master

Your commit was automatically rebased without conflicts.

Pushed as commit 2d6c28d.

💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored.

@mrserb mrserb deleted the JDK-6847157 branch Nov 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2d integrated
2 participants