Bug 142692 - Python script connecting to LO instance fails
Summary: Python script connecting to LO instance fails
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: framework (show other bugs)
Version:
(earliest affected)
7.2.0.0.alpha0+
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords: bibisected, bisected, regression
Depends on:
Blocks: Macro-Python
  Show dependency treegraph
 
Reported: 2021-06-07 01:30 UTC by Aron Budea
Modified: 2023-07-28 16:42 UTC (History)
4 users (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 Aron Budea 2021-06-07 01:30:29 UTC
Follow steps from bug 126582, copied below slightly modified:

1. Run LO Impress as `soffice --impress --accept="socket,host=localhost,port=2002;urp;StarOffice.ServiceManager"`
2. Dismiss a "Template" window, so you're left with a new presentation of a single slide
3. Run the attached python script, attachment 153018 [details] (it creates 2 new slides and puts a text on them)

=> Error when connecting to LO:
...
  File "test.py", line 16, in connectToLO
    return (desktop.CurrentComponent, smgr)
__main__.RuntimeException: Binary URP bridge disposed during call

Observed in LO 7.2.0.0.alpha1+ (e96554b67b17f9d3d91b0bb1f29ab0b9cdc43dcb) / Ubuntu.
No issue in 7.1.0.3.

This is a regression from the following commit. Adding CC: to Noel Grandin.

https://cgit.freedesktop.org/libreoffice/core/commit/?id=857caa5fc69b92e781457a1b67a89aa051c2d70f
author		Noel Grandin <noel@peralex.com>	2021-04-30 13:00:35 +0200
committer	Noel Grandin <noel.grandin@collabora.co.uk>	2021-04-30 16:03:35 +0200

tdf#79049 speed up OOXML workbook load
Comment 1 Noel Grandin 2021-06-07 07:08:41 UTC
How do I  set up my environment so the script can run?

(Currently it can't find the uno import)
Comment 2 Aron Budea 2021-06-07 07:34:25 UTC
Not sure, I didn't have to do anything special in Ubuntu 20.04, and I haven't even built it with internal Python.

By the way, I can see the following in the console of the soffice process when running the script:

warn:sal.osl:3110642:3110738:sal/osl/unx/socket.cxx:1570: receive socket [0] failed: EOL
warn:binaryurp:3110642:3110738:binaryurp/source/reader.cxx:123: caught UNO exception 'N3com3sun4star3uno9ExceptionE msg: acc_socket.cxx:SocketConnection::read: error - Success /home/valaki/projects/libreoffice/io/source/acceptor/acc_socket.cxx:175'
warn:binaryurp:3110642:3110738:binaryurp/source/bridge.cxx:840: undisposed bridge "" in state 2, potential deadlock ahead
Comment 3 Noel Grandin 2021-06-07 07:36:36 UTC
Eh, I don't have a OS-installed LibreOffice, only a development build, so probably some PATH/etc stuff needs to be configured, but no idea what
Comment 4 Noel Grandin 2021-06-07 10:36:50 UTC
Are you sure about this bisect?

If I revert my commit, then run your test

(a) in gtk mode, I get a solid deadlock because of different threads taking different mutexes in different orders

(b) in gen mode, I get the same exception as without reverting my commit
Comment 5 Aron Budea 2021-06-07 13:53:08 UTC
(In reply to Noel Grandin from comment #4)
> Are you sure about this bisect?
I have now built LO at 857caa5fc69b92e781457a1b67a89aa051c2d70f, and got an error with the steps.
I have also built LO at 857caa5fc69b92e781457a1b67a89aa051c2d70f~1, and the steps succeeded.
Comment 6 Stéphane Guillou (stragu) 2023-06-13 13:30:37 UTC
After installing python3-uno on Ubuntu 20.04, steps work for me with:

Version: 7.1.0.3 / LibreOffice Community
Build ID: f6099ecf3d29644b5008cc8f48f42f4a40986e4c
CPU threads: 8; OS: Linux 5.15; UI render: default; VCL: gtk3
Locale: en-AU (en_AU.UTF-8); UI: en-US
Calc: threaded

But I get the RuntimeException with 7.2:

Version: 7.2.7.2 / LibreOffice Community
Build ID: 8d71d29d553c0f7dcbfa38fbfda25ee34cce99a2
CPU threads: 8; OS: Linux 5.15; UI render: default; VCL: gtk3
Locale: en-AU (en_AU.UTF-8); UI: en-US
Calc: threaded

I can confirm Aron's bisect with the linux-64-7.2 repo, the issue starts at commit a056f689c5e1137af73589f207f9fe27648ac4fc which points to core commit 857caa5fc69b92e781457a1b67a89aa051c2d70f

Noel, could you have another look?
Comment 7 Stéphane Guillou (stragu) 2023-06-13 16:44:54 UTC
(same result for gen VCL by the way)
Comment 8 Dan658 2023-06-15 05:35:01 UTC
Hi

For install uno execute command:

sudo apt-get install libreoffice-script-provider-python

Sergey