JDK-8188303 : Class cast exception in 2D code: sun.awt.image.BufImgSurfaceData cannot be cast to sun.java2d.xr.XRSurfaceData
  • Type: Bug
  • Component: client-libs
  • Sub-Component: 2d
  • Affected Version: 8u112
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS: linux
  • CPU: x86_64
  • Submitted: 2017-09-29
  • Updated: 2017-10-03
  • Resolved: 2017-10-03
Related Reports
Duplicate :  
Description
FULL PRODUCT VERSION :
Java(TM) SE Runtime Environment (build 1.8.0_112-b15)

ADDITIONAL OS VERSION INFORMATION :
CentOS release 6.7 (64 bit)
Linux amansvr_a 2.6.32-573.el6.x86_64 #1 SMP Thu Jul 23 15:44:03 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux 

EXTRA RELEVANT SYSTEM CONFIGURATION :
Internal Intel Graphics are used. 

A DESCRIPTION OF THE PROBLEM :
When running our desktop application with animated graphics for several minutes, the application crashes with the following back trace:

Exception in thread "AWT-EventQueue-0" java.lang.ClassCastException: sun.awt.image.BufImgSurfaceData cannot be cast to sun.java2d.xr.XRSurfaceData
at sun.java2d.xr.XRPMBlitLoops.cacheToTmpSurface(XRPMBlitLoops.java:145)
at sun.java2d.xr.XrSwToPMBlit.Blit(XRPMBlitLoops.java:353)
at sun.java2d.pipe.DrawImage.blitSurfaceData(DrawImage.java:959)
at sun.java2d.pipe.DrawImage.renderIMageCopy(DrawImage.java:577)
...

The backtrace for final calls looks the same as described within JDK-8147542 "Linux: ClassCastException when repainting after display resolution change".
 We already tried out a locally patched JDK/JRE with the fix of JDK-8147542 (URL: http://hg.openjdk.java.net/jdk9/client/jdk/rev/82ca00fa3824) applied and the problem did no longer occur.
The fix of JDK-8147542 is actually only available within JDK9 and therefore the required changes are missing in JDK8.

A possible workaround disabling the XRender pipeline is no option for us and for that reason we would like to request
a backport of the fix in JDK8. 

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
No easy how to repeat without our application environment available. But the how to repeats listed in JDK-8147542 lead to the same problem (back trace).

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Our SWING desktop application should run without any rendering based crashes.
ACTUAL -
The application crashes occasionally with the following back trace:

Exception in thread "AWT-EventQueue-0" java.lang.ClassCastException: sun.awt.image.BufImgSurfaceData cannot be cast to sun.java2d.xr.XRSurfaceData
at sun.java2d.xr.XRPMBlitLoops.cacheToTmpSurface(XRPMBlitLoops.java:145)
at sun.java2d.xr.XrSwToPMBlit.Blit(XRPMBlitLoops.java:353)
at sun.java2d.pipe.DrawImage.blitSurfaceData(DrawImage.java:959)
at sun.java2d.pipe.DrawImage.renderIMageCopy(DrawImage.java:577)

REPRODUCIBILITY :
This bug can be reproduced occasionally.

CUSTOMER SUBMITTED WORKAROUND :
Disable the XRender pipeline. But this is no option due to the fact that the X11 Server and the application do not run on the same host. Therefore the rendering without the XRender pipeline would reduce the rendering performance drastically.


SUPPORT :
YES


Comments
You do NOT file a new bug to request a backport. Also to have submitted a bug this way you need to have checked the box with the text "Check this box to indicate that you understand this is not a place to receive support. If you need a solution, please visit Oracle Java SE Support instead. "
03-10-2017

The issue is submitted with JDK 8u112 with Centos 6.7 According to submitter, when running their desktop application having animated graphics crashes after several minutes. ============== Exception in thread "AWT-EventQueue-0" java.lang.ClassCastException: sun.awt.image.BufImgSurfaceData cannot be cast to sun.java2d.xr.XRSurfaceData ============== From the provided details and submitter confirmation this is similar to JDK-8147542 which has a fix for JDK 9. Applying the fix patch from JDK-8147452 locally has resolved the issue for them. Therefore, this is a backport request for JDK 8.
03-10-2017