Groupdocs convert 24.7 in docker runs forever

When upgrading from 22.3 to 24.7 the java convert(OutputStream var1, ConvertOptions var2) runs forever.
22.3 works fine but when upgrading to 24.7 it stop working.
Runs in the same docker container as 22.3 “eclipse-temurin:17-jre-focal”.
Have tried alpine/ubuntu images and Java 8 to 22 with the same result.

@asadmma

Please share the sample application with sample file, so we could reproduce the issue on our side.

Hi, here is a sample application with a Readme inside.

GroupDocs.zip (1.6 MB)

@asadmma

Thank you for attaching the sample application.

Since you’re passing ByteArrayInputStream it seems Conversion can’t properly detect file type.

As a workaround I would recommend using Conversion class constructor that accepts load options as a second parameter:

 String input = Files.readString(Path.of("base64-image-jpg-1.txt"));
 byte[] bytes = Base64.getDecoder().decode(input.getBytes("UTF-8"));
 InputStream doc = new ByteArrayInputStream(bytes);
 
 ImageLoadOptions loadOptions = new ImageLoadOptions();
 loadOptions.setFormat(ImageFileType.Jpeg);
 
 Converter converter = new Converter(() -> doc, () -> loadOptions);

Also, in the code above I’m performing conversion from Bas64 to byte array using decode() method.

One more note. The file base64-image-jpg-1.txt contains data:image/jpeg;base64, prefix that has to be removed for successful decoding.

Thanks for a quick answer!
Updated the sample application but still can’t get it to work with my Dockerfile.
Running outside docker as a main class still works fine, any suggestions what could be wrong with my docker file? Suspecting the fonts but the absent of logging makes it hard to know.

Attaching the new sample app.
GroupDocs.zip (1.6 MB)

@asadmma

Thank you for the feedback. We’ll take a look and update you.

Any progress with this problem?

@asadmma

I’m sorry for the delayed response. The investigation is planned for the next week.

@asadmma
The reason was that the working directory was /. So the GroupDocs.Conversion software lists whole the filesytem to locate fonts.
Please move the jar to another directory and change the working directory.
As an example I updated the Dockerfile. There I also fixed the font instalation.

# Don't work with stock openjdk images like openjdk:15
FROM eclipse-temurin:17-jre-focal

# ENV JAVA_OPTS="-Xmx6g -Xms2g -Xss2g"
#RUN sed -i'.bak' 's/$/ contrib/' /etc/apt/sources.list

# Set DEBIAN_FRONTEND to noninteractive to avoid interactive prompts
ENV DEBIAN_FRONTEND=noninteractive

RUN echo ttf-mscorefonts-installer msttcorefonts/accepted-mscorefonts-eula select true | debconf-set-selections && \
apt-get update && \
apt-get install -y ttf-mscorefonts-installer fontconfig && \
fc-cache -f -v

# Verify the installation (optional)
RUN fc-list

CMD printenv JAVA_OPTS
COPY src/test/resources/base64-image-jpg-1.txt /tmp/1.jpg
ARG JAR_FILE=build/libs/GroupDocs-1.0-SNAPSHOT.jar
COPY ${JAR_FILE} /app/app.jar
WORKDIR "/app"
ENV JAVA_OPTS="-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=9010 -Dcom.sun.management.jmxremote.local.only=false -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.rmi.port=9011 -Djava.rmi.server.hostname=127.0.0.1"
ENTRYPOINT ["sh", "-c", "java $JAVA_OPTS -jar /app/app.jar"]
EXPOSE 9010 9011

You can delete these JAVA_OPTS and EXPOSE

Thanks, works like a charm! You are awesome!

If it’s possible and not already done maybe you could update the documentation to notice other of the importance of having the app in it’s own directory to avoid this.

Thanks again!