java.lang.OutOfMemoryError

There are no available Samebug tips for this exception. Do you have an idea how to solve this issue? A short tip would help users who saw this issue last week.

  • FULL PRODUCT VERSION : java version "1.8.0_112-ea" Java(TM) SE Runtime Environment (build 1.8.0_112-ea-b02) Java HotSpot(TM) 64-Bit Server VM (build 25.112-b02, mixed mode) (Happens on 1.8.0_91 and Java 9-ea too) ADDITIONAL OS VERSION INFORMATION : Linux 64-bit (Debian) A DESCRIPTION OF THE PROBLEM : Calls to Accessor.getPageFor(WebEngine).getOwnerElement(long) and Accessor.getPageFor(WebEngine).getDocument(long) leak memory (heap space) when a webpage has an image resource. STEPS TO FOLLOW TO REPRODUCE THE PROBLEM : Let the attached code run for ~30-60 seconds. EXPECTED VERSUS ACTUAL BEHAVIOR : EXPECTED - The attached code should run indefinitely. ACTUAL - Out of memory errors occur (heap space). ERROR MESSAGES/STACK TRACES THAT OCCUR : Exception in thread "JavaFX Application Thread" java.lang.OutOfMemoryError: Java heap space at java.nio.HeapByteBuffer.<init>(HeapByteBuffer.java:57) at java.nio.ByteBuffer.allocate(ByteBuffer.java:335) at com.sun.javafx.iio.png.PNGImageLoader2.load(PNGImageLoader2.java:652) at com.sun.javafx.iio.ImageStorage.loadAll(ImageStorage.java:364) at com.sun.javafx.iio.ImageStorage.loadAll(ImageStorage.java:274) at com.sun.javafx.webkit.prism.WCImageDecoderImpl.loadFrames(WCImageDecoderImpl.java:179) at com.sun.javafx.webkit.prism.WCImageDecoderImpl.loadFrames(WCImageDecoderImpl.java:192) at com.sun.javafx.webkit.prism.WCImageDecoderImpl.getImageFrame(WCImageDecoderImpl.java:292) at com.sun.javafx.webkit.prism.WCImageDecoderImpl.getFrame(WCImageDecoderImpl.java:251) at com.sun.webkit.WebPage.twkUpdateContent(Native Method) at com.sun.webkit.WebPage.updateDirty(WebPage.java:296) at com.sun.webkit.WebPage.updateContent(WebPage.java:615) at com.sun.javafx.sg.prism.web.NGWebView.update(NGWebView.java:74) at javafx.scene.web.WebView.handleStagePulse(WebView.java:999) at javafx.scene.web.WebView.lambda$new$29(WebView.java:280) at javafx.scene.web.WebView$$Lambda$96/451391812.pulse(Unknown Source) at com.sun.javafx.tk.Toolkit.lambda$runPulse$30(Toolkit.java:355) at com.sun.javafx.tk.Toolkit$$Lambda$154/1357067674.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at com.sun.javafx.tk.Toolkit.runPulse(Toolkit.java:354) at com.sun.javafx.tk.Toolkit.firePulse(Toolkit.java:378) at com.sun.javafx.tk.quantum.QuantumToolkit.pulse(QuantumToolkit.java:510) at com.sun.javafx.tk.quantum.QuantumToolkit.pulse(QuantumToolkit.java:490) at com.sun.javafx.tk.quantum.QuantumToolkit.lambda$runToolkit$404(QuantumToolkit.java:319) at com.sun.javafx.tk.quantum.QuantumToolkit$$Lambda$45/183263726.run(Unknown Source) at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95) at com.sun.glass.ui.gtk.GtkApplication._runLoop(Native Method) at com.sun.glass.ui.gtk.GtkApplication.lambda$null$49(GtkApplication.java:139) at com.sun.glass.ui.gtk.GtkApplication$$Lambda$41/1535128843.run(Unknown Source) at java.lang.Thread.run(Thread.java:745) Exception in thread "JavaFX Application Thread" java.lang.OutOfMemoryError: Java heap space Exception in thread "JavaFX Application Thread" java.lang.OutOfMemoryError: Java heap space Exception in thread "JavaFX Application Thread" java.lang.OutOfMemoryError: Java heap space Exception in thread "JavaFX Application Thread" java.lang.OutOfMemoryError: Java heap space Exception in thread "JavaFX Application Thread" java.lang.OutOfMemoryError: Java heap space Exception in thread "JavaFX Application Thread" java.lang.OutOfMemoryError: Java heap space Exception in thread "JavaFX Application Thread" java.lang.OutOfMemoryError: Java heap space Exception in thread "JavaFX Application Thread" java.lang.OutOfMemoryError: Java heap space Exception in thread "JavaFX Application Thread" java.lang.OutOfMemoryError: Java heap space Exception in thread "JavaFX Application Thread" java.lang.OutOfMemoryError: Java heap space Exception in thread "JavaFX Application Thread" java.lang.OutOfMemoryError: Java heap space Exception in thread "JavaFX Application Thread" java.lang.OutOfMemoryError: Java heap space Exception in thread "JavaFX Application Thread" java.lang.OutOfMemoryError: Java heap space Exception in thread "JavaFX Application Thread" java.lang.OutOfMemoryError: Java heap space Exception in thread "JavaFX Application Thread" java.lang.OutOfMemoryError: Java heap space Exception in thread "JavaFX Application Thread" java.lang.OutOfMemoryError: Java heap space Exception in thread "JavaFX Application Thread" java.lang.OutOfMemoryError: Java heap space Exception in thread "JavaFX Application Thread" java.lang.OutOfMemoryError: Java heap space Exception in thread "JavaFX Application Thread" java.lang.OutOfMemoryError: Java heap space Exception in thread "JavaFX Application Thread" java.lang.OutOfMemoryError: Java heap space Exception in thread "JavaFX Application Thread" java.lang.OutOfMemoryError: Java heap space Exception in thread "JavaFX Application Thread" java.lang.OutOfMemoryError: Java heap space Exception in thread "JavaFX Application Thread" java.lang.OutOfMemoryError: Java heap space Exception in thread "JavaFX Application Thread" java.lang.OutOfMemoryError: Java heap space Exception in thread "JavaFX Application Thread" java.lang.OutOfMemoryError: Java heap space Exception in thread "JavaFX Application Thread" java.lang.OutOfMemoryError: Java heap space Exception in thread "JavaFX Application Thread" java.lang.OutOfMemoryError: Java heap space Exception in thread "JavaFX Application Thread" java.lang.OutOfMemoryError: Java heap space Exception in thread "JavaFX Application Thread" java.lang.OutOfMemoryError: Java heap space Exception in thread "JavaFX Application Thread" java.lang.OutOfMemoryError: Java heap space Exception in thread "JavaFX Application Thread" java.lang.OutOfMemoryError: Java heap space Exception in thread "JavaFX Application Thread" java.lang.OutOfMemoryError: Java heap space Exception in thread "JavaFX Application Thread" java.lang.OutOfMemoryError: Java heap space Exception in thread "JavaFX Application Thread" java.lang.OutOfMemoryError: Java heap space Exception in thread "JavaFX Application Thread" java.lang.OutOfMemoryError: Java heap space Exception in thread "JavaFX Application Thread" java.lang.OutOfMemoryError: Java heap space Exception in thread "JavaFX Application Thread" java.lang.OutOfMemoryError: Java heap space Exception in thread "JavaFX Application Thread" java.lang.OutOfMemoryError: Java heap space Exception in thread "JavaFX Application Thread" java.lang.OutOfMemoryError: Java heap space Exception in thread "JavaFX Application Thread" java.lang.OutOfMemoryError: GC overhead limit exceeded REPRODUCIBILITY : This bug can be reproduced always. ---------- BEGIN SOURCE ---------- package com.machinepublishers.jbrowserdriver.diagnostics; import java.io.BufferedReader; import java.io.DataOutputStream; import java.io.IOException; import java.io.InputStreamReader; import java.net.InetAddress; import java.net.ServerSocket; import java.net.Socket; import java.util.Base64; import com.sun.javafx.webkit.Accessor; import com.sun.webkit.LoadListenerClient; import javafx.application.Application; import javafx.scene.Scene; import javafx.scene.layout.StackPane; import javafx.scene.web.WebEngine; import javafx.scene.web.WebView; import javafx.stage.Stage; public class SimpleWebView extends Application { private static final int PORT = 9000; @Override public void start(Stage stage) throws Exception { StackPane root = new StackPane(); WebView view = new WebView(); WebEngine engine = view.getEngine(); engine.load("http://127.0.0.1:" + PORT); root.getChildren().add(view); Accessor.getPageFor(engine).addLoadListenerClient(new LoadListenerClient() { @Override public void dispatchResourceLoadEvent(long frame, int state, String url, String contentType, double progress, int errorCode) {} @Override public void dispatchLoadEvent(long frame, int state, String url, String contentType, double progress, int errorCode) { Accessor.getPageFor(engine).getOwnerElement(frame); //leaks memory Accessor.getPageFor(engine).getDocument(frame); //also leaks memory if (state == LoadListenerClient.PAGE_FINISHED) { engine.load("http://127.0.0.1:" + PORT); } } }); Scene scene = new Scene(root, 100, 100); stage.setScene(scene); stage.show(); } public static void main(String[] args) throws IOException, InterruptedException { launchServer(PORT); Application.launch(args); } private static final byte[] indexBody; private static final byte[] indexHeaders; private static final byte[] imageBody; private static final byte[] imageHeaders; static { indexBody = "<html><head></head><body><img src=\"/image.png\"></body></html>".getBytes(); indexHeaders = headers(indexBody, "text/html"); imageBody = Base64.getDecoder().decode( "iVBORw0KGgoAAAANSUhEUgAAAyAAAAMgCAIAAABUEpE/AAAHW0lEQVR42u3BAQEAAACCIP+vbkhAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAA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AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHwaUNMAAWZG6bQAAAAASUVORK5CYII="); imageHeaders = headers(imageBody, "image/png"); } private static byte[] headers(byte[] body, String contentType) { byte[] headersTmp = null; headersTmp = new String("HTTP/1.1 200 OK\n" + "Content-Type: " + contentType + "\n" + "Content-Length: " + body.length + "\n" + "Cache-Control: no-cache, no-store\n" + "Connection: close\n\n").getBytes(); return headersTmp; } public static void launchServer(int port) { new Thread(new Runnable() { @Override public void run() { try (ServerSocket serverSocket = new ServerSocket(port, Integer.MAX_VALUE, InetAddress.getByName("127.0.0.1"))) { while (true) { try (Socket socket = serverSocket.accept(); DataOutputStream output = new DataOutputStream(socket.getOutputStream()); BufferedReader reader = new BufferedReader(new InputStreamReader(socket.getInputStream()))) { for (String line; (line = reader.readLine()) != null;) { if (line.startsWith("GET / ")) { output.write(indexHeaders, 0, indexHeaders.length); output.write(indexBody, 0, indexBody.length); } else if (line.startsWith("GET /image.png")) { output.write(imageHeaders, 0, imageHeaders.length); output.write(imageBody, 0, imageBody.length); } } } } } catch (Throwable t) {} } }).start(); } } ---------- END SOURCE ----------
    via by Webbug Group,
  • GitHub comment 1298#120359671
    via GitHub by tomikiss
    ,
  • GitHub comment 1298#120398501
    via GitHub by tomikiss
    ,
  • JRakLibPlus Integration
    via GitHub by DefinitlyEvil
    ,
  • GitHub comment 1646#78652871
    via GitHub by ctrueden
    ,
  • Understand heap dump in JVM
    via Stack Overflow by user697911
    ,
  • hive query {code} select aaa, sum(bbb) from ( select ... from access_log where yyyymmdd='20160224' AND ... )x group by aaa {code} stacktrace {code} java.lang.OutOfMemoryError: Java heap space at org.apache.hadoop.hive.ql.exec.tez.TezProcessor.initializeAndRunProcessor(TezProcessor.java:157) at org.apache.hadoop.hive.ql.exec.tez.TezProcessor.run(TezProcessor.java:137) at org.apache.tez.runtime.LogicalIOProcessorRuntimeTask.run(LogicalIOProcessorRuntimeTask.java:344) at org.apache.tez.runtime.task.TezTaskRunner$TaskRunnerCallable$1.run(TezTaskRunner.java:179) at org.apache.tez.runtime.task.TezTaskRunner$TaskRunnerCallable$1.run(TezTaskRunner.java:171) at java.security.AccessController.doPrivileged(Native Method) at javax.security.auth.Subject.doAs(Subject.java:422) at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1657) at org.apache.tez.runtime.task.TezTaskRunner$TaskRunnerCallable.callInternal(TezTaskRunner.java:171) at org.apache.tez.runtime.task.TezTaskRunner$TaskRunnerCallable.callInternal(TezTaskRunner.java:167) at org.apache.tez.common.CallableWithNdc.call(CallableWithNdc.java:36) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745) Caused by: java.lang.OutOfMemoryError: Java heap space at java.nio.HeapByteBuffer.<init>(HeapByteBuffer.java:57) at java.nio.ByteBuffer.allocate(ByteBuffer.java:335) at org.apache.tez.runtime.library.common.sort.impl.PipelinedSorter.<init>(PipelinedSorter.java:172) at org.apache.tez.runtime.library.common.sort.impl.PipelinedSorter.<init>(PipelinedSorter.java:116) at org.apache.tez.runtime.library.output.OrderedPartitionedKVOutput.start(OrderedPartitionedKVOutput.java:142) at org.apache.hadoop.hive.ql.exec.tez.MapRecordProcessor.init(MapRecordProcessor.java:142) at org.apache.hadoop.hive.ql.exec.tez.TezProcessor.initializeAndRunProcessor(TezProcessor.java:147) ... 14 more {code}
    via by Wataru Yukawa,
  • OOM under high write throughputs on 2.2.5
    via by Zhiyan Shao,
    • java.lang.OutOfMemoryError: Java heap space at java.nio.HeapByteBuffer.<init>(HeapByteBuffer.java:57) at java.nio.ByteBuffer.allocate(ByteBuffer.java:335) at com.sun.javafx.iio.png.PNGImageLoader2.load(PNGImageLoader2.java:652) at com.sun.javafx.iio.ImageStorage.loadAll(ImageStorage.java:364) at com.sun.javafx.iio.ImageStorage.loadAll(ImageStorage.java:274) at com.sun.javafx.webkit.prism.WCImageDecoderImpl.loadFrames(WCImageDecoderImpl.java:179) at com.sun.javafx.webkit.prism.WCImageDecoderImpl.loadFrames(WCImageDecoderImpl.java:192) at com.sun.javafx.webkit.prism.WCImageDecoderImpl.getImageFrame(WCImageDecoderImpl.java:292) at com.sun.javafx.webkit.prism.WCImageDecoderImpl.getFrame(WCImageDecoderImpl.java:251) at com.sun.webkit.WebPage.twkUpdateContent(Native Method) at com.sun.webkit.WebPage.updateDirty(WebPage.java:296) at com.sun.webkit.WebPage.updateContent(WebPage.java:615) at com.sun.javafx.sg.prism.web.NGWebView.update(NGWebView.java:74) at javafx.scene.web.WebView.handleStagePulse(WebView.java:999) at javafx.scene.web.WebView.lambda$new$29(WebView.java:280)

    Users with the same issue

    tyson925tyson925
    3 times, last one,
    Unknown visitor
    Unknown visitor1 times, last one,
    rexgreenzarexgreenza
    1 times, last one,
    Unknown visitor
    Unknown visitor1 times, last one,
    Unknown visitor
    Unknown visitor1 times, last one,
    12 more bugmates