[Libreoffice-bugs] [Bug 132884] New: Segmentation Fault after python+uno script closes in case desktop is not terminated

bugzilla-daemon at bugs.documentfoundation.org bugzilla-daemon at bugs.documentfoundation.org
Sat May 9 18:23:28 UTC 2020


https://bugs.documentfoundation.org/show_bug.cgi?id=132884

            Bug ID: 132884
           Summary: Segmentation Fault after python+uno script closes in
                    case desktop is not terminated
           Product: LibreOffice
           Version: 5.3.6.1 release
          Hardware: x86-64 (AMD64)
                OS: Linux (All)
            Status: UNCONFIRMED
          Severity: normal
          Priority: medium
         Component: sdk
          Assignee: libreoffice-bugs at lists.freedesktop.org
          Reporter: suren-a at inbox.ru

Description:
I'm trying to write xlsx to csv converter on python based on LibreOffice and
uno library.
The idea is to convert all sheets into separate csv file.

When I run simple python script I'm getting Segmentation Fault error unless I'm
terminating LibreOffice process from 'desktop' actively. 
However this way I will need to restart LibreOffice process every time which
seems excessive and not really graceful. 

What I'm trying to achieve is to start LibreOffice as a daemon (using systemd)
and connect/disconnect to this process from python once there is conversion
task.

Probably I should close connection somehow explicitly, however I didn't find
respective method so far. Could you please point me to the way I should do it
if there is any?


Steps to Reproduce:
1.Run following python2 script:

#!/usr/bin/env python2

import os
import sys

import uno  
from com.sun.star.beans import PropertyValue
from com.sun.star.connection import NoConnectException

OPENOFFICE_PORT = 8100
OPENOFFICE_LIBPATH = '/usr/lib64/libreoffice/program'

if sys.path.count(OPENOFFICE_LIBPATH) == 0:
    sys.path.insert(0, OPENOFFICE_LIBPATH)

localContext = uno.getComponentContext()

resolver =
localContext.ServiceManager.createInstanceWithContext("com.sun.star.bridge.UnoUrlResolver",
localContext)

context =
resolver.resolve("uno:socket,host=127.0.0.1,port=%d;urp;StarOffice.ComponentContext"
% OPENOFFICE_PORT)

desktop =
context.ServiceManager.createInstanceWithContext("com.sun.star.frame.Desktop",
context)

# desktop.terminate()

Actual Results:
Segmentation fault

Expected Results:
no errors


Reproducible: Always


User Profile Reset: Yes



Additional Info:
In case I'll add 'desktop.terminate()' at the end there is no error but
LibreOffice process closed.

Environment:
LibreOffice 5.3.6.1 30(Build:1) (from yum)
Vagrant, CentOS Linux release 7.6.1810 (Core)
Python 2.7.5

LibreOffice is running as a daemon using this command (via systemd):
/usr/lib64/libreoffice/program/soffice --headless \
     --accept=socket,host=127.0.0.1,port=8100;urp; --display :5.0 \
     --pidfile=/var/run/soffice.pid --nologo --nodefault --nofirststartwizard
--norestore

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/libreoffice-bugs/attachments/20200509/08e1e938/attachment-0001.htm>


More information about the Libreoffice-bugs mailing list