Bug 106949 - HTML to PDF conversion hangs when called through socket from Liferay
Summary: HTML to PDF conversion hangs when called through socket from Liferay
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: LibreOffice (show other bugs)
(earliest affected) release
Hardware: x86-64 (AMD64) All
: medium normal
Assignee: Not Assigned
Keywords: needsDevAdvice
Depends on:
Blocks: PDF-Export
  Show dependency treegraph
Reported: 2017-04-04 14:18 UTC by Christoph Rabel
Modified: 2018-07-31 09:42 UTC (History)
1 user (show)

See Also:
Crash report or crash signature:


Note You need to log in before you can comment on or make changes to this bug.
Description Christoph Rabel 2017-04-04 14:18:08 UTC
Liferay portal server offers a pdf export based on LibreOffice. It requires that LibreOffice is started in headless mode and accepts requests via a socket. Liferay uses com.artofsolving.jodconverter.openoffice to start the conversion.

Starting command of libre office:
/opt/libreoffice5.3/program/soffice.bin --backtrace --headless --nologo --nofirststartwizard --accept="socket,host=,port=8100;urp"

When starting the a conversion of an article, a html file is written to a temp folder and libreoffice "asked" to create a pdf version of the file. Libreoffice creates an empty pdf file, than hangs with 100% CPU load. 

While the process hangs, files like these can be seen:

-rw-r--r--   1 liferay liferay        0  4. Apr 15:25 document9023065231684639692.pdf
-rw-r--r--   1 liferay liferay   627114  4. Apr 15:25 document3598502034899325534.html

While libreoffice hangs, all other conversion attempts, don't return either.

Killing the libreoffice process and converting above html file directly works flawless and creates a pdf version of the html page as expected. So it probably has nothing to do with the file itself but with the way the conversion is started.
/opt/libreoffice5.3/program/soffice.bin --headless --convert-to pdf  document9023065231684639692.html

I have used strace and gdb to check where it hangs. Apparently the function rtl_cache_wsupdate_all runs in an endless loop and never finishes.

I looked a bit into the code, I guess the destructor of the cache is never called and the relevant flag is never set to true, so the loop in that function never completes. To me, this looks more of a symptom than the root cause, but it might give a hint in the right direction.

Steps to Reproduce:
1. Start LibreOffice in Headless Mode
2. Configure Liferay 6.2 to use Libre Office for pdf export
3. Export an article from Liferay

Sorry, that I can't offer an easier way to reproduce it, but I don't have another way to start a conversion through a socket.

Actual Results:  
Libre Office hangs without completing the conversion.

Expected Results:
Libre Office finishes conversion of the html file and "returns".

Reproducible: Always

User Profile Reset: No

Additional Info:

User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:53.0) Gecko/20100101 Firefox/53.0
Comment 1 Xisco Faulí 2017-12-13 10:04:31 UTC
Thank you for reporting the bug.
it seems you're using an old version of LibreOffice.
Could you please try to reproduce it with the latest version of LibreOffice
from https://www.libreoffice.org/download/libreoffice-fresh/ ?
I have set the bug's status to 'NEEDINFO'. Please change it back to
'UNCONFIRMED' if the bug is still present in the latest version.
Comment 2 QA Administrators 2018-07-03 14:16:21 UTC Comment hidden (obsolete)
Comment 3 QA Administrators 2018-07-31 09:42:37 UTC
Dear Bug Submitter,

Please read this message in its entirety before proceeding.

Your bug report is being closed as INSUFFICIENTDATA due to inactivity and
a lack of information which is needed in order to accurately
reproduce and confirm the problem. We encourage you to retest
your bug against the latest release. If the issue is still
present in the latest stable release, we need the following
information (please ignore any that you've already provided):

a) Provide details of your system including your operating
   system and the latest version of LibreOffice that you have
   confirmed the bug to be present

b) Provide easy to reproduce steps – the simpler the better

c) Provide any test case(s) which will help us confirm the problem

d) Provide screenshots of the problem if you think it might help

e) Read all comments and provide any requested information

Once all of this is done, please set the bug back to UNCONFIRMED
and we will attempt to reproduce the issue. Please do not:

a) respond via email 

b) update the version field in the bug or any of the other details
   on the top section of our bug tracker

Warm Regards,
QA Team