JDK-8028539 : Endless loop in native code of sun.java2d.loops.ScaledBlit
  • Type: Bug
  • Component: client-libs
  • Sub-Component: 2d
  • Affected Version: 6u4,7u45,8,9
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • OS: windows_7
  • CPU: x86
  • Submitted: 2013-11-18
  • Updated: 2016-08-18
  • Resolved: 2014-10-30
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 8 JDK 9
8u40Fixed 9 b40Fixed
Description
Attached test program show an endless loop in the native code of sun.java2d.loops.ScaledBlit in EDT. The problem is a consequence of a very large value in a AffineTransform. It occur with all Java 6, Java 7 and Java 8 versions on different Windows systems. Other OS we have not tested.

Thread [AWT-EventQueue-0] (Suspended)
    owns: Component$AWTTreeLock  (id=41)
    ScaledBlit.Scale(SurfaceData, SurfaceData, Composite, Region, int, int, int, int, double, double, double, double) line: not available [native method]
    DrawImage.scaleSurfaceData(SunGraphics2D, Region, SurfaceData, SurfaceData, SurfaceType, SurfaceType, int, int, int, int, double, double, double, double) line: 985
    DrawImage.renderImageScale(SunGraphics2D, Image, Color, int, int, int, int, int, double, double, double, double) line: 642
    DrawImage.tryCopyOrScale(SunGraphics2D, Image, int, int, int, int, Color, int, double[]) line: 307
    DrawImage.transformImage(SunGraphics2D, Image, AffineTransform, int, int, int, int, int, Color) line: 260
    DrawImage.copyImage(SunGraphics2D, Image, int, int, Color) line: 80
    DrawImage.copyImage(SunGraphics2D, Image, int, int, Color, ImageObserver) line: 1011
    ValidatePipe.copyImage(SunGraphics2D, Image, int, int, Color, ImageObserver) line: 186
    SunGraphics2D.drawImage(Image, int, int, Color, ImageObserver) line: 3084
    SunGraphics2D.drawImage(Image, int, int, ImageObserver) line: 3069
    DrawImage.paintComponent(Graphics) line: 57
    DrawImage(JComponent).paint(Graphics) line: 1054
    JPanel(JComponent).paintChildren(Graphics) line: 887
    JPanel(JComponent).paint(Graphics) line: 1063
    JLayeredPane(JComponent).paintChildren(Graphics) line: 887
    JLayeredPane(JComponent).paint(Graphics) line: 1063
    JLayeredPane.paint(Graphics) line: 585
    JRootPane(JComponent).paintChildren(Graphics) line: 887
    JRootPane(JComponent).paintToOffscreen(Graphics, int, int, int, int, int, int) line: 5228
    RepaintManager$PaintManager.paintDoubleBuffered(JComponent, Image, Graphics, int, int, int, int) line: 1512
    RepaintManager$PaintManager.paint(JComponent, JComponent, Graphics, int, int, int, int) line: 1443
    RepaintManager.paint(JComponent, JComponent, Graphics, int, int, int, int) line: 1236
    JRootPane(JComponent).paint(Graphics) line: 1040
    GraphicsCallback$PaintCallback.run(Component, Graphics) line: 39
GraphicsCallback$PaintCallback(SunGraphicsCallback).runOneComponent(Component, Rectangle, Graphics, Shape, int) line: 78
GraphicsCallback$PaintCallback(SunGraphicsCallback).runComponents(Component[], Graphics, int) line: 115
    JFrame(Container).paint(Graphics) line: 1967
    JFrame(Window).paint(Graphics) line: 3877
    RepaintManager$3.run() line: 807
    RepaintManager$3.run() line: 784
    AccessController.doPrivileged(PrivilegedAction<T>, AccessControlContext) line: not available [native method]
ProtectionDomain$1.doIntersectionPrivilege(PrivilegedAction<T>, AccessControlContext, AccessControlContext) line: 76
    RepaintManager.paintDirtyRegions(Map<Component,Rectangle>) line: 784
    RepaintManager.paintDirtyRegions() line: 757
    RepaintManager.prePaintDirtyRegions() line: 706
    RepaintManager.access$1000(RepaintManager) line: 62
    RepaintManager$ProcessingRunnable.run() line: 1651
    InvocationEvent.dispatch() line: 251
    EventQueue.dispatchEventImpl(AWTEvent, Object) line: 727
    EventQueue.access$200(EventQueue, AWTEvent, Object) line: 103
    EventQueue$3.run() line: 688
    EventQueue$3.run() line: 686
    AccessController.doPrivileged(PrivilegedAction<T>, AccessControlContext) line: not available [native method]
ProtectionDomain$1.doIntersectionPrivilege(PrivilegedAction<T>, AccessControlContext, AccessControlContext) line: 76
    EventQueue.dispatchEvent(AWTEvent) line: 697
    EventDispatchThread.pumpOneEventForFilters(int) line: 242
    EventDispatchThread.pumpEventsForFilter(int, Conditional, EventFilter) line: 161
    EventDispatchThread.pumpEventsForHierarchy(int, Conditional, Component) line: 150
    EventDispatchThread.pumpEvents(int, Conditional) line: 146
    EventDispatchThread.pumpEvents(Conditional) line: 138
    EventDispatchThread.run() line: 91 
Comments
For me it doesn't hang unless I disable the D3D pipeline. However the image never appears. Looks like the rendering is short-circuited in the D3D case. The transform is a uniform scale (sx/sy) of 0.455249569707401 plus a translate of (330.10499139414804, -5.8658460197478485E9). Playing around with the numbers it seems like the problem completely goes away if you tweak the scale a little or even the transalte (!). I don't know why this is so sensitive to these values but since its a very old problem with minimal impact I can't see this as being a P3.
18-11-2013

Please evaluate CAP issue
18-11-2013