https://bugs.documentfoundation.org/show_bug.cgi?id=174431
Bug ID: 174431
Summary: FILEOPEN XLSX: Calc hangs on "Load document" opening
multi-sheet files on macOS - worker thread paints
progress bar while main thread waits for SolarMutex
(deadlock)
Product: LibreOffice
Version: 26.2.2.2 release
Hardware: ARM
OS: macOS (All)
Status: UNCONFIRMED
Severity: normal
Priority: medium
Component: Calc
Assignee: [email protected]
Reporter: [email protected]
Created attachment 209631
--> https://bugs.documentfoundation.org/attachment.cgi?id=209631&action=edit
macOS `sample` of the hung soffice process (main thread + thread-pool worker
stacks)
Description:
Opening an .xlsx with 2 or more worksheets in Calc on macOS intermittently
hangs forever. The window stays blank, the status bar shows "Load document",
CPU use is 0%, and the app has to be force-quit.
Steps to Reproduce:
1. On macOS 27.2.1 (Apple Silicon), open an .xlsx with 2+ worksheets (a few
hundred rows each) in Calc, e.g. by launching soffice with the file path.
2. If it opens, quit and repeat. The hang is a race: about 3 in 10 opens hung
in my tests.
Actual Results:
Calc never finishes loading. Window blank, "Load document" in the status bar,
0% CPU. Force-quit required.
Expected Results:
The file opens.
Reproducible: Sometimes
User Profile Reset: Yes (each test used a fresh -env:UserInstallation profile)
Additional Info:
Analysis from a macOS `sample` of the hung process (attached):
- Main thread: oox::xls::WorkbookFragment::finalizeImport() ->
Application::Yield() -> AquaSalInstance::DoYield -> SalYieldMutex::doAcquire,
waiting on the SolarMutex.
- A thread-pool worker doing the parallel sheet import holds the SolarMutex:
oox::xls::WorkerThread::doWork -> WorksheetGlobals::finalizeWorksheetImport ->
framework::StatusIndicator::setValue -> StatusBar::SetProgressValue ->
vcl::Window::PaintImmediately -> AquaSalGraphics::drawNativeControl -> drawBox
-> -[NSView displayRectIgnoringOpacity:inContext:] ->
CAHostingLayer.layoutSublayers -> ViewGraphRootValueUpdater.updateGraph ->
_MovableLockSyncMain, waiting on the main thread.
So painting the status-bar progress from a non-main thread deadlocks:
AppKit/SwiftUI needs the main thread, and the main thread needs the SolarMutex
held by the worker.
Observations:
- Two-sheet files: 3 hangs in 10 GUI opens (including a file re-saved by Calc
itself, so it isn't specific to the program that wrote the file).
- The same file with the second sheet removed: 0 hangs in 7 opens.
- Headless conversion of the same files (to csv/ods/pdf) always succeeds in 1-3
s.
- Workaround: launching with MAX_CONCURRENCY=1 (no parallel sheet import, no
thread-pool threads) gave 0 hangs in 10 opens.
Possibly the same cause as bug 172893 (Calc on Mac stuck on "load document",
worse with multiple sheets).
Version: 26.2.2.2 (1f77d10d6938fd34972958f64b2bcfa54f8b1ba5)
OS: macOS 27.2.1 (26B131), Apple M2 Pro
I can't share the original files (they contain business data). Any .xlsx with
two sheets of a few hundred rows should exercise the same code path.
--
You are receiving this mail because:
You are the assignee for the bug.