Download it now!
Bug 82775 - libreoffice in headless mode crashes when serving multiple concurrent requests
Summary: libreoffice in headless mode crashes when serving multiple concurrent requests
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: framework (show other bugs)
Version:
(earliest affected)
4.0.4.2 release
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard: target:5.2.0 target:5.1.0.2
Keywords:
Depends on:
Blocks:
 
Reported: 2014-08-18 14:53 UTC by Dmitri Tikhonov
Modified: 2016-10-25 19:11 UTC (History)
4 users (show)

See Also:
Crash report or crash signature:


Attachments
Python script to connect to libreoffice and issue multiple requests (2.07 KB, text/plain)
2014-08-18 14:55 UTC, Dmitri Tikhonov
Details
Run several instances of the same command in parallel and return statuses (294 bytes, text/plain)
2014-08-18 14:56 UTC, Dmitri Tikhonov
Details
Linux 4.3.2.2 backtrace (9.81 KB, text/plain)
2014-10-25 14:24 UTC, Matthew Francis
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Dmitri Tikhonov 2014-08-18 14:53:43 UTC
I convert files to PDFs using libreoffice and I've run into a crash that I do not believe has yet been reported.  When several clients connect to headless instance of libreoffice in parallel, it may cause a crash -- libreoffice segfaults.  I tried this with libreoffice 4.0.4.2, 4.2.5.2, and 4.3.0.4.
Comment 1 Dmitri Tikhonov 2014-08-18 14:55:01 UTC
Created attachment 104830 [details]
Python script to connect to libreoffice and issue multiple requests
Comment 2 Dmitri Tikhonov 2014-08-18 14:56:34 UTC
Created attachment 104831 [details]
Run several instances of the same command in parallel and return statuses
Comment 3 Dmitri Tikhonov 2014-08-18 14:59:51 UTC
To reproduce, start libreoffice:

  /opt/libreoffice4.3/program/soffice --norestore --headless \
    --accept='socket,host=localhost,port=8100;urp;StarOffice.ServiceManager'

Start ten clients in another window:

  bash parallel.sh 10 /opt/libreoffice4.3/program/python \
    uno-client -n 100 some-file.txt /tmp/some-file.pdf

It should take under a minute to crash, sometimes much less than that.
Comment 4 Julien Nabet 2014-08-18 21:31:46 UTC
Let's put the min version indicated in your description.
Comment 5 Matthew Francis 2014-10-25 14:24:05 UTC
Confirmed on Linux and OSX / LibreOffice 4.3.2.2

-> Platform: All
-> NEW
Comment 6 Matthew Francis 2014-10-25 14:24:48 UTC
Created attachment 108394 [details]
Linux 4.3.2.2 backtrace
Comment 7 QA Administrators 2015-12-20 16:07:24 UTC Comment hidden (obsolete)
Comment 8 Dmitri Tikhonov 2015-12-21 18:27:28 UTC
The issue is still present in 5.0.3 on Linux.
Comment 9 Julien Nabet 2015-12-31 08:37:04 UTC
Stephan: I'd like to give it a try with a build of master sources (I use enable-dbg-util so thought I could retrieve useful info) but I don't know how to do this.
Must I put something specific in autogen.input for example?
Comment 10 Stephan Bergmann 2016-01-04 08:54:51 UTC
(In reply to Julien Nabet from comment #9)
> but I don't know how to do this

do what?
Comment 11 Commit Notification 2016-01-04 13:25:08 UTC
Stephan Bergmann committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=26cbb3d1049e789a1c2f56599dbfe0f379fc4b3d

Related tdf#82775: Check for disposed-ness

It will be available in 5.2.0.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 12 Commit Notification 2016-01-04 13:25:13 UTC
Stephan Bergmann committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=e83f31724e0f2cd4242e0b398c48578da53cb5c1

tdf#82775: Don't prematurely dispose single-instance services

It will be available in 5.2.0.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 13 Commit Notification 2016-01-04 13:25:17 UTC
Stephan Bergmann committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=d01888302b03a79bf7ccde6cbe8434b427164a75

tdf#82775: Make NumberFormatCodeMapper MT safe

It will be available in 5.2.0.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 14 Julien Nabet 2016-01-04 19:08:50 UTC
(In reply to Stephan Bergmann from comment #10)
> (In reply to Julien Nabet from comment #9)
> > but I don't know how to do this
> 
> do what?

Sorry for my previous comment.
I was talking about launching the test.
Indeed, I've got this:
Traceback (most recent call last):
  File "uno-client", line 13, in <module>
    import uno

It seems I've got a pb to run Python script which uses "import uno" with a build of master sources.
With LO Debian LO package, no pb since there's these:
python3-uno - Python-UNO bridge
uno-libs3 - LibreOffice UNO runtime environment -- public shared libraries
uno-libs3-dbg - LibreOffice UNO runtime environment -- public shared library debug symbols
unoconv - converter between LibreOffice document formats
Comment 15 Stephan Bergmann 2016-01-05 08:32:59 UTC
(In reply to Julien Nabet from comment #14)
> Traceback (most recent call last):
>   File "uno-client", line 13, in <module>
>     import uno

As stated in comment 3, use the LO installation's python exectuable rather than the one given in the shebang of attachment 104830 [details].
Comment 16 Stephan Bergmann 2016-01-05 15:29:54 UTC
See no further problems running the provided test case with the three commits

* <http://cgit.freedesktop.org/libreoffice/core/commit/?id=e83f31724e0f2cd4242e0b398c48578da53cb5c1> "tdf#82775: Don't prematurely dispose single-instance services"
* <http://cgit.freedesktop.org/libreoffice/core/commit/?id=d01888302b03a79bf7ccde6cbe8434b427164a75> "tdf#82775: Make NumberFormatCodeMapper MT safe"
* <http://cgit.freedesktop.org/libreoffice/core/commit/?id=c83b55564dab042e3fc1889920cbb4db8fe40117> "Use OUString::replaceAll"

in place.
Comment 17 Stephan Bergmann 2016-01-05 17:26:06 UTC
(In reply to Stephan Bergmann from comment #16)
> *
> <http://cgit.freedesktop.org/libreoffice/core/commit/
> ?id=e83f31724e0f2cd4242e0b398c48578da53cb5c1> "tdf#82775: Don't prematurely
> dispose single-instance services"
> *
> <http://cgit.freedesktop.org/libreoffice/core/commit/
> ?id=d01888302b03a79bf7ccde6cbe8434b427164a75> "tdf#82775: Make
> NumberFormatCodeMapper MT safe"
> *
> <http://cgit.freedesktop.org/libreoffice/core/commit/
> ?id=c83b55564dab042e3fc1889920cbb4db8fe40117> "Use OUString::replaceAll"

requested backports of those three commits to libreoffice-5-1 with <https://gerrit.libreoffice.org/21129>, <https://gerrit.libreoffice.org/21130>, <https://gerrit.libreoffice.org/21131>
Comment 18 Commit Notification 2016-01-06 08:39:29 UTC
Stephan Bergmann committed a patch related to this issue.
It has been pushed to "libreoffice-5-1":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=537c7dcfc1e2a1a8ebd9ef12f5671725c7d5e014&h=libreoffice-5-1

tdf#82775: Don't prematurely dispose single-instance services

It will be available in 5.1.0.2.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 19 Commit Notification 2016-01-06 13:27:33 UTC
Stephan Bergmann committed a patch related to this issue.
It has been pushed to "libreoffice-5-1":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=d4ff96c740695401acbb4bb9e6a15a3c9c14fc53&h=libreoffice-5-1

tdf#82775: Make NumberFormatCodeMapper MT safe

It will be available in 5.1.0.2.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.