Bug 160644 - Upon opening, LibreOffice sometimes crashes (perhaps once a week)
Summary: Upon opening, LibreOffice sometimes crashes (perhaps once a week)
Status: UNCONFIRMED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: LibreOffice (show other bugs)
Version:
(earliest affected)
24.2.2.2 release
Hardware: x86-64 (AMD64) macOS (All)
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-04-12 15:54 UTC by Sam
Modified: 2024-05-08 23:52 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:


Attachments
the report generated by macOS (6.22 KB, text/plain)
2024-04-12 16:00 UTC, Sam
Details
the report no. 2 generated by macOS (6.03 KB, text/plain)
2024-04-16 19:45 UTC, Sam
Details
the report no. 3 generated by macOS (25.56 KB, text/plain)
2024-04-16 19:46 UTC, Sam
Details
the report no. 4 generated by macOS (6.04 KB, text/plain)
2024-04-20 12:38 UTC, Sam
Details
Activity Monitor memory usage LO (134.78 KB, image/png)
2024-04-24 10:30 UTC, Sam
Details
Acitivity Monitor with all applications sorted by memory usage (620.97 KB, image/png)
2024-05-08 23:33 UTC, Patrick Luby (volunteer)
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Sam 2024-04-12 15:54:49 UTC
Description:
Generally LO works fine, but every now and then when I start it, by clicking on the LO icon in the Dock, my computer crashes (the screen turns black and I have to restart the computer).

This first occurred after updating to LO 24.2. No other software is affected.

A report was produced (see attachment).

Steps to Reproduce:
1. Start LibreOffice

Actual Results:
The computer crashes.

Expected Results:
The computer does not crash when LibreOffice starts.


Reproducible: Sometimes


User Profile Reset: No

Additional Info:
Version: 24.2.2.2 (X86_64) / LibreOffice Community
Build ID: d56cc158d8a96260b836f100ef4b4ef25d6f1a01
CPU threads: 4; OS: macOS 12.7.4; UI render: Skia/Raster; VCL: osx
Locale: en-GB (en_GB.UTF-8); UI: en-US
Calc: threaded
Comment 1 Sam 2024-04-12 16:00:15 UTC
Created attachment 193650 [details]
the report generated by macOS

I hope the attachment can reveal what's happened. Don't really know what other info to provide other than that this has happened several times now.
Comment 2 m_a_riosv 2024-04-13 11:49:29 UTC
Please test in safe mode, Menu/Help/Restart in Safe Mode
Comment 3 Patrick Luby (volunteer) 2024-04-14 21:41:53 UTC
The log that you attached has the following line near the top:

Panicked task 0xffffff9be3ae16d0: 2 threads: pid 700: fontd

So I don't think LibreOffice is causing the crash. I would assume that the "fontd" system process is trying to load a font but hard to tell. Not sure why Apple's fontd code is causing a system crash, but this looks like either a macOS bug or a corrupt font on your system.
Comment 4 Sam 2024-04-16 19:45:45 UTC
Created attachment 193710 [details]
the report no. 2 generated by macOS
Comment 5 Sam 2024-04-16 19:46:04 UTC
Created attachment 193711 [details]
the report no. 3 generated by macOS
Comment 6 Sam 2024-04-16 19:48:29 UTC
There was another system crash today which occurred as soon as I asked LibreOffice to print to PDF a Writer document.

I now remember these crashes not only occur unpredictably when starting LO but also when trying to print something from LO.

Two more reports were generated after today's crash. I hope they give some useful information.
Comment 7 Patrick Luby (volunteer) 2024-04-16 20:24:58 UTC
(In reply to Sam from comment #6)
> There was another system crash today which occurred as soon as I asked
> LibreOffice to print to PDF a Writer document.
> 
> I now remember these crashes not only occur unpredictably when starting LO
> but also when trying to print something from LO.
> 
> Two more reports were generated after today's crash. I hope they give some
> useful information.

Still looks like Apple "fontd" background process is crashing macOS. I believe that fontd handles font loading so I wonder if you have a corrupted or unloadable font installed on your Mac.

If you validate all of the fonts using the following steps, are there any fonts with warnings or errors?:

1. Launch the /Applications/Font Book application from the Finder

2. Select "All Fonts" in the sidebar on the left

3. Select one of the fonts and then select the Edit > Select All menu item to select all of the fonts

4. Select the File > Validate Selection menu item to start the validation process
Comment 8 Sam 2024-04-16 20:41:30 UTC
(In reply to Patrick Luby (volunteer) from comment #7)
> (In reply to Sam from comment #6)
> > There was another system crash today which occurred as soon as I asked
> > LibreOffice to print to PDF a Writer document.
> > 
> > I now remember these crashes not only occur unpredictably when starting LO
> > but also when trying to print something from LO.
> > 
> > Two more reports were generated after today's crash. I hope they give some
> > useful information.
> 
> Still looks like Apple "fontd" background process is crashing macOS. I
> believe that fontd handles font loading so I wonder if you have a corrupted
> or unloadable font installed on your Mac.
> 
> If you validate all of the fonts using the following steps, are there any
> fonts with warnings or errors?:
> 
> 1. Launch the /Applications/Font Book application from the Finder
> 
> 2. Select "All Fonts" in the sidebar on the left
> 
> 3. Select one of the fonts and then select the Edit > Select All menu item
> to select all of the fonts
> 
> 4. Select the File > Validate Selection menu item to start the validation
> process

Thanks! I've followed your steps, and Font Validation found 9 fonts with minor problems (warnings). I've now removed/deleted these fonts.
Comment 9 Patrick Luby (volunteer) 2024-04-16 21:02:06 UTC
(In reply to Sam from comment #8)
> Thanks! I've followed your steps, and Font Validation found 9 fonts with
> minor problems (warnings). I've now removed/deleted these fonts.

Hopefully that stops the crashing, but if not please post the crash log and I will look for any differences from the previous logs.
Comment 10 Sam 2024-04-20 12:36:56 UTC
I've been working with LO ceaselessly these past few days, frequently quitting and restarting it, never with any problems. But now there was another crash immediately after I restarted LO.

I've checked font validation again (via Font Book), and I'm told that still all "font files passed. These files should be safe to use" (that is, none have warnings).

I attached the latest crashlog.
Comment 11 Sam 2024-04-20 12:38:18 UTC
Created attachment 193765 [details]
the report no. 4 generated by macOS
Comment 12 Patrick Luby (volunteer) 2024-04-21 12:36:44 UTC
(In reply to Sam from comment #10)
> I've checked font validation again (via Font Book), and I'm told that still
> all "font files passed. These files should be safe to use" (that is, none
> have warnings).

Unfortunately, your latest sytem crash log is still showing "fontd" as the cause of the crash. So it appears that the system crashes aren't due to a particular font and is probably due to some other cause.

I took another look at your LibreOffice crash log in attachment #193711 [details] and noticed that LibreOffice was using nearly 4 GB of memory when it crashed. So maybe LibreOffice is slowly grabbing more and more of system memory (i.e. a memory leak) and then, when LibreOffice requests some font data, there is not enough unused memory available for fontd to handle the request.

In comment #6 you mentioned that one of the system crashes occurred when you tried to print a document. Printing embeds partial copies of the fonts in your document into the printed output. Also, printing temporarily increases LibreOffice memory usage and that usage may be quite large if your document contains images.

Can you launch the /Applications/Utilities/Activity Monitor application and click on the Memory tab? Then, launch LibreOffice and open the document that you were using at the time of the last system crash. In Activity Monitor, find and select LibreOffice.

Then, print to Preview in LibreOffice a few times and watch the Memory column for in Activity Monitor. Does LibreOffice's memory usage keep increasing every time you print? If yes, does memory usage drop significantly after you close all documents (but not quit) in LibreOffice?
Comment 13 Sam 2024-04-21 13:36:58 UTC
(In reply to Patrick Luby (volunteer) from comment #12)
> 
> Can you launch the /Applications/Utilities/Activity Monitor application and
> click on the Memory tab? Then, launch LibreOffice and open the document that
> you were using at the time of the last system crash. In Activity Monitor,
> find and select LibreOffice.
> 
> Then, print to Preview in LibreOffice a few times and watch the Memory
> column for in Activity Monitor. Does LibreOffice's memory usage keep
> increasing every time you print? If yes, does memory usage drop
> significantly after you close all documents (but not quit) in LibreOffice?

The LO Writer document that I was trying to print just before there was a system crash was only 17 KB. When I open it now, the Activity Monitor reveals that memory usage for LO is about 275 MB. Every time I print to preview, memory usage increases. I've opened a second LO Writer document and printed this to preview several times also. I stopped printing to preview when it reached 573 MB. When I close both LO documents (without quitting LO), memory usage dropped to 442 MB. Not sure whether this drop is significant, though …
Comment 14 Patrick Luby (volunteer) 2024-04-22 13:43:10 UTC
Like you, I see a steady climb in memory usage with each print run, but even after 15 minutes of repeatedly printing, I couldn't get LibreOffice's memory usage much higher than 1 GB. So printing in itself isn't likely to be the cause.

Maybe the problem isn't due to running out of memory but due to memory corruption. Would it be possible for you to run the Activity Monitor application in the background with LibreOffice in the search field? I assume that macOS will eventually crash, but if you notice a sharp increase in LibreOffice's memory usage just before the crash, I am hoping that will give us some new data to investigate.

Also, when the inevitable system crash occurs, would it be possible to run Apple's diagnostic program? IIRC, to run the diagnostic program on Intel Macs, you press and hold the "D" key while booting. After running it, you should see one or more error codes:

https://support.apple.com/en-us/102334

On my Silicon Mac, I got only one error: ADP000 which means no errors. Do you see any different error codes?
Comment 15 Sam 2024-04-24 10:26:47 UTC
(In reply to Patrick Luby (volunteer) from comment #14)

Thank you! Update: I'm monitoring LO memory usage in the Activity Monitor. It's currently on more than 5 GB although no files are open in LO (I've opened several and printed them to PDF, and worked on others without ever quitting LO).

No more system crash yet but I'll report ASA there is one.
Comment 16 Sam 2024-04-24 10:30:26 UTC
Created attachment 193835 [details]
Activity Monitor memory usage LO
Comment 17 Patrick Luby (volunteer) 2024-04-24 18:35:15 UTC
(In reply to Sam from comment #15)
> (In reply to Patrick Luby (volunteer) from comment #14)
> 
> Thank you! Update: I'm monitoring LO memory usage in the Activity Monitor.
> It's currently on more than 5 GB although no files are open in LO (I've
> opened several and printed them to PDF, and worked on others without ever
> quitting LO).
> 
> No more system crash yet but I'll report ASA there is one.

Wow! 5 GB with no documents open is a huge amount of memory. I have to think that LibreOffice has a memory leak somewhere. Now the trick is to narrow down what activity in LibreOffice triggers the memory leak.

You may want to quit and restart LibreOffice when memory gets that high. That should hopefully prevent a system crash while we try to find where the memory leak is.

If you can continue watching Activity Monitor while you are using LibreOffice and if you see memory usage jump a large amount (i.e. 1 GB or more increase), can you try to post what you were doing in LibreOffice immediately before you noticed the large memory usage increase?
Comment 18 Patrick Luby (volunteer) 2024-05-08 23:33:38 UTC
Created attachment 194039 [details]
Acitivity Monitor with all applications sorted by memory usage
Comment 19 Patrick Luby (volunteer) 2024-05-08 23:52:39 UTC
I have a new guess as to what might be causing the system crashes: one or more clipboard history applications are using up most of system memory. After fixing tdf#160855, we now know that one or more clipboard history applications are pasting immediately after copying in Calc and, if you frequently select and copy hundreds of thousands of cells, the data formats that Calc sends to the system clipboard get very large. See my following comment for more background info:

https://bugs.documentfoundation.org/show_bug.cgi?id=160855#c26

To test this, would it be possible for you to run the Activity Monitor application in the background but this time with the search field empty? This will display all applications running on your machine. Set the Memory column to sort highest to lowest like shown in attachment #194039 [details].

Then, launch LibreOffice and select 100000+ cells and copy. Repeat this with different cell ranges at least 10 times, get a screen snapshot of the Activity Monitor window, and attach it to this bug? If 10 times causes a system crash, retry but only half the number of times.

If one or more clipboard history applications have the highest memory usage, we can check if those applications let you lower the maximum history size.