https://bugs.documentfoundation.org/show_bug.cgi?id=172421
Bug ID: 172421
Summary: XCloseable.close() crashes soffice process in
LibreOffice 26.x via UNO socket connection
Product: LibreOffice
Version: 26.2.4.2 release
Hardware: x86-64 (AMD64)
OS: Windows (All)
Status: UNCONFIRMED
Severity: normal
Priority: medium
Component: LibreOffice
Assignee: [email protected]
Reporter: [email protected]
# Bug Report: XCloseable.close() crashes soffice process in LibreOffice 26.x
via UNO socket connection
## Summary
Calling `XCloseable.close(true)` or `XCloseable.close(false)` on a document
opened via UNO socket connection causes the soffice process to crash/terminate
immediately on LibreOffice 26.2.x. The UNO bridge becomes disposed
(`com.sun.star.lang.DisposedException`) making subsequent operations
impossible.
## Version Information
- **LibreOffice version:** 26.2 (Windows x64)
- **Operating System:** Windows (Server / Desktop)
- **Java version:** JDK 11
- **Connection method:** Socket (XConnector + XBridgeFactory)
## Steps to Reproduce
1. Launch soffice with socket listener:
```
soffice.exe --headless --norestore
--accept=socket,host=localhost,port=8100;urp;
```
2. Connect from Java via XConnector + XBridgeFactory:
```java
XConnector xc = ...;
XConnection conn = xc.connect("socket,host=localhost,port=8100");
XBridgeFactory bf = ...;
XBridge bridge = bf.createBridge("", "urp", conn, null);
```
3. Get Desktop and open a document in ReadOnly mode:
```java
Object sm = bridge.getInstance("StarOffice.ServiceManager");
XMultiComponentFactory rsmgr =
UnoRuntime.queryInterface(XMultiComponentFactory.class, sm);
Object desktop =
rsmgr.createInstanceWithContext("com.sun.star.frame.Desktop", localCtx);
XComponentLoader loader = UnoRuntime.queryInterface(XComponentLoader.class,
desktop);
PropertyValue[] props = new PropertyValue[1];
props[0] = new PropertyValue();
props[0].Name = "ReadOnly";
props[0].Value = Boolean.TRUE;
XComponent doc = loader.loadComponentFromURL(fileUrl, "_blank", 0, props);
```
4. Close the document:
```java
XCloseable closeable = UnoRuntime.queryInterface(XCloseable.class, doc);
closeable.close(false); // or close(true) — same result
```
## Expected Behavior
- The document should be closed
- The soffice process should remain running and accepting new connections
- Subsequent `loadComponentFromURL` calls should work on the same bridge
## Actual Behavior
- `close()` either:
- Throws `com.sun.star.lang.DisposedException` immediately, OR
- Blocks indefinitely (deadlock) until the bridge is disposed
- The soffice process terminates/crashes
- The socket connection is reset (`java.net.SocketException: Connection reset`)
- The UNO bridge becomes disposed, making any further operation impossible
## Stack Trace
```
com.sun.star.lang.DisposedException
at
com.sun.star.lib.uno.environments.remote.JobQueue.removeJob(JobQueue.java:199)
at
com.sun.star.lib.uno.environments.remote.JobQueue.enter(JobQueue.java:309)
at
com.sun.star.lib.uno.environments.remote.JobQueue.enter(JobQueue.java:279)
at
com.sun.star.lib.uno.environments.remote.JavaThreadPool.enter(JavaThreadPool.java:83)
at
com.sun.star.lib.uno.bridges.java_remote.java_remote_bridge.sendRequest(java_remote_bridge.java:619)
Caused by: java.io.IOException: java.net.SocketException: Connection reset
at
com.sun.star.lib.uno.bridges.java_remote.XConnectionInputStream_Adapter.read(XConnectionInputStream_Adapter.java:50)
at
com.sun.star.lib.connections.socket.SocketConnection.read(SocketConnection.java:155)
```
## Additional Notes
- This behavior is **consistent** across multiple test runs
- Tested with `close(true)` and `close(false)` — same crash
- Tested with and without `--headless` — same behavior
- Tested with a "Hidden" anchor document open (to prevent auto-quit) — still
crashes
- The **first** open + close sometimes works, but subsequent cycles always fail
- This appears to be a regression from earlier LibreOffice versions where
`XCloseable.close()` worked correctly
## Workaround
Currently the only viable workaround is to kill the soffice process (`taskkill
/F /PID ... /T`) after each document operation and relaunch it for the next
operation. This is inefficient and prevents proper connection reuse.
## Suggested Classification
- **Component:** LibreOffice / UNO API
- **Severity:** Major (breaks document lifecycle management via UNO)
- **Keywords:** UNO, XCloseable, close, socket, bridge, disposed, crash,
headless, Java
--
You are receiving this mail because:
You are the assignee for the bug.