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

Constructing multiple Image objects using animated GIFs concurrently can fail with AIOOBE

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P3 P3
    • tbd
    • 8, 9
    • javafx
    • x86_64
    • windows_7

      Very sporadically (about four times a year) I noticed the following exception when loading lots of animated GIFs:

      Caused by: java.lang.ArrayIndexOutOfBoundsException: 70
      at com.sun.scenario.animation.AbstractMasterTimer.addPulseReceiver(AbstractMasterTimer.java:174)
      at javafx.animation.Animation.addPulseReceiver(Animation.java:148)
      at javafx.animation.Animation.startReceiver(Animation.java:154)
      at javafx.animation.Animation.play(Animation.java:913)
      at javafx.scene.image.Image$Animation.start(Image.java:895)
      at javafx.scene.image.Image.initializeAnimatedImage(Image.java:862)
      at javafx.scene.image.Image.finishImage(Image.java:822)
      at javafx.scene.image.Image.initialize(Image.java:810)
      at javafx.scene.image.Image.<init>(Image.java:707)

      As apparently one cannot do anything wring with invoking an Image constructor, this rather looks like a bug inside of JavaFX than a user's fault. Unfortunately, due to the simplicitly of the invocation, and due to the very sporadic fail, it is rather impossible to provide more information or to set up a repeatable test case.

      Possibly the fact that the image constructor is invoked in a background thread might cause the problem. An application programmer is not aware of the fact that the constructor of Image MUST run in the JFX thread, as the image is not part of the scene graph at that moment, but as a blocking operation is used to load the image, might like to use threads. AbstractMasterTimer is definitively not thread safe, so as a result, the Image constructor isn't, too. But the JavaDocs do not warn about this fact!

            Unassigned Unassigned
            mkarg Markus Karg
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: