Bug 168431 - LibreOfficeKit documentLoad() leads to hang
Summary: LibreOfficeKit documentLoad() leads to hang
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: sdk (show other bugs)
Version:
(earliest affected)
25.8.0.4 release
Hardware: All Windows (All)
: medium normal
Assignee: Mike Kaganski
URL:
Whiteboard: target:26.2.0 target:25.8.3
Keywords: bisected, regression
Depends on:
Blocks: LibreOfficeKit
  Show dependency treegraph
 
Reported: 2025-09-16 12:20 UTC by Hossein
Modified: 2025-09-19 09:08 UTC (History)
1 user (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Hossein 2025-09-16 12:20:25 UTC
Description:
Using documentLoad() function in a program that uses LibreOfficeKit API causes the program to hang

Steps to Reproduce:
1. Install and set-up LibreOffice SDK on Windows
2. Build LibreOffice example odk/examples/cpp/lokconvert

Alternatively, you may build the example as described in the below blog post using cmake:

LibreOfficeKit for document conversion
https://dev.blog.documentfoundation.org/2024/07/25/libreofficekit-for-document-conversion/

3. Run the example to convert a sample ODT to PDF

Actual Results:
The program hangs

Expected Results:
It should finish conversion successfully, and print: "Success!".


Reproducible: Always


User Profile Reset: No

Additional Info:
This is a regression as:

The code works with LO 25.2:
Version: 25.2.6.2 (X86_64) / LibreOffice Community
Build ID: 729c5bfe710f5eb71ed3bbde9e06a6065e9c6c5d
CPU threads: 20; OS: Windows 11 X86_64 (10.0 build 26100); UI render: Skia/Vulkan; VCL: win
Locale: en-US (en_US); UI: en-US
Calc: CL threaded

But hangs in LO 25.8.

Also does not work with the latest LO 26.2 dev master built from sources:
Version: 26.2.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: 2c9b640c9e8c30e26358d7414aea18c5e5bf3fee
CPU threads: 20; OS: Windows 11 X86_64 (build 26100); UI render: Skia/Vulkan; VCL: win
Locale: en-US (en_US); UI: en-US
Calc: CL threaded
Comment 1 Hossein 2025-09-18 10:30:45 UTC
Bisected to:
 1e2e51607a163021ef1fb1fb0d217266bd448173 is the first bad commit

commit 1e2e51607a163021ef1fb1fb0d217266bd448173
Author: Mike Kaganski <mike.kaganski@collabora.com>
Date:   Fri Jan 10 11:52:51 2025 +0500

Try to use CoWaitForMultipleHandles magic to handle COM message loop

@Mike:
Could you please take a look?
Comment 2 Mike Kaganski 2025-09-18 16:28:16 UTC
https://gerrit.libreoffice.org/c/core/+/191147
Comment 3 Commit Notification 2025-09-18 20:35:07 UTC
Mike Kaganski committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/23afeaedf4d4a03943338fc39ae41f5c423e5997

tdf#168431: Release solar mutex when sending window message to main thread

It will be available in 26.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 4 Commit Notification 2025-09-19 09:08:44 UTC
Mike Kaganski committed a patch related to this issue.
It has been pushed to "libreoffice-25-8":

https://git.libreoffice.org/core/commit/1c78cb0673e117136212fea7b51adcf898ff94f5

tdf#168431: Release solar mutex when sending window message to main thread

It will be available in 25.8.3.

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.