Running soffice process in java hangs only in MacOS

Trying to make simple document converter with Java by executing a soffice process.
But suddenly simple code like this hangs and does not prints anything.

ProcessBuilder pb = new ProcessBuilder(List.of("/opt/homebrew/bin/soffice", "--help"));
Process p = pb.directory(new File(sdir)).inheritIO().start();
System.out.println("errcode : " + p.waitFor()); //The process never ends!

Executing other commands(like “echo hello”) works, running “/opt/homebrew/bin/soffice --help” directly in shell works, running this code in Windows also works.
Also, since this code worked a few months ago, so I suspect it might be a problem of newer version.

My environment is openjdk 17.0.13 and LibreOffice 24.8.2.1 (0f794b6e29741098670a3b95d60478a65d05ef13) in MacOS Sonoma 14.6.1.
Is there anyone having same issue?

from an IDE or directly ?

what does ps say ?

Both have same result(endless hang)

zsh % ps  xao pid,ppid,stat,comm | grep eclipse
98281     1 S    /Applications/Eclipse.app/Contents/MacOS/eclipse
zsh % ps  xao pid,ppid,stat,comm | grep 38708  
38708 98281 S    /Library/Java/JavaVirtualMachines/temurin-17.jdk/Contents/Home/bin/java
38709 38708 S    /bin/sh
zsh % ps  xao pid,ppid,stat,comm | grep soffice
38710 38709 R    /Applications/LibreOffice.app/Contents/MacOS/soffice

It seems the process is considered running, as a child of /bin/sh(who’s child of java from eclipse).

Interestingly, modifying command to List.of("zsh", "-c", "/opt/homebrew/bin/soffice", "--help") does not change output of ps. It still says that soffice process is child of /bin/sh

add ,cputime,args

yep, it’s a wrapper : How do I edit "soffice script" on Mac OS X? - #2 by oweng

zsh % ps  xao pid,ppid,stat,cputime,args,comm | grep -e soffice
39343 39342 S      0:00.00 /bin/sh /opt/homebrew/bin/soffice --help                         /bin/sh
39344 39343 R      1:23.51 /Applications/LibreOffice.app/Contents/MacOS/soffice --help      /Applications/LibreOffice.app/Contents/MacOS/soffice

huh ? :wink:

depending how deep you wanna dive into the fun :

I don’t get it. Is that mean something more than just the soffice process has been running for 1 and a half minutes?

Tried them all but sadly there was no difference.
Will try to downgrade the libreoffice through homebrew, and I’ll try attatching GDB if that doesn’t work.

Edit : Tried 24.2.7 (libreoffice-still — Homebrew Formulae) but no good.

I am also experiencing this. This issue started happening for us with openjdk 17.0.12 and it is specific to running soffice.

I don’t have a solution that involves staying on openjdk 17.0.12+. Good luck!

Thanks for the information! Never thought it’s the problem of the java itself.
Just like you said, in Adoptium jdk 17.0.13 it didn’t work, but in version 21 it did.

It seems in Adoptium jdk the issue starts from 17.0.13.
In my Temurin-17.0.12+7 (build 17.0.12+7) soffice command does work. But in 17.0.13 it doesn’t.

I digged a bit and found a jdk bug report about this.
It says affects versions are 21, 23, 24. So I’m not sure if jdk17u maintainer will care for it.
But since I can’t write comment on the bug report, I guess we’ll just have to wait.

https://bugs.openjdk.org/browse/JDK-8343285
Yay! they found the bug effects jdk17 too.