[OpenJDK 2D-Dev] RFR: JDK-8057830: Crash in Java2D Queue Flusher, OGLSD_SetScratchSurface

Hendrik Schreiber hs at tagtraum.com
Mon Sep 22 08:19:45 UTC 2014


Bug: https://bugs.openjdk.java.net/browse/JDK-8057830

On OS X, CGLGraphicsConfigInfo is destroyed by OGLGC_DestroyOGLGraphicsConfig, however the pointer to it still hangs around for a while and is not reset to NULL, until we get rid of it with a Disposer later on.

In the meantime it appears to be possible that OGLSD_SetScratchSurface is called with the already destroyed CGLGraphicsConfigInfo as argument. The CGLGraphicsConfigInfo is not NULL, but its structs are in a bad state, most likely freed, leading to the observed crash.

The suggested change does not solve the problem, of needing to NULL the pointer to CGLGraphicsConfigInfo right where it's destroyed in OGLRenderQueue.c (not really possible IMO). However, it improves the destruction by NULLing some of it struct members and thus allowing us in OGLSD_SetScratchSurface to test those for NULL values. I also added a trace call for when this happens, to aiding potentially creating a better fix in the future.

Unfortunately, I have not been able to come up with a reasonable unit test for this, therefore I cannot be certain that it solves the problem. However, as the changes are minimal and obviously harmless, I would very much appreciate it, if somebody decided to sponsor and commit this patch. I have a live application out there based on 8u20 and this is the number one reason for user-reported crashes.

Webrev: https://www.beatunes.com/download/webrev_8057830.zip

I did a full clean OS X build to test the change. Before and after I encountered the same 11 jdk_2d failures (which made me wonder whether that is normal...).



PS: I'm new to contributing OpenJDK patches, let me know, if I should have done it some other way. Thanks.

More information about the 2d-dev mailing list