Bug 105705 - Libreoffice Writer crashes on inserting Zotero citations
Summary: Libreoffice Writer crashes on inserting Zotero citations
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Extensions (show other bugs)
Version:
(earliest affected)
4.3.7.2 release
Hardware: All All
: high critical
Assignee: Michael Stahl (allotropia)
URL:
Whiteboard: target:6.0.0 target:5.4.1 target:5.3.6
Keywords: bibisectRequest, haveBacktrace, regression
Depends on:
Blocks:
 
Reported: 2017-02-02 15:38 UTC by andis.lazdins
Modified: 2017-08-12 11:35 UTC (History)
9 users (show)

See Also:
Crash report or crash signature:


Attachments
backtrace result for libreoffice 5.3.0.3 (7.06 KB, text/plain)
2017-02-12 07:31 UTC, andis.lazdins
Details
backtrace for libreoffice 5.3.1 dev (7.48 KB, text/plain)
2017-02-12 08:07 UTC, andis.lazdins
Details
bt with debug symbols (6.41 KB, text/plain)
2017-07-26 16:36 UTC, Julien Nabet
Details

Note You need to log in before you can comment on or make changes to this bug.
Description andis.lazdins 2017-02-02 15:38:25 UTC
Description:
I'm using latest Zotero extension (4.0.29.16) for Firefox (51.0.1) with Libreoffice extension (3.5.12) in Libreoffice 5.3.0 and 5.2.5. The system is Ubuntu 16.04, 64 bit with openjdk-8-jre from Ubuntu repositories. 
Recently I realized that it is nearly impossible to use Zotero, it randomly crash Libreoffice on inserting of single reference and nearly constantly crashes, when inserting several references.

I have this problem on all computers in office having Ubuntu 16.04 64 bit and Libreoffice 5.2.x.

I tried to install Oracle java, but it didn't change anything. I tried stand alone Zotero and there is no difference from Firefox extension. But there are no problems with Openoffice.org 4.1.3 and Libreoffice 5.1.6 installed on the same machine. Therefore I think there is something done wrong in Libreoffice.

Steps to Reproduce:
1.Install Zotero add-on for Libreoffice
2.Start new Writer document
3.Press Insert citation in Zotero toolbar.
4.Select any Citation Style and press ok
5.Select 2 or more citations (should be imported before)
6.Press enter or OK in clasic dialogue to insert citation
7.If Libreoffice do not crash try one more time with more citations

Actual Results:  
After pressing OK or enter to insert citation Libreoffice usually crashes and it can be recovered only by killing process. Firefox also can be restarted only by kill command.

Expected Results:
Insert citation


Reproducible: Sometimes

User Profile Reset: Yes

Additional Info:


User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:51.0) Gecko/20100101 Firefox/51.0
Comment 1 andis.lazdins 2017-02-02 15:52:47 UTC
I just realized that after installation of libreoffice 5.1.6 it is crashing too when inserting Zotero citations
Comment 2 andis.lazdins 2017-02-04 15:27:44 UTC
There are no problems with the same set of programs and extensions on Windows 7.
Comment 3 Johan Hambraeus 2017-02-07 12:57:11 UTC
I had the same problem on osx 10.12.3 som I tried to reinstall the zotero-plugin but then it froze. So I uninstalled the extension, and tried to reinstall with same result. Then I updated libreoffice to 5.2.5.1 and the same result, freezing when trying to install the extension. Then I updated zotero with the 5.0 beta but the same result; the extension can not be installed. When installing from zotero you get a fault, when installing from libreoffice it freeze and you have to kill the process to move on.

I have installed jdk-8.0 during the process with no difference.
Comment 4 andis.lazdins 2017-02-07 13:00:08 UTC
I got response from Zotero team that the Libreoffice plugin is not changed for years so it should be something in Libreoffice. Probably before 5.1.6.
Comment 5 Buovjaga 2017-02-11 20:32:56 UTC
(In reply to Johan Hambraeus from comment #3)
> I had the same problem on osx 10.12.3 som I tried to reinstall the
> zotero-plugin but then it froze. So I uninstalled the extension, and tried
> to reinstall with same result. Then I updated libreoffice to 5.2.5.1 and the
> same result, freezing when trying to install the extension. Then I updated
> zotero with the 5.0 beta but the same result; the extension can not be
> installed. When installing from zotero you get a fault, when installing from
> libreoffice it freeze and you have to kill the process to move on.

I think you are hitting bug 99784

NEW per Johan's experience.

It would be cool to get a backtrace of the crash https://wiki.documentfoundation.org/QA/BugReport/Debug_Information
Comment 6 andis.lazdins 2017-02-12 07:31:54 UTC
Created attachment 131122 [details]
backtrace result for libreoffice 5.3.0.3
Comment 7 andis.lazdins 2017-02-12 08:07:36 UTC
Created attachment 131123 [details]
backtrace for libreoffice 5.3.1 dev
Comment 8 andis.lazdins 2017-02-12 13:44:39 UTC
Hello again!

It looks like this is something Ubuntu 16.04 related. I don't know about OSX case. But I tried the same setup (Libreoffice, Firefox, JRE) with Ubuntu 14.04 64 bit and every thing works perfectly. I can add with Zotero as many citations as I want, everything works and no crashes or freezes.
Comment 9 Buovjaga 2017-02-13 09:26:02 UTC
(In reply to andis.lazdins from comment #6)
> Created attachment 131122 [details]
> backtrace result for libreoffice 5.3.0.3

Hey I got a comment from a developer:
we __always__ get a SIGSEGV from the JavaVM stuff. He needs to ignore it, press 'c' and then wait till he hits the real crash before generating a backtrace
Comment 10 andis.lazdins 2017-02-13 09:36:11 UTC
> 
> Hey I got a comment from a developer:
> we __always__ get a SIGSEGV from the JavaVM stuff. He needs to ignore it,
> press 'c' and then wait till he hits the real crash before generating a
> backtrace

That's all, what is happening. I press insert citation and soffice process is gone, also from task list, and terminal returns to input line.

Should I do something different?
Comment 11 Johan Hambraeus 2017-02-13 09:40:09 UTC
Hi
In OsX it suddenly started to work, but its quite unstable. Sometimes it hangs, sometimes it works fine and I can't figure out when or why.
Comment 12 Buovjaga 2017-02-13 09:59:27 UTC
(In reply to andis.lazdins from comment #10)
> That's all, what is happening. I press insert citation and soffice process
> is gone, also from task list, and terminal returns to input line.
> 
> Should I do something different?

Ok, then I don't know.
Comment 13 mvantreek@gmail.com 2017-02-16 22:44:21 UTC
I have the same problem with LibreOffice 5.2.5.1 in Fedora 25. Zotero SA version 4.0.29.10.
Comment 14 andis.lazdins 2017-03-04 13:21:01 UTC
The regression persist in 5.3.1 development releases. I'm now trying to use Mendeley, but it's functionality and usability is far behind Zotero, and these products are not fully compatible (Mendeley corrupts Zotero references in existing documents on refresh). This is really annoying bug and unfortunately no response follows from Zotero user forum.
Comment 15 Aron Budea 2017-03-14 11:56:31 UTC
How do you install the add-on in LO? It installs in Firefox for me, and I have no idea what to do with it next.
Comment 16 andis.lazdins 2017-03-14 12:29:37 UTC
(In reply to Aron Budea from comment #15)
> How do you install the add-on in LO? It installs in Firefox for me, and I
> have no idea what to do with it next.

You need to install Zotero add-on and Zotero LibreOffice Integration add-on, both from Zotero.org web site. Then you need to run Preferences for Zotero LibreOffice Integration add-on and select Install or Reinstall LibreOffice/OpenOffice.org/NeoOffice Add-in. Then just follow to the installation wizard, if necessary, select application folder, like /opt/libreoffice5.2/program/ in my case. JRE should be enabled in Libreoffice. After installation you need to restart Lidreoffice including quickstarter and there should be new toolbar for Zotero citations in writer.

If you need bibliography database for tests, I can share my database with you. You will need to import it into Zotero.
Comment 17 Adomas Venčkauskas 2017-04-28 08:43:59 UTC
We have a workaround (https://github.com/zotero/zotero-libreoffice-integration/commit/3e275cf59b66f8d73babb2b6c17c9eb3ce85a90b) for the crashing in our codebase, but the underlying bug in LibreOffice still exists.

I couldn't create an isolated test-case, but it shouldn't be too difficult with python UNO. The problem seems to occur when the view cursor is at the end of the document/paragraph, where another cursor is created to replace some of the existing text. The crash is triggered on TextCursor.insertDocumentFromURL() call. If the view cursor is moved out of the range that is being replaced no crashing occurs.

The crash is consistently reproducible with Zotero and LibreOffice extension pre-fix (https://github.com/zotero/zotero-libreoffice-integration/raw/b767d2196390ce8ec035b874077c4e755211733a/install/Zotero_OpenOffice_Integration.oxt) when inserting a citation with Unicode characters.
Comment 18 andis.lazdins 2017-05-03 05:18:51 UTC
Hi!

It seems that the problem is solved. I installed Zotero Libreoffice integration plugin from here https://www.zotero.org/download/dev/Zotero-LibreOffice-Plugin-trunk.xpi and I couldn't reproduce crash. The plugin version appearing now in Libreoffice is 5.0.0 and in Firefox 3.5.12.r10160. Not sure is it good or bad.

Huge thanks to developers!

Andis
Comment 19 Xisco Faulí 2017-05-03 08:19:15 UTC
Closing as RESOLVED WORKSFORME as per comment 18.
Andis, thanks for investigating it.
Comment 20 andis.lazdins 2017-05-03 08:30:19 UTC
Zotero forum communication on this bug can be found here - https://forums.zotero.org/discussion/comment/274631 and, probably something similar or the same, here https://forums.zotero.org/discussion/comment/275042#Comment_275042
Comment 21 Buovjaga 2017-05-03 08:31:00 UTC
(In reply to Xisco Faulí from comment #19)
> Closing as RESOLVED WORKSFORME as per comment 18.
> Andis, thanks for investigating it.

That is just confirming the workaround. Setting back to NEW.
Comment 22 Buovjaga 2017-05-03 08:32:07 UTC
Adomas could try bibisecting it: https://wiki.documentfoundation.org/QA/Bibisect
Comment 23 Adomas Venčkauskas 2017-05-03 10:03:10 UTC
This goes as far back as LO 4.3, but I didn't look further behind because of dependency issues. It is likely that it's upstream from LO too and in JVM or something else.
Comment 24 Buovjaga 2017-05-03 12:11:24 UTC
(In reply to Adomas Venčkauskas from comment #23)
> This goes as far back as LO 4.3, but I didn't look further behind because of
> dependency issues. It is likely that it's upstream from LO too and in JVM or
> something else.

This is in conflict with reporters description, though: "But there are no problems with Openoffice.org 4.1.3 and Libreoffice 5.1.6 installed on the same machine. Therefore I think there is something done wrong in Libreoffice."
Comment 25 Adomas Venčkauskas 2017-05-03 12:25:26 UTC
> This is in conflict with reporters description, though: "But there are no problems with Openoffice.org 4.1.3 and Libreoffice 5.1.6 installed on the same machine. Therefore I think there is something done wrong in Libreoffice."

Yes, but the reporter also says that the crashing is random, so it may be that he simply didn't manage to trigger it with 5.1.6. I performed extensive testing of this bug once I managed to consistently trigger it. I successfully triggered it with 4.3

Zotero has also had reports of LibreOffice crashing "randomly" for a couple of years at least, so this seems inline. We didn't have any developers working on the libreoffice extension codebase, nor did we have a way to consistently reproduce this, so it went undebugged.
Comment 26 Buovjaga 2017-05-03 12:36:35 UTC
Andis: want to try with versions older than 4.3? https://wiki.documentfoundation.org/Installing_in_parallel/Linux
Comment 27 andis.lazdins 2017-05-03 13:02:16 UTC
(In reply to Buovjaga from comment #24)
>
> This is in conflict with reporters description, though: "But there are no
> problems with Openoffice.org 4.1.3 and Libreoffice 5.1.6 installed on the
> same machine. Therefore I think there is something done wrong in
> Libreoffice."

I didn't tested very carefully with 5.1.6, but I'm sure this problem is rather new. We are using intensively Zotero and the first complains I got in 2017, so definitively not 4.X version. 
Now, with the new development built of Zotero plugin I don't have any more this issue. However, according to comment in Zotero forum there are no changes related to this bug in the development built I used.

We will check on another machines to see at which point the problem is solved.
Comment 28 andis.lazdins 2017-05-05 11:41:51 UTC
I tried with parallel installation on 2 PC with Ubuntu 16.04 64 bit and default jre. I was not able to crash any version below 5.0, respectively, no problems in 4.X branch. Anything starting from 5.0.0.5 crashes from time to time and I didn't find any logic behind this behavior.
I got feeling that if I'm starting testing with 4.X, then no crush takes place also with 5.X, but if I'm closing Firefox between tests, then probability of crash is higher. 
I was not able to reproduce crash on Virtualbox Xubuntu 16.10 64 bit and Libreoffice 5.2.7 installation, but I'm not sure if it is correct to rely on these results.
Comment 29 andis.lazdins 2017-05-24 05:37:07 UTC
I'm using now dev build of zotero libreoffice integration plugin 3.5.12.r10160 for 3 weeks with 5.2.7 and default jre of ubuntu 16.04 64 bit and only 1 crash during this period.
I tested it on 2 PCs and it works in both cases. No other problems are appearing to me with development build, so I'm happy. There are another problem reported for OSX computers in Zotero forums, which is still not solved.
Comment 30 willismonroe 2017-07-10 22:54:49 UTC
I just tested this out in Libreoffice 5.4.0.1 and it is still the case that adding citations crashes writer.  This seems like a pretty crucial bug as having a plugin (that hasn't changed) take down the entire application regularly is a large regression.
Comment 31 Tom Colley 2017-07-25 02:45:58 UTC
I have registered a bug that may be related: Bug 109327
Comment 32 Julien Nabet 2017-07-26 16:36:48 UTC
Created attachment 134877 [details]
bt with debug symbols

On pc Debian testing x86-64 with master sources updated today with:
1) zotero-standalone Debian package 4.0.29.16+dfsg-1
2) libreoffice-zotero-integration Debian package 4.0.29.16+dfsg-1
+ cp -R /usr/lib/libreoffice/share/extensions/Zotero_OpenOffice_Integration in <root of build>/instdir/share/extensions
to have Zotero in LO built locally

I could reproduce the crash.

I just created a cite "newspaper article" with just a title on Zotero
I created a brand new empty odt file and used insert cite

LO called Zotero so I could select the cite, then I confirmed display and selected the only cite I had created and finally typed "Enter".
After some seconds, LO crashed
Comment 33 Julien Nabet 2017-07-27 21:49:46 UTC
Noticing warn:sal.file:12134:1:sal/osl/unx/file_misc.cxx:350: Invalid file URL, I put a break on gdb
The first bt didn't give me anything interesting but the second one gave:
#0  osl_getDirectoryItem (ustrFileURL=0x7ffff7ba5328 <aImplEmpty_rtl_uString>, pItem=0x7fffa528b408) at /home/julien/lo/libreoffice/sal/osl/unx/file_misc.cxx:350
#1  0x00007ffff1b1dc9e in osl::DirectoryItem::get (ustrFileURL="", rItem=...) at /home/julien/lo/libreoffice/include/osl/file.hxx:1499
#2  0x00007ffff1e325c7 in SfxMedium::Init_Impl (this=0x55555bd8b260) at /home/julien/lo/libreoffice/sfx2/source/doc/docfile.cxx:2599
#3  0x00007ffff1e327ed in SfxMedium::SfxMedium (this=0x55555bd8b260) at /home/julien/lo/libreoffice/sfx2/source/doc/docfile.cxx:2614
#4  0x00007fffc9730b94 in SwUnoCursorHelper::InsertFile (pUnoCursor=0x55555cb5ca00, rURL="private:stream", rOptions=uno::Sequence of length 2 = {...})
    at /home/julien/lo/libreoffice/sw/source/core/unocore/unocrsrhelper.cxx:1022
#5  0x00007fffc97ed389 in SwXTextCursor::insertDocumentFromURL (this=0x55555cb5d190, rURL="private:stream", rOptions=uno::Sequence of length 2 = {...})
    at /home/julien/lo/libreoffice/sw/source/core/unocore/unoobj.cxx:2500
#6  0x00007fffd34238b6 in gcc3::callVirtualMethod (pThis=0x55555cb5d1f8, nVtableIndex=3, pRegisterReturn=0x0, pReturnTypeRef=0x5555558d1e20, bSimpleReturn=true, 
    pStack=0x7fffa528ba80, nStack=0, pGPR=0x7fffa528bbd0, pFPR=0x7fffa528bc00)
    at /home/julien/lo/libreoffice/bridges/source/cpp_uno/gcc3_linux_x86-64/callvirtualmethod.cxx:133

with SwXTextCursor::insertDocumentFromURL that Adomas (in comment 17) indicated.

Michael/Noel: thought you might be interested in this one. (Michael as Writer expert, Noel since you provided feedback about my patch).
Comment 34 Michael Stahl (allotropia) 2017-07-28 12:13:22 UTC
Comment on attachment 131122 [details]
backtrace result for libreoffice 5.3.0.3

this is just the usual benign JVM startup SIGSEGV, not the real crash
Comment 35 Michael Stahl (allotropia) 2017-07-28 12:14:00 UTC
Comment on attachment 131123 [details]
backtrace for libreoffice 5.3.1 dev

this is just the usual benign JVM startup SIGSEGV, not the real crash
Comment 36 Commit Notification 2017-07-28 22:05:45 UTC
Michael Stahl committed a patch related to this issue.
It has been pushed to "master":

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

tdf#105705 sw: sort bookmarks in ContentIdxStoreImpl::RestoreBkmks()

It will be available in 6.0.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 37 Michael Stahl (allotropia) 2017-07-28 22:05:58 UTC
i've fixed the marks becoming unsorted assert from comment #32

i can insert 2 references at a time now from Zotero 5.0.7
with this fix in a dbgutil build.

whether this is the cause of the originally reported crash is
not clear to me; possibly the unsorted bookmarks are going
to cause a crash later but maybe not.
Comment 38 Julien Nabet 2017-07-29 10:04:57 UTC
With master sources updated today, I don't reproduce the crash anymore.

I just noticed this log when confirming doc prefs in Zotero:
warn:legacy.osl:3188:24:sw/source/core/undo/rolbck.cxx:1242: Unexpected update attribute (!)

then these after having typed "enter" once article selected:
warn:sal.file:3188:24:sal/osl/unx/file_misc.cxx:350: Invalid file URL
warn:writerfilter:3188:24:writerfilter/source/dmapper/DomainMapper.cxx:132: DomainMapper::DomainMapper: failed to initialize RDF metadata: 
warn:sal.file:3188:24:sal/osl/unx/file_misc.cxx:350: Invalid file URL
warn:writerfilter:3188:24:writerfilter/source/dmapper/DomainMapper.cxx:132: DomainMapper::DomainMapper: failed to initialize RDF metadata: 

but again, no crash anymore!

Thank you Michael!
Comment 39 Commit Notification 2017-08-02 08:14:24 UTC
Michael Stahl committed a patch related to this issue.
It has been pushed to "libreoffice-5-4":

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

tdf#105705 sw: sort bookmarks in ContentIdxStoreImpl::RestoreBkmks()

It will be available in 5.4.1.

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 40 Commit Notification 2017-08-02 08:23:36 UTC
Michael Stahl committed a patch related to this issue.
It has been pushed to "libreoffice-5-3":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=75a1dce57f7038bc88c74c4e50dd22306be8cf61&h=libreoffice-5-3

tdf#105705 sw: sort bookmarks in ContentIdxStoreImpl::RestoreBkmks()

It will be available in 5.3.6.

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 41 Julien Nabet 2017-08-06 18:25:57 UTC
Let's put this one to FIXED since it's fixed on master but also on 5.4 and 5.3 branches.
Comment 42 Commit Notification 2017-08-11 09:31:43 UTC
Michael Stahl committed a patch related to this issue.
It has been pushed to "master":

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

tdf#105705 sw: fix another case of bookmarks becoming un-sorted

It will be available in 6.0.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 43 Commit Notification 2017-08-11 14:30:41 UTC
Michael Stahl committed a patch related to this issue.
It has been pushed to "libreoffice-5-4":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=6ff9371a30e972d3e9baad00b23e26cd8ff445dc&h=libreoffice-5-4

tdf#105705 sw: fix another case of bookmarks becoming un-sorted

It will be available in 5.4.1.

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 44 Commit Notification 2017-08-11 16:17:42 UTC
Michael Stahl committed a patch related to this issue.
It has been pushed to "libreoffice-5-3":

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

tdf#105705 sw: fix another case of bookmarks becoming un-sorted

It will be available in 5.3.6.

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 45 andis.lazdins 2017-08-12 11:35:32 UTC
I tried Ubuntu 16.04 64 bit Version: 6.0.0.0.alpha0+ Build ID: 4e2b44860c2c304ea728c512b47ca07aaf1cd452 with Zotero Libreoffice integration plugin 3.5.9. It looks like it works now, no crashes during some tests.