Bug 95957 - LibreOffice 5.0.3.2 - crashes with std::bad_alloc
Summary: LibreOffice 5.0.3.2 - crashes with std::bad_alloc
Status: RESOLVED INSUFFICIENTDATA
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: LibreOffice (show other bugs)
Version:
(earliest affected)
5.0.3.2 release
Hardware: All All
: medium critical
Assignee: Not Assigned
URL:
Whiteboard:
Keywords: haveBacktrace
Depends on:
Blocks: File-Opening
  Show dependency treegraph
 
Reported: 2015-11-20 18:36 UTC by Thomas Schweikle
Modified: 2020-09-01 04:02 UTC (History)
6 users (show)

See Also:
Crash report or crash signature:


Attachments
backtrace (16.55 KB, text/plain)
2015-12-21 10:59 UTC, Thomas Schweikle
Details
backtrace (strace.log + gdbtrace.log) (6.26 KB, application/gzip)
2015-12-21 20:33 UTC, Adi Meyerhofer
Details
Valgrind traceback (540.84 KB, text/plain)
2016-09-12 13:51 UTC, Keith Refson
Details
Python site-package which causes LO to fail (68.40 KB, application/gzip)
2016-10-14 09:09 UTC, Keith Refson
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Schweikle 2015-11-20 18:36:14 UTC
Trying to open an existing document crashes LibreOffice. It doesn't matter what document type. All crash with the same error message: "std::bad_alloc".

This is from LibreOffice main window.

Opening the document from File->Open ... may succeed.
Comment 1 raal 2015-11-21 16:10:37 UTC
For the test, could you rename your LibreOffice directory profile (see https://wiki.documentfoundation.org/UserProfile) and give it a new try?
What is your OS?
Comment 2 Buovjaga 2015-11-22 10:21:20 UTC
This might also be interesting, if you want to investigate deeper https://wiki.documentfoundation.org/QA/BugReport/Debug_Information
Comment 3 tommy27 2015-11-29 19:19:34 UTC
@Thomas
please give update of the bug status after profile reset as suggested in comment 1

status NEEDINFO
Comment 4 Thomas Schweikle 2015-12-21 10:59:27 UTC
Created attachment 121465 [details]
backtrace
Comment 5 Thomas Schweikle 2015-12-21 10:59:57 UTC
OS: Linux: Ubuntu 14.04, 15.10
LibreOffice: Build-ID: 1:5.0.3~rc2-0ubuntu1~trusty2

Seeing these crashes regularly opening files.

I've tried:
- new, blank profile -> crash opening files
- turning off any extensions/plugins -> crash opening files
- new profile, no plugins -> chrash opening files
- opening a template -> crash opening the template
  afterwards you're in a document-recovery loop: the document
  is stated as scheduled for recovery and asked if you want to
  recover the document. If you say yes, the document is
  successfully recovered, then, loading the document LO crashes.
  Next time you will be prompted again if you would like to
  recover this document.

The bug is seen for:
- all LO related documents.
Comment 6 Buovjaga 2015-12-21 14:15:14 UTC
Comments from IRC #libreoffice-dev:

std::bad_alloc is an out of memory exception 
the backtrace does not show a std::bad_alloc, it looks like a SIGSEGV in the sidebar code while freeing a window
Comment 7 Adi Meyerhofer 2015-12-21 20:33:17 UTC
Created attachment 121479 [details]
backtrace (strace.log + gdbtrace.log)

This may not exactly the same problem I am encountering, but it certainly sounds very similar.

Setup: a newly updated Suse 42.1, with KDE (KDE Frameworks 5.16.0, Qt 5.5.0 (built against 5.5.0), The xcb windowing system)

Libre Office Version: 5.0.2.2, Build-ID: 00m0(Build:2) (fom the Suse Repo)
(debug packages from http://download.opensuse.org/repositories/LibreOffice:/Factory/openSUSE_Factory/. "libreoffice-debuginfo-5.0.2.2-1.2.x86_64" mentioned in gdbtrace.log appears not to exist anywhere.)

LibreOffice crashes Plasma (and/or X) on opening any type of file (tested for .odt and .ods) every time.

Starting LO without a file works, as soon as file is opened via menu, it crashes although the file's content is actually visible a split second.

Toggling  LO options --> Ansicht --> Grafikausgabe --> use(not) openGL has no effect.

I initially suspected a version 5 bug. Therefore I downgraded to 4.4.7  which also crashes. (The following refers again to 5.0.2.2)

My next suspicion was a Plasma bug: 
Therefore tried all available KDE-System settings for Compositor (i.e. openGL 2.0, the default; openGL 3.1; XRender) with no result.

The attached backtrace info (see caveat on gdbtrace.log above) was created with XRender active.

(I have not yet tried renaming the profile.)
Comment 8 Buovjaga 2015-12-22 08:55:28 UTC
To all: you could also verify that the crash is present on 5.0.4 https://wiki.documentfoundation.org/Installing_in_parallel/Linux
http://www.libreoffice.org/download/pre-releases/
Comment 9 Buovjaga 2015-12-22 08:57:18 UTC
Ah, now I linked to pre-releases even though 5.0.4 is stable.. well, test with 5.1 RC1 while you're at it :)
Comment 10 Adi Meyerhofer 2015-12-23 20:25:02 UTC
Persists with 5.0.4.2 installed from the suse-Tumbleweed Repo.
Comment 11 Thomas Schweikle 2015-12-24 14:23:46 UTC
Same for 5.1rc1
Comment 12 Adi Meyerhofer 2015-12-29 22:03:11 UTC
By now, after having used Suse Leap with the Qt5/Plasma desktop for about a week I strongly suspect that the root of the problem is in Plasma/KDEFrameworks or whatever else is new, since several other programmes (e.g. fontforge, ding) also crash in exactly the same way, that is the programme as such starts but as soon as a file is opened a crash occurs.
Comment 13 Buovjaga 2015-12-30 13:45:06 UTC
Adi: ok, I guess you will file a report to KDE's bug tracker.

Thomas is probably using Ubuntu with Unity and not KDE..?
Comment 14 jbernon 2016-02-15 21:12:09 UTC
Hello,
Same problem using Libreoffice 5.0.4.2 with Debian 8.3 and Gnome 3.14 Many odt files cannot be fully opened : loop of recovery tries, then file opening is immediately followed by bad_alloc error and LO crash. Sometimes these files can be opened through the top menu, but not always. Who can fix it ?
Comment 15 Adi Meyerhofer 2016-02-22 16:24:50 UTC
Patch <a href="https://www.suse.com/support/update/announcement/2016/suse-ru-20160333-1.html">SUSE-RU-2016:0333-1</a> (References: #679938 #889755 #939996 #945047 #951579 #954345 #9), 2016-02-04

esp. "Calc: Problem opening certain ODS files - Remove RPATH on some 3rd party
bundled libs." does NOT fix this problem.

(Set up as in comments 7 + 10)
Comment 16 Pierre C 2016-03-03 08:42:28 UTC
I've the same crash with LO 5.1.2 So, back to 4.4.7.2

Pb occurs only with writer, when working with au document. I can't reproduce way to the crash.

I Just noticed, th the document had a lot of formulas, and some of the were blanck. 
So I double click on the formula => The formula appears and then press ESC => Often but not always Crash.
My documents use Graphite fonts

If it can help
Comment 17 Michael Meeks 2016-03-03 14:37:08 UTC
Interesting; looks like an event / ordering issue quite possibly. To move ahead with this - we will need a trace from:

valgrind --num-callers=31 soffice.bin

or somesuch - of course for a build with debugging symbols; sadly the builds here didn't have them which makes it rather hard to tackle this =)

Thanks !
Comment 18 Keith Refson 2016-09-12 13:51:24 UTC
Created attachment 127276 [details]
Valgrind traceback
Comment 19 Keith Refson 2016-09-12 13:53:38 UTC
I found this bug report when investigating near identical symptoms with LO 5.1.3

under OpenSuse Leap 42.1

Linux PHTCM1001 4.1.27-27-default #1 SMP PREEMPT Fri Jul 15 12:46:41 UTC 2016 (84ae57e) x86_64 x86_64 x86_64 GNU/Linux

rpm -qa | grep office
libreoffice-templates-en-3.3-15.6.noarch
libreoffice-branding-upstream-5.1.3.2-8.1.noarch
libreoffice-calc-extensions-5.1.3.2-8.1.x86_64
libreoffice-filters-optional-5.1.3.2-8.1.x86_64
patterns-openSUSE-kde_office-20150918-12.1.x86_64
libreoffice-l10n-en-5.1.3.2-8.1.noarch
libreoffice-icon-theme-sifr-5.1.3.2-8.1.noarch
patterns-openSUSE-office-20150918-12.1.x86_64
libreoffice-templates-labels-a4-1.0.1-12.1.noarch
libreoffice-writer-5.1.3.2-8.1.x86_64
libreoffice-base-drivers-mysql-5.1.3.2-8.1.x86_64
libreoffice-icon-theme-breeze-5.1.3.2-8.1.noarch
libreoffice-pyuno-5.1.3.2-8.1.x86_64
libreoffice-math-5.1.3.2-8.1.x86_64

I have a partial diagnosis and a cure.  I generated a valgrind trace which pointed to "Invalid Read"s in a Python library.

Starting LO with an empty PYTHONPATH cures the crash.  So it seems that the problem was an interaction with one of the components - quickly narrowed down to
/usr/local/lib/python2.7/site-packages and the file "setuptools.pth".

-rw-r--r-- 1 root root  33 Sep 12  2012 setuptools.pth

Rather incredibly stupidly I managed to nuke the file in the act of narrowing among the files in the directory. So I can't see the contents.  D'oh. My guess was that this was a link to a directory which no longer exists.

In any case it seems clear that (at least in my case) the cause was LO picking up bad data from the Python environment.
Comment 20 Michael Meeks 2016-09-15 13:00:32 UTC
Extremely interesting analysis - thanks ! =)

The valgrind trace is unfortunately not useful, since the build has no debuginfo installed - which is a shame ! thanks for generating that.

With a new trace with debugging symbols we may be able to get further, and/or perhaps we can find a patch for our python that may avoid this crasher / memory corruption somehow.

Thanks !
Comment 21 Buovjaga 2016-09-15 13:21:04 UTC
Keith: I chatted with Michael on IRC about getting debuginfo for openSUSE and he said: "you have to add the debuginfo repository and the updates repository too for some reason"

I hope you can find them for Leap. I do remember some difficulty with Leap from another user :(
Comment 22 Adi Meyerhofer 2016-09-15 16:28:26 UTC
(In reply to Buovjaga from comment #21)
> Keith: I chatted with Michael on IRC about getting debuginfo for openSUSE
> and he said: "you have to add the debuginfo repository and the updates
> repository too for some reason"
> 
> I hope you can find them for Leap. I do remember some difficulty with Leap
> from another user :(

Leap Debug:

http://download.opensuse.org/debug/distribution/leap/42.1/repo/oss/ 

Sincerely the "another user" 

PS: Persists with LibreOffice 5.1.3.2 10m0(Build:2) (thank god for LaTeX!)

since the same type of crash also occurs with a few other programs, that seem to use the gtk/gnome graphics (FontForge -v 20150824, veracrypt graphic mode) I by now suspect some problem with the integration into Plasma  (which has become a bit more stable those last 6 months)
Comment 23 robin.roth 2016-10-14 08:36:46 UTC
The same error message occured for me on OpenSUSE Leap 42.1. After search around and realizing that a freshly created useraccount didn't have this problem it turned out to be caused by a set env "PYTHONPATH". unsetting that variabled fixed it.
Comment 24 Keith Refson 2016-10-14 09:09:00 UTC
Created attachment 127999 [details]
Python site-package which causes LO to fail
Comment 25 Keith Refson 2016-10-14 09:13:26 UTC
Sorry about the delay with this.  I was not yet able to get debugging symbol information.

However I have managed to narrow down the cause a lot further, after recovering the "setuptools.pth" in my Python 2.7 local site-packages.  This allowed me to identify the single Python package at the root of the crash.

Skipping any more tedious details, the conclusion is

If my installation of the Python package "enum" is in the PYTHONPATH, LO fails on startup with std::Bad_Alloc.

If the installation of the Python package "enum" is NOT in PYTHONPATH, LO startup succeeds.

I will upload a tarball containing the offending Python package.  Perhaps others can try to see if adding this to your Pythonpath replicates the failure?
Comment 26 Adi Meyerhofer 2016-10-14 13:39:39 UTC
(In reply to Keith Refson from comment #25)
> Sorry about the delay with this.  I was not yet able to get debugging symbol
> information.
> 
> However I have managed to narrow down the cause a lot further, after
> recovering the "setuptools.pth" in my Python 2.7 local site-packages.  This
> allowed me to identify the single Python package at the root of the crash.
> 
> Skipping any more tedious details, the conclusion is
> 
> If my installation of the Python package "enum" is in the PYTHONPATH, LO
> fails on startup with std::Bad_Alloc.
> 
> If the installation of the Python package "enum" is NOT in PYTHONPATH, LO
> startup succeeds.
> 
> I will upload a tarball containing the offending Python package.  Perhaps
> others can try to see if adding this to your Pythonpath replicates the
> failure?

As promising as your comments are I must say that n my setup, I can not replicate your solution. That is: 1) I have had NO PYTHONPATH set, 2) even after (temporarily) renaming the folder /usr/lib/python2.7/site-packages/enum/ LO crashe on startup as described earlier, viz.:  ksmserver, kdeinit5 and kglobalaccel5 -- each with segmentation faults.
Comment 27 Keith Refson 2016-10-14 15:06:36 UTC
Adi - your symptoms seem different and point to a different bug.

I see the same behaviour first reported, namely, LO will start up without any file.  However any attempt to open a file opens up the sub-component window, but which immediately fails, displaying an error message window containing "std::bad_alloc".  LO exits upon clicking the OK button.

You reported that
"LibreOffice crashes Plasma (and/or X) on opening any type of file "

which is clearly different.  I do not see that behaviour, and that is not what the original reporter stated either.

I suggest that this is clearly a separate issue, and you should open a new bug report.
Comment 28 Buovjaga 2016-10-14 18:33:39 UTC
Let's set this to NEW per Keith's input.
Comment 29 QA Administrators 2017-10-23 14:11:19 UTC Comment hidden (obsolete)
Comment 30 Julien Nabet 2019-08-15 10:58:06 UTC
Any update with a recent LO version (eg last stable one: 6.2.5)?

On pc Debian x86-64 with master sources updated today
I tried Keith's test with PYTHONPATH but failed to reproduce this.
I did:
- export PYTHONPATH=<site-packages directory>/site-packages
- launch LO
- open a docx
=> no crash
also:
- export PYTHONPATH=<site-packages directory>/site-packages/enum/enum.py
- launch LO
- open a docx
=> still no crash
Comment 31 Julien Nabet 2020-02-02 14:56:46 UTC
Last stable LO version is now 6.3.4.
Let's put this one to NEEDINFO waiting for feedback and brand new bt if it still crashes.
Also, it might be specific to KDE, so it would be interesting someone gives a try with:
export SAL_USE_VCLPLUGIN=gen
soffice
Comment 32 QA Administrators 2020-08-01 04:18:36 UTC Comment hidden (obsolete)
Comment 33 QA Administrators 2020-09-01 04:02:05 UTC
Dear Thomas Schweikle,

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

MassPing-NeedInfo-FollowUp