JDK-8151391 : OutOfMemoryError at com.sun.deploy.uitoolkit.impl.awt.AWTAnimationPanel2.allocateBackBuffer
  • Type: Bug
  • Component: deploy
  • Sub-Component: plugin
  • Affected Version: 8u74
  • Priority: P3
  • Status: Closed
  • Resolution: Not an Issue
  • Submitted: 2016-03-07
  • Updated: 2018-11-21
  • Resolved: 2017-01-17
Related Reports
Relates :  
Relates :  
Relates :  
Description
java.lang.OutOfMemoryError: Java heap space happened during deployment toolkit back buffer allocation, when there are plenty of heap space left.

Log started: Mon, 29 Feb 2016 11:00:25 -0500
Java Plug-in 11.74.2.31
Using JRE version 1.8.0_74-b31 Java HotSpot(TM) Client VM
...
security: The CRL support is enabled
Exception in thread "Thread-16" java.lang.OutOfMemoryError: Java heap space
        at java.awt.image.DataBufferInt.<init>(Unknown Source)
        at java.awt.image.Raster.createPackedRaster(Unknown Source)
        at java.awt.image.DirectColorModel.createCompatibleWritableRaster(Unknown Source)
        at sun.awt.Win32GraphicsConfig.createAcceleratedImage(Unknown Source)
        at sun.awt.windows.WComponentPeer.createImage(Unknown Source)
        at java.awt.Component.createImage(Unknown Source)
        at com.sun.deploy.uitoolkit.impl.awt.AWTAnimationPanel2.allocateBackBuffer(Unknown Source)
        at com.sun.deploy.uitoolkit.impl.awt.AWTAnimationPanel2.doPaint(Unknown Source)
        at com.sun.deploy.uitoolkit.impl.awt.AWTAnimationPanel2.run(Unknown Source)
        at java.lang.Thread.run(Unknown Source)

GC log:
Memory: 4k page, physical 4193784k(2607232k free), swap 8385708k(6988108k free)
CommandLine flags: -XX:InitialHeapSize=805306368 -XX:MaxHeapSize=805306368 -XX:+PrintGC -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -XX:-UseLargePagesIndividualAllocation

2.031: [GC (Allocation Failure) 2.031: [DefNew: 109094K->3526K(235968K), 0.0116185 secs]2.042:
[Tenured: 0K->3243K(524288K), 0.0110016 secs] 109094K->3243K(760256K),
[Metaspace: 8579K->8579K(9600K)], 0.0228790 secs] [Times: user=0.01 sys=0.00, real=0.02 secs]

2.054: [Full GC (Allocation Failure) 2.054:
[Tenured: 3243K->3017K(524288K), 0.0089003 secs] 3243K->3017K(760256K),
[Metaspace: 8560K->8560K(9600K)], 0.0090180 secs] [Times: user=0.02 sys=0.00, real=0.01 secs]
Comments
In the plugin log, I can see that the size of the applet is changed: IExplorerPlugin.SetObjectRects(cAxControl = 0x132e72f0, left = 29, right = 541, top = 924, bottom = 994, appletID = null, activated = true) ... IExplorerPlugin.OnSetFocus(cAxControl = 0x132e72f0) IExplorerPlugin.SetObjectRects(cAxControl = 0x132e72f0, left = 0, right = 51200, top = 0, bottom = 7000, appletID = null, activated = true) Attempting to start applet JVMInstance for 1.8.0.72.sustaining sending start applet message isRelaunch: false appletLaunchTime: 1472945751743 Parameters: launchjnlp= code=Applet.class codebase=https://.../web/applets name=Applet width=51200 archive=applet.jar mayscript=true height=7000 So the size of the applet is set to 51200��7000. It must be something on the JavaScript side in HTML page.
17-01-2017

The method doPaint() of com.sun.deploy.uitoolkit.impl.awt.AWTAnimationPanel2 allocates back buffer using allocateBackBuffer method. This back buffer is used to display Java logo animation while applet is loading. The applet size is set to 51200, 7000 which leads to OOM: doPaint >>> allocateBackBuffer(51200, 7000) allocateBackBuffer <<< createImage(51200, 7000) new DataBufferInt(51200*7000) DataBufferInt(358400000) Then one sees the exception: Exception in thread "Thread-15" java.lang.OutOfMemoryError: Java heap space So now we know the reason for OutOfMemoryError is allocation of huge data block 51200��7000. It cannot fit into the allocated heap size. For some reason, one of the three applet which are started simultaneously is launched with the incorrect size. The size of the offending applet is multiplied by 100: width=51200 height=7000 and width=512 height=70 This applet is started twice: with the size multiplied by 100, and then it's destroyed and started with the correct size.
17-01-2017