Hi,
Aspose slides for java seems to leak file descriptors when running under Amazon Correto 8 on Linux. I tested this using version 23.10 and 23.11 - for one presentation the file “com/aspose/slides/ms/core/resources/System/Globalization/patterns.dat” was opened more than 800 times and not released when cycling through slildes of a 20-slide powerpoint and exporting slides to thumbnails. This is causing “too many open files” errors occasionally, as the underlying operating system runs out of open file handles. It manifests itself as a weird “class bot found” error later, when the library tries to load some additional classes - an example stack trace is below (/var/task is the root of the project where the aspose slides library is in the class path)
Exception in thread "main" java.lang.NoClassDefFoundError: com/aspose/slides/internal/up/x3
at com.aspose.slides.zmt.dq(Unknown Source)
at com.aspose.slides.zmt.dq(Unknown Source)
at com.aspose.slides.b1.ot(Unknown Source)
at com.aspose.slides.b1.dq(Unknown Source)
at com.aspose.slides.lta.ot(Unknown Source)
at com.aspose.slides.lta.dq(Unknown Source)
at com.aspose.slides.lta.dq(Unknown Source)
at com.aspose.slides.lta.dq(Unknown Source)
at com.aspose.slides.Slide.dq(Unknown Source)
at com.aspose.slides.Slide.ot(Unknown Source)
at com.aspose.slides.Slide.getThumbnail(Unknown Source)
at com.videopuppet.aspose.MediaExtractor.extractImage(MediaExtractor.java:110)
at com.videopuppet.aspose.Convert.convertSlide(Convert.java:215)
at com.videopuppet.aspose.Console.main(Console.java:38)
Caused by: java.lang.ClassNotFoundException: com.aspose.slides.internal.up.x3
at java.net.URLClassLoader$1.run(URLClassLoader.java:371)
at java.net.URLClassLoader$1.run(URLClassLoader.java:363)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:362)
at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:352)
at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
... 14 more
Caused by: java.io.FileNotFoundException: /var/task/com/aspose/slides/internal/up/x3.class (Too many open files)
at java.io.FileInputStream.open0(Native Method)
at java.io.FileInputStream.open(FileInputStream.java:195)
at java.io.FileInputStream.<init>(FileInputStream.java:138)
at sun.misc.URLClassPath$FileLoader$1.getInputStream(URLClassPath.java:1397)
at sun.misc.Resource.cachedInputStream(Resource.java:77)
at sun.misc.Resource.getByteBuffer(Resource.java:160)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:460)
at java.net.URLClassLoader.access$100(URLClassLoader.java:74)
at java.net.URLClassLoader$1.run(URLClassLoader.java:369)
This seems like a bug with resource reuse. without access to the source code it’s difficult for me to judge if it’s OK to open the same file so many times, but if this is something you can cache and reuse I would appreciate it very much - or alternatively close that file after reading, if it’s no longer required.