I’ve run into a new issue and I’m not sure how to resolve it. When I load my Vision client, at random 2 or more of my screens will not be able to load the PNG image I have placed as a background. If I open the designer and save to force a client refresh, the images will then load. I work for an integrator so I’d like to resolve this so when we pass over the project the customer does not need to worry about it. I’ve attached a picture of the issue on launch and after a force refresh. Any and all help is appreciated!
Any errors in the logs in the client ( Ctrl + Shift + F7 to open the diagnostics if you’ve got the menubar hidden)?
How big are these images, filesize-wise?
Message: Unable to read resized image from disk cache.
Time: jue. oct. 14 12:48:44p. m.
Severity: WARN
Logger: ignition.ImageLoader
Stack Trace: javax.imageio.IIOException: Caught exception during read:
at java.desktop/com.sun.imageio.plugins.png.PNGImageReader.read(Unknown Source)
at java.desktop/javax.imageio.ImageIO.read(Unknown Source)
at java.desktop/javax.imageio.ImageIO.read(Unknown Source)
at com.inductiveautomation.ignition.client.images.ImageLoader$ImageInfo.getScaledImageImpl(ImageLoader.java:472)
at com.inductiveautomation.ignition.client.images.ImageLoader$ImageInfo$ScaledImageCacheLoader.load(ImageLoader.java:459)
at com.inductiveautomation.ignition.client.images.ImageLoader$ImageInfo$ScaledImageCacheLoader.load(ImageLoader.java:456)
at com.google.common.cache.LocalCache$LoadingValueReference.loadFuture(LocalCache.java:3708)
at com.google.common.cache.LocalCache$Segment.loadSync(LocalCache.java:2416)
at com.google.common.cache.LocalCache$Segment.lockedGetOrLoad(LocalCache.java:2299)
at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2212)
at com.google.common.cache.LocalCache.get(LocalCache.java:4147)
at com.google.common.cache.LocalCache.getOrLoad(LocalCache.java:4151)
at com.google.common.cache.LocalCache$LocalLoadingCache.get(LocalCache.java:5140)
at com.inductiveautomation.ignition.client.images.ImageLoader$ImageInfo.getScaledImage(ImageLoader.java:512)
at com.inductiveautomation.ignition.client.images.ImageLoader.loadImageMemCache(ImageLoader.java:219)
at com.inductiveautomation.ignition.client.images.ImageLoader.loadImage(ImageLoader.java:169)
at com.inductiveautomation.ignition.client.images.PathIcon$LoadImageTask.doInBackground(PathIcon.java:317)
at com.inductiveautomation.ignition.client.images.PathIcon$LoadImageTask.doInBackground(PathIcon.java:298)
at java.desktop/javax.swing.SwingWorker$1.call(Unknown Source)
at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
at java.desktop/javax.swing.SwingWorker.run(Unknown Source)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.base/java.lang.Thread.run(Unknown Source)
Caused by: java.lang.OutOfMemoryError: Java heap space
Each image for each screen is between 2 and 3MB.
I have just tried raising the min and max memory settings from default and it does not appear to have made a difference.
EDIT: Also the “Home” screen is a screen with a scaled down copy of each full screen that the user can use to navigate to the area they want to monitor, so it includes all images and has never failed to load unlike the screens with a single image.
EDIT 2: It appears that instead of being “random”, it is always the last 2 or 3 screens that I try to open will fail to load the image.
For a test, what if you set the 'Cache Policy' of each window displaying one of these large images to Never? Then, once you navigate away, the window should be totally destroyed, freeing up that memory. The tradeoff is slightly worse performance each time you have to navigate to these windows (as slow as the initial open, that is).
Can you give your clients more memory?
The code that’s failing is Java Swing code, not Ignition, and it’s failing for a fairly straightforward error - it was unable to allocate sufficient memory for the operation it wanted to perform.
Unfortunately, as a fairly old technology, Java Swing has a lot of limitations/design decisions that were made at a totally different time. For instance, basically all graphics operations in Swing happen on the CPU, with no hardware acceleration.
It is possible that there’s something we could do here to make things behave better, but anything we did wouldn’t help you in the short term. In the short term, you could try increasing the max memory further, or re-encoding these images in a different format (I would recommend trying .jpg); it’s possible simply reducing the image filesize will help with the memory issue.