Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8333374

Cannot invoke "com.sun.prism.RTTexture.contentsUseful()" because "this.txt" is null

XMLWordPrintable

    • b13

        Running a WebView that generates a javascript animation, many times, even without waiting for it to end, can lead to exceptions, especially if the graphic resources are limited. The issue has been found with recent JavaFX versions (21, 23-ea), on Windows and macOS.

        On Windows:

        May 31, 2024 6:59:25 PM com.sun.javafx.webkit.prism.PrismInvoker runOnRenderThread
        SEVERE: RenderJob error
        java.util.concurrent.ExecutionException: java.lang.NullPointerException: Cannot invoke "com.sun.prism.RTTexture.contentsUseful()" because "this.txt" is null
                at java.base/java.util.concurrent.FutureTask.report(FutureTask.java:122)
                at java.base/java.util.concurrent.FutureTask.get(FutureTask.java:191)
                at javafx.web@23-ea/com.sun.javafx.webkit.prism.PrismInvoker.runOnRenderThread(PrismInvoker.java:93)
                at javafx.web@23-ea/com.sun.javafx.webkit.prism.RTImage.getPixelBuffer(RTImage.java:203)
                at javafx.web@23-ea/com.sun.webkit.MainThread.twkScheduleDispatchFunctions(Native Method)
                at javafx.web@23-ea/com.sun.webkit.MainThread.lambda$fwkScheduleDispatchFunctions$0(MainThread.java:35)
                at javafx.graphics@23-ea/com.sun.javafx.application.PlatformImpl.lambda$runLater$10(PlatformImpl.java:456)
                at java.base/java.security.AccessController.doPrivileged(AccessController.java:400)
                at javafx.graphics@23-ea/com.sun.javafx.application.PlatformImpl.lambda$runLater$11(PlatformImpl.java:455)
                at javafx.graphics@23-ea/com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
        Caused by: java.lang.NullPointerException: Cannot invoke "com.sun.prism.RTTexture.contentsUseful()" because "this.txt" is null
                at javafx.web@23-ea/com.sun.javafx.webkit.prism.RTImage.getTexture(RTImage.java:118)
                at javafx.web@23-ea/com.sun.javafx.webkit.prism.RTImage.getGraphics(RTImage.java:93)
                at javafx.web@23-ea/com.sun.javafx.webkit.prism.WCBufferedContext.getGraphics(WCBufferedContext.java:65)
                at javafx.web@23-ea/com.sun.javafx.webkit.prism.WCGraphicsPrismContext.getPlatformGraphics(WCGraphicsPrismContext.java:127)
                at javafx.web@23-ea/com.sun.javafx.webkit.prism.WCGraphicsPrismContext.isValid(WCGraphicsPrismContext.java:132)
                at javafx.web@23-ea/com.sun.webkit.graphics.WCRenderQueue.decode(WCRenderQueue.java:107)
                at javafx.web@23-ea/com.sun.webkit.graphics.WCImage.flushRQ(WCImage.java:64)
                at javafx.web@23-ea/com.sun.javafx.webkit.prism.RTImage.lambda$getPixelBuffer$2(RTImage.java:209)
                at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:572)
                at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:317)
                at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:572)
                at java.base/java.util.concurrent.FutureTask.runAndReset(FutureTask.java:358)
                at javafx.graphics@23-ea/com.sun.javafx.tk.RenderJob.run(RenderJob.java:58)
                at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
                at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
                at javafx.graphics@23-ea/com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.run(QuantumRenderer.java:126)
                at java.base/java.lang.Thread.run(Thread.java:1583)

        on macOS:

        May 31, 2024 8:55:16 PM com.sun.javafx.webkit.prism.PrismInvoker runOnRenderThread
        SEVERE: RenderJob error
        java.util.concurrent.ExecutionException: java.lang.NullPointerException: Cannot invoke "com.sun.prism.RTTexture.contentsUseful()" because "this.txt" is null
                at java.base/java.util.concurrent.FutureTask.report(FutureTask.java:122)
                at java.base/java.util.concurrent.FutureTask.get(FutureTask.java:191)
                at javafx.web@23-ea/com.sun.javafx.webkit.prism.PrismInvoker.runOnRenderThread(PrismInvoker.java:93)
                at javafx.web@23-ea/com.sun.javafx.webkit.prism.RTImage.getPixelBuffer(RTImage.java:203)
                at javafx.web@23-ea/com.sun.webkit.Timer.twkFireTimerEvent(Native Method)
                at javafx.web@23-ea/com.sun.webkit.Timer.fireTimerEvent(Timer.java:84)
                at javafx.web@23-ea/com.sun.webkit.Timer.notifyTick(Timer.java:65)
                at javafx.web@23-ea/javafx.scene.web.WebEngine$PulseTimer.lambda$static$0(WebEngine.java:1205)
                at javafx.graphics@23-ea/com.sun.javafx.application.PlatformImpl.lambda$runLater$10(PlatformImpl.java:456)
                at java.base/java.security.AccessController.doPrivileged(AccessController.java:400)
                at javafx.graphics@23-ea/com.sun.javafx.application.PlatformImpl.lambda$runLater$11(PlatformImpl.java:455)
                at javafx.graphics@23-ea/com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
        Caused by: java.lang.NullPointerException: Cannot invoke "com.sun.prism.RTTexture.contentsUseful()" because "this.txt" is null
                at javafx.web@23-ea/com.sun.javafx.webkit.prism.RTImage.getTexture(RTImage.java:118)
                at javafx.web@23-ea/com.sun.javafx.webkit.prism.RTImage.getGraphics(RTImage.java:93)
                at javafx.web@23-ea/com.sun.javafx.webkit.prism.WCBufferedContext.getGraphics(WCBufferedContext.java:65)
                at javafx.web@23-ea/com.sun.javafx.webkit.prism.WCGraphicsPrismContext.getPlatformGraphics(WCGraphicsPrismContext.java:127)
                at javafx.web@23-ea/com.sun.javafx.webkit.prism.WCGraphicsPrismContext.isValid(WCGraphicsPrismContext.java:132)
                at javafx.web@23-ea/com.sun.webkit.graphics.WCRenderQueue.decode(WCRenderQueue.java:107)
                at javafx.web@23-ea/com.sun.webkit.graphics.WCImage.flushRQ(WCImage.java:64)
                at javafx.web@23-ea/com.sun.javafx.webkit.prism.RTImage.lambda$getPixelBuffer$2(RTImage.java:209)
                at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:572)
                at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:317)
                at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:572)
                at java.base/java.util.concurrent.FutureTask.runAndReset(FutureTask.java:358)
                at javafx.graphics@23-ea/com.sun.javafx.tk.RenderJob.run(RenderJob.java:58)
                at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
                at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
                at javafx.graphics@23-ea/com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.run(QuantumRenderer.java:126)
                at java.base/java.lang.Thread.run(Thread.java:1583)

        The attached test reproduces the issue.

        Unzip the html file, run the application, and select one row of the tableView to generate the animation. Then go selecting one after the other, without waiting, and at some point the exception will show up. Resizing the stage also helps.

        Note that the test has a very low Vram value (40 MB), way lower than the default 512 MB, but this is just to get the exception faster.

        While the pool of resources is perfectly capable of dealing with resource management under such limit, the logs show that at some point the resources are pruned from the pool:

        Pruning obsolete in pool: D3D Vram Pool
        Pruning unuseful older than 1024 in pool: D3D Vram Pool
        Pruning unuseful older than 512 in pool: D3D Vram Pool
        Pruning unuseful older than 10 in pool: D3D Vram Pool
        Pruning all older than 1024 in pool: D3D Vram Pool
        Pruning all older than 512 in pool: D3D Vram Pool
        Pruning all older than 100 in pool: D3D Vram Pool
        Pruning everything in pool: D3D Vram Pool

        or

        Pruning obsolete in pool: ES2 Vram Pool
        Pruning unuseful older than 1024 in pool: ES2 Vram Pool
        Pruning unuseful older than 512 in pool: ES2 Vram Pool
        Pruning unuseful older than 10 in pool: ES2 Vram Pool
        Pruning all older than 1024 in pool: ES2 Vram Pool
        Pruning all older than 512 in pool: ES2 Vram Pool
        Pruning all older than 100 in pool: ES2 Vram Pool
        Pruning everything in pool: ES2 Vram Pool
        Last chance pruning in pool: ES2 Vram Pool

        there is sometimes a texture that is removed, but it is still being referred down the line, causing the NPE.

              lkostyra Lukasz Kostyra
              jpereda Jose Pereda
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

                Created:
                Updated:
                Resolved: