M_per M_per - 1 year ago 95
PHP Question

Unoconv/libreoffice command line convert very slow

I'm using unoconv or libreoffice to convert documents,

, by
PHP exec()
. This process is very fast on one of my server (about 1s).
Now I have another, much faster server, and this process is taking almost 20s!
And it's with the same, small 20k files. I googled, I set the same configuration, and can't find any clues - what could be the reason?

Result is the same when i'm using unoconv, and libreoffice directly. When
starting unoconv --listener
first, first conversion can be made in about 20 seconds. Then all conversions are fast again.

It seems that simple starting Libreoffice is taking a lot of time, but why?


It seems the answer was simple...

In processlist I can see:

root      4197  1.1  0.2 1112580 66436 pts/2   Sl+  20:20   0:00 /usr/lib/libreoffice/program/soffice.bin --headless --invisible --nocrashreport --nodefault --nofirststartwizard --nologo --norestore --accept=socket,host=,port=2002;urp;StarOffice.ComponentContext

It seems that LibreOffice is using IP and port for some internal communications, so I turned off the firewall (iptables) and it worked fine - from 20 seconds to 1 second!!

At the end I found, that IP6 can not be blocked on firewall for local connections, and that's what was causing the problem.

After I add this rule to iptables.v6 configuration file, everything is working fine:

ip6tables -A INPUT -i lo -j ACCEPT