Bug 161858 - Writer crashes with Languagetool activated
Summary: Writer crashes with Languagetool activated
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
24.2.5.2 release
Hardware: ARM macOS (All)
: medium normal
Assignee: Patrick (volunteer)
URL:
Whiteboard: target:25.2.0 target:24.8.0.2 target:...
Keywords:
Depends on:
Blocks: LanguageTool
  Show dependency treegraph
 
Reported: 2024-07-01 15:46 UTC by Daniele
Modified: 2024-07-26 23:57 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments
LibreOffice 24.2.4.2 (110.82 KB, application/vnd.oasis.opendocument.text)
2024-07-11 22:33 UTC, Bogaboga Man
Details
bigger file (984.43 KB, application/vnd.oasis.opendocument.text)
2024-07-14 17:53 UTC, Daniele
Details
smaller file (15.70 KB, application/vnd.oasis.opendocument.text)
2024-07-14 17:53 UTC, Daniele
Details
LibreOffice Document Recovery screenshot (68.68 KB, image/png)
2024-07-20 19:26 UTC, Daniele
Details
Snapshot of Activity Monitor and its dialog for LibreOffice (499.68 KB, image/png)
2024-07-20 20:30 UTC, Patrick (volunteer)
Details
Sample LO (156.46 KB, text/plain)
2024-07-21 06:42 UTC, Daniele
Details
File is corrupt (166.94 KB, image/png)
2024-07-21 07:07 UTC, Daniele
Details
File corrupt cannot be opened (124.70 KB, image/png)
2024-07-21 07:08 UTC, Daniele
Details
Original document recovered (111.65 KB, image/png)
2024-07-21 07:15 UTC, Daniele
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Daniele 2024-07-01 15:46:55 UTC
Description:
When used with Language Tool Server enabled and Language Tool Remote Grammar checker Language module selected Libreoffice crashes often (every 5-10 minutes).

Steps to Reproduce:
1.Enable Languagetool: 
A.Go to Preferences 
B.In Languages and Locals
i. go to Language Tool Server 
ii. Enable it leaving things as they are (free version)
iii. Save
iv. Reopen Preferences and in Languages and Locals go to Writing Aids making sure Language Tool Remote Grammar checker Language module is selected
v. Save
C. Open a document (better if with many pages and comments)
D. Wait until words and sentences are underlined (it means that Languagetool is working) 


Actual Results:
E. LO should crash in a few minutes or when closing the document.

Expected Results:
E. LO should not crash while working or when closing the document.


Reproducible: Always


User Profile Reset: Yes

Additional Info:
Version: 24.2.4.2 (AARCH64) / LibreOffice Community
Build ID: 51a6219feb6075d9a4c46691dcfe0cd9c4fff3c2
CPU threads: 8; OS: macOS 14.5; UI render: Skia/Metal; VCL: osx
Locale: en-US (en.UTF-8); UI: en-US
Calc: threaded
Comment 1 Alec K 2024-07-08 20:44:28 UTC
Thank you for reporting the bug. I can not reproduce the bug in:

Version: 25.2.0.0.alpha0+ (AARCH64) / LibreOffice Community
Build ID: ab5d79c90fc33b0a32604e3cbbbc686d01d85d39
CPU threads: 10; OS: macOS 13.6.6; UI render: default; VCL: osx
Locale: en-US (en_US.UTF-8); UI: en-US
Calc: threaded


I followed the outlined steps and ensured that LanguageTool Remote Grammar checker Language module was selected.

I created a document with text and comments.

Please provide a sample file attachment which can be used to reproduce the bug.
Comment 2 Daniele 2024-07-10 18:22:50 UTC
Hi, sorry I could not reproduce with files other than the one I am working on which I cannot share for privacy reasons. I created two big files (under 1MG, but they are still smaller than the 2,3 mb I am working on) but the bug does not happen. Then I deduce that it must be the file I am working on that is buggy.
Comment 3 QA Administrators 2024-07-11 03:15:02 UTC Comment hidden (obsolete)
Comment 4 Bogaboga Man 2024-07-11 22:33:19 UTC
Created attachment 195246 [details]
LibreOffice 24.2.4.2

LibreOffice 24.2.4.2 with LanguageTool-6.4 crashes immediately on open and selecting a new Writer file to edit. This is the environment.

Version: 24.2.4.2 (X86_64) / LibreOffice Community
Build ID: 51a6219feb6075d9a4c46691dcfe0cd9c4fff3c2
CPU threads: 16; OS: Windows 10.0 Build 22631; UI render: Skia/Raster; VCL: win
Locale: en-CA (en_CA); UI: en-GB
Calc: CL threaded
Comment 5 Daniele 2024-07-14 17:52:24 UTC
Hi, I could reproduce. I mean LO crashed with the two attached documents afer a while. The fact that it does not crash immediately does not make me sure 100% that this is the cause, one should also double check disabling Languagetool with the same documents. Of course these are dummy texts, the document I am usually working with and I cannot share is 2,4Megabytes.
Comment 6 Daniele 2024-07-14 17:53:01 UTC
Tested with following version:
Version: 24.2.5.2 (X86_64) / LibreOffice Community
Build ID: bffef4ea93e59bebbeaf7f431bb02b1a39ee8a59
CPU threads: 8; OS: macOS 14.5; UI render: Skia/Metal; VCL: osx
Locale: en-US (en.UTF-8); UI: en-US
Calc: threaded
Comment 7 Daniele 2024-07-14 17:53:27 UTC
Created attachment 195297 [details]
bigger file
Comment 8 Daniele 2024-07-14 17:53:51 UTC
Created attachment 195298 [details]
smaller file
Comment 9 Patrick (volunteer) 2024-07-20 13:24:56 UTC
(In reply to Daniele from comment #6)
> Tested with following version:
> Version: 24.2.5.2 (X86_64) / LibreOffice Community
> Build ID: bffef4ea93e59bebbeaf7f431bb02b1a39ee8a59
> CPU threads: 8; OS: macOS 14.5; UI render: Skia/Metal; VCL: osx
> Locale: en-US (en.UTF-8); UI: en-US
> Calc: threaded

Unfortunately, I cannot reproduce this on my Silicon Mac. I tried with LibreOffice 24.2.5.2 as well as with my local build (both with and without the fix for tdf#161729) as no crash.

So, I think the next step is to get a crash log from your machine. When LibreOffice crashes, you should see one of the two windows appear:

- A macos "Problem Report for LibreOffice" window

  or

- a "LibreOffice Document Recovery" window

The steps for obtaining a crash log are different for each of the above. So if you can tell us which window you see when LibreOffice crashes, I can post the steps for obtaining a crash log.
Comment 10 Daniele 2024-07-20 19:26:26 UTC
Created attachment 195407 [details]
LibreOffice Document Recovery screenshot
Comment 11 Daniele 2024-07-20 19:27:09 UTC
Hi Patrick,
as from attached file, it is a "LibreOffice Document Recovery".
Comment 12 Patrick (volunteer) 2024-07-20 20:30:39 UTC
Created attachment 195409 [details]
Snapshot of Activity Monitor and its dialog for LibreOffice
Comment 13 Patrick (volunteer) 2024-07-20 20:38:57 UTC
(In reply to Daniele from comment #11)
> Hi Patrick,
> as from attached file, it is a "LibreOffice Document Recovery".

OK. So the next that the "LibreOffice Document Recovery" dialog appears, do the following steps:

1. Do *not* press the "OK" button or any of the dialog's buttons in the titlebar  before do the next steps. By leaving the dialog open, we can get a snapshot of  where in the LibreOffice code the crash occurred in.

2. Go to the Finder, navigate to the /Applications/Utilities folder, and launch the Activity Monitor application.

3. In the Activity Monitor application window, put "LibreOffice" in the search field in the top right corner of the window like shown in attachment #195409 [details]. Then double click on the LibreOffice entry to display a "LibreOffice" dialog.

4. In the "LibreOffice" dialog, click on the "Sample" button. After a few seconds, a "Sample of LibreOffice" window will appear. Click the "Save" button in the top right corner of the window and attach the saved file to this bug.
Comment 14 Daniele 2024-07-21 06:42:52 UTC
Created attachment 195417 [details]
Sample LO
Comment 15 Daniele 2024-07-21 06:43:59 UTC
Hi Patrick,
thanks, very clear instructions; please find attached the sample. I hope it helps find the origin of the crash.
Comment 16 Daniele 2024-07-21 07:05:27 UTC
I am attaching the additional steps which are now shown by LO when crashing. It often says that the file is corrupt.
Comment 17 Daniele 2024-07-21 07:07:12 UTC
Created attachment 195418 [details]
File is corrupt
Comment 18 Daniele 2024-07-21 07:08:29 UTC
Created attachment 195419 [details]
File corrupt cannot be opened
Comment 19 Daniele 2024-07-21 07:15:09 UTC
Created attachment 195420 [details]
Original document recovered

If I follow the steps to recover all documents:
1. One of the documents is described as corrupt (this should not happen in the first place)
2. In a window I am told that it cannot be repaired and not be opened
3. In another window I am told that it was indeed recovered: it says Original document recovered with an orange "V" instead of a green one and simply "Successfully recovered". What is the meaning of the different colours and explanations? Why does it warn you that it cannot be repaired in one window and that it is recovered in the next?
Comment 20 Patrick (volunteer) 2024-07-21 14:21:16 UTC
(In reply to Daniele from comment #16)
> I am attaching the additional steps which are now shown by LO when crashing.
> It often says that the file is corrupt.

Yes. The cause of the crash is very obvious from your sample file. It appears that LibreOffice's code that reads data from the Language Tool server has an error and that error causes the crash.

I will need to read the LibreOffice code where the crash is occurring and see what can be change to prevent errors like this from turning into a crash.

I will post again when I have some news to report.
Comment 21 Commit Notification 2024-07-22 11:56:23 UTC
Patrick Luby committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/d81ffa179df1d1279e98ff4aa5c58e1ea4720db1

tdf#161858 prevent crashing by catching any JSON exceptions

It will be available in 25.2.0.

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

Affected users are encouraged to test the fix and report feedback.
Comment 22 Patrick (volunteer) 2024-07-22 12:09:34 UTC
I have committed a fix this bug. The fix should be in tomorrow's (23 July 2024) nightly master builds:

https://dev-builds.libreoffice.org/daily/master/current.html

Note for macOS testers: the nightly master build installer does not overwrite any LibreOffice official versions. Instead, it will be installed as a separate application called "LibreOfficeDev" in the /Applications folder.

Because this is a "test" build, you will need to do the following steps before you launch the LibreOfficeDev application:

1. Go to the Finder and navigate to the /Applications/Utilities folder
2. Launch the "Terminal" application
3. Paste the following command in the Terminal application window and press the Return key to execute the command:

   xattr -d com.apple.quarantine /Applications/LibreOfficeDev.app
Comment 23 Commit Notification 2024-07-22 13:30:39 UTC
Patrick Luby committed a patch related to this issue.
It has been pushed to "libreoffice-24-8":

https://git.libreoffice.org/core/commit/d9dc8731f5e06c65fb3228cddeb39bf90a2a6b10

tdf#161858 prevent crashing by catching any JSON exceptions

It will be available in 24.8.0.2.

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

Affected users are encouraged to test the fix and report feedback.
Comment 24 Daniele 2024-07-24 16:31:25 UTC
Hi Patrick,
I followed the instructions to install the dev version up to
xattr command, but I get this:

xc@Mac-mini ~ %    xattr -d com.apple.quarantine /Applications/LibreOfficeDev.app

xc@Mac-mini ~ % xattr -d com.apple.quarantine /Applications/LibreOfficeDev.app
xattr: /Applications/LibreOfficeDev.app: No such xattr: com.apple.quarantine
xc@Mac-mini ~ % 

Any ideas why? I can se the dev version all right.

Anyway, I tried opening the dev version anyway and tested with the big file and the small file.

1. I can close them and LO does not crash
2. I tried leaving LO open with them and Languagetool activated (and working).

After a while I get this error message:

Could not establish Internet connection to https://api.languagetool.org/v2/check.
Client error message:
(22) HTTP response code said error at /Users/tdf/lode/jenkins/workspace/lo_gerrit/tb/build_master/workdir/UnoApiHeadersTarget/offapi/normal/com/sun/star/ucb/InteractiveNetworkConnectException.hdl:25

And I clicked ok.

LibreofficeDev has been open for more than 2h with Languagetool activated and no crash. The fix works!

Question, are there any reasons I should not use this Libreofficedev waiting for the stable version to be released? Will it corrupt my files for example?
Comment 25 Patrick (volunteer) 2024-07-24 17:00:48 UTC
(In reply to Daniele from comment #24)
> Any ideas why? I can se the dev version all right.

You only need to run the command once to permanently remove that file attribute.  As long as you can launch LibreOfficeDev, then there is nothing to worry about. If you had not removed that file attribute, macOS wouldn't let you launch LibreOfficeDev.

> After a while I get this error message:
> 
> Could not establish Internet connection to
> https://api.languagetool.org/v2/check.
> Client error message:
> (22) HTTP response code said error at
> /Users/tdf/lode/jenkins/workspace/lo_gerrit/tb/build_master/workdir/
> UnoApiHeadersTarget/offapi/normal/com/sun/star/ucb/
> InteractiveNetworkConnectException.hdl:25
> 

Sounds like LanguageTool's server might have been temporarily unavailable. But it is good to see that LibreOffice can handle the case where a third-party server is down.

> Question, are there any reasons I should not use this Libreofficedev waiting
> for the stable version to be released? Will it corrupt my files for example?

The big difference is that LibreOfficeDev contains the very latest code changes from all the LibreOffice developers so the nightly builds have been tested much less than a stable release (most testing is done by volunteer users like you and I).

I would recommend saving frequently when using LibreOfficeDev. LibreOffice is a huge application so even simple code changes can sometimes cause unintended new bugs that no one else has encountered yet.
Comment 26 Daniele 2024-07-24 17:11:06 UTC
Thank you Patrick,
I'll stay on the safe side then. It is a big book on which we've been working for months.
Comment 27 Commit Notification 2024-07-26 23:57:06 UTC
Patrick Luby committed a patch related to this issue.
It has been pushed to "libreoffice-24-2":

https://git.libreoffice.org/core/commit/d4d01d2dbb2babf8de86446e7f1d154d49c3672c

tdf#161858 prevent crashing by catching any JSON exceptions

It will be available in 24.2.6.

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

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