Bug 101587 - Toolpanel Python extension example from SDK crashes LibreOffice.
Summary: Toolpanel Python extension example from SDK crashes LibreOffice.
Status: RESOLVED WORKSFORME
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: sdk (show other bugs)
Version:
(earliest affected)
5.1.4.2 release
Hardware: x86-64 (AMD64) macOS (All)
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 101606 101604 101605
  Show dependency treegraph
 
Reported: 2016-08-17 21:37 UTC by Alex
Modified: 2016-08-23 09:23 UTC (History)
0 users

See Also:
Crash report or crash signature:


Attachments
Window when LibreOffice crashes (32.17 KB, image/jpeg)
2016-08-18 18:10 UTC, Alex
Details
window to recover documents (49.37 KB, image/jpeg)
2016-08-18 18:11 UTC, Alex
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Alex 2016-08-17 21:37:20 UTC
I tried getting into extension development using python. When I tried running the python example supplied with the SDK it crashes my libreOffice on startup...

I followed the environment setup for the SDK with the exception of setting a java or CLI compiler. The 'make' command did not return any errors. I did not get any errors when I enabled the extension although the extension was not running yet. When I tried restarting libreOfficefor the extension to take effect Calc kept crashing on launch.

Any help to debug the issue is welcome.
Comment 1 Alex Thurgood 2016-08-18 07:36:26 UTC
@Alex : let's start with some questions

1) which python extension in the SDK ?

2) which version of python did the compilation pick up on (when you ran make) ?

3) can you start LO from the command line with the python extension included and provide any output you see on the terminal ?

As a general point, from what I recall, the using the SDK on Mac for development of extensions in languages other than StarBasic and C++ has always been problematic (Java and Python being most notably the two main languages posing a problem) :

- Java because of JNI instantiation into the threads of an LO process (instantiation itself depend on JRE/JDK version, attempts to instantiate an AWT process outside of the main LO thread, etc)

- Python because of the requirement that the python code be completely executable from within the LO application environment (as far as I can remember)

Setting to NEEDINFO
Comment 2 Alex Thurgood 2016-08-18 07:40:45 UTC
Please set back to UNCONFIRMED when you have provided the requested information
Comment 3 Alex 2016-08-18 18:10:33 UTC
Created attachment 126895 [details]
Window when LibreOffice crashes

Window when LibreOffice crashes
Comment 4 Alex 2016-08-18 18:11:42 UTC
Created attachment 126896 [details]
window to recover documents

window to recover documents
Comment 5 Alex 2016-08-18 18:13:54 UTC
(In reply to Alex Thurgood from comment #1)
> @Alex : let's start with some questions
> 
> 1) which python extension in the SDK ?

The "toolpanel" extension in LibreOffice5.1_SDK/examples/python/toolpanel


> 2) which version of python did the compilation pick up on (when you ran
> make) ?

To my understanding, the make command only zipped the package and did not compile anything since it's a python extension.

For information "python --version" gives "Python 2.7.10" on my system. I also have python3.5 installed.

The python bundled in Libre Office seems to be the 3.5
$ /Applications/LibreOffice.app/Contents/MacOS/python --version
Python 3.5.0


> 3) can you start LO from the command line with the python extension included
> and provide any output you see on the terminal ?
> 
> As a general point, from what I recall, the using the SDK on Mac for
> development of extensions in languages other than StarBasic and C++ has
> always been problematic (Java and Python being most notably the two main
> languages posing a problem) :
> 
> - Java because of JNI instantiation into the threads of an LO process
> (instantiation itself depend on JRE/JDK version, attempts to instantiate an
> AWT process outside of the main LO thread, etc)
> 
> - Python because of the requirement that the python code be completely
> executable from within the LO application environment (as far as I can
> remember)
> 
> Setting to NEEDINFO

Started with the following commands does not produce any output to console upon crash.

1. /Applications/LibreOffice.app/Contents/MacOS/soffice
 - Loads the startcenter without issues.
 - When i open an new Calc document 80% chance of crash. 
 - If it crashes, I am presented with a window "Due to an unexpected error, LibreOffice has crashed". It not everything seems to be ok, although the extension does not seem to run.
- The Startcenter is restarted and I am also presented with a document recovery window.
- If I choose to "discard the recovery data" LibreOffice will crash leaving me on the StartCenter window.
- If I choose "Start recovery" it will recover successfully and present me the spreadsheet, but will crash again if I save, close the file and open it again.

2. /Applications/LibreOffice.app/Contents/MacOS/soffice --calc
- Crashes immediately on startup
- Loads the Startcenter
- the rest is essentially the same behavior...

Is there a debug mode I can start LibreOffice for it to be more verbose?
Comment 6 Alex Thurgood 2016-08-19 07:04:59 UTC
(In reply to Alex from comment #5)


> Is there a debug mode I can start LibreOffice for it to be more verbose?

You might find more information in the console logs that OSX creates when apps misbehave.

Other than that, you can try running LO from lldb, but if you don't have a debug build to run that with, then you probably won't get much useful information (no symbols in the backtrace for example).

From a terminal :
lldb /Applications/LibreOffice.app
run

then step through your actions and see what output you get in your lldb session and provide a backtrace if possible.
Comment 7 Alex Thurgood 2016-08-19 07:23:16 UTC
Tested with 

Version: 5.3.0.0.alpha0+
Build ID: 77e792096502a7ac9506cbfba28aa6772d5a3e31
CPU Threads: 2; OS Version: Mac OS X 10.11.6; UI Render: default; 
Locale: fr-FR (fr.UTF-8); Calc: group

So, as per the readme file, I created a zip archive of all the files in the toolpanel directory except readme and the makefile, and then renamed this archive toolpanel.oxt.

I then installed the oxt by starting LODev, opening a new Calc sheet, and then Tools > Extension Manager > Add

From the Finder dialog that is displayed, I selected the OXT file and clicked on Open. I was asked whether to install just for myself or else, all users. I chose All Users. The installation proceeded and the extension registered.

I was then asked if I wanted to restart the application, I answered "Yes". LODev restarted and I opened a new Calc document. No crash.

So, on my current master build, I see no crash on startup of a new Calc sheet.
Comment 8 Alex Thurgood 2016-08-19 07:42:06 UTC
The readme file states :
"To activate go to View > Task pane.
I don't have any such entry in my master build after installation of the oxt file.

In fact I can't find any such entry anywhere.

I surmise that registration of the extension was either incomplete, or else the XCU used to provide an entry in the menu structure (in particular under View) is incorrect. However, that should be the subject of a separate bug report.
Comment 9 Alex Thurgood 2016-08-19 07:44:36 UTC
@Alex : the crashing you reported might be specific to that version of 5.1.x, because a number of such crashes were fixed in master and for 5.2.

Could you try a 5.2 release or else a master build and report back ?
Comment 10 Alex Thurgood 2016-08-19 08:09:10 UTC
No crash for me either in 

Version: 5.1.5.2
Build ID: 7a864d8825610a8c07cfc3bc01dd4fce6a9447e5
Threads CPU : 2; Version de l'OS :Mac OS X 10.11.6; UI Render : par défaut; 
Locale : fr-FR (fr.UTF-8); Calc: group


however, as with my master build, I can't see the toolbar entry in any of the menu structures when Calc is active.
Comment 11 Alex Thurgood 2016-08-19 08:10:58 UTC
For my test with 5152, I used the toolpanel extension from the 5.1SDK.
Comment 12 Alex 2016-08-23 03:35:35 UTC
(In reply to Alex Thurgood from comment #9)
> @Alex : the crashing you reported might be specific to that version of
> 5.1.x, because a number of such crashes were fixed in master and for 5.2.
> 
> Could you try a 5.2 release or else a master build and report back ?

I tried reproducing bug with 5.1.5 and 5.2.0.4 and I am unable to reproduce crash.

Version: 5.1.5.2
Build ID: 7a864d8825610a8c07cfc3bc01dd4fce6a9447e5
CPU Threads: 4; OS Version: Mac OS X 10.11.6; UI Render: default; 
Locale: fr-FR (fr.UTF-8); Calc: group

Version: 5.2.0.4
Build ID: 066b007f5ebcc236395c7d282ba488bca6720265
CPU Threads: 4; OS Version: Mac OS X 10.11.6; UI Render: default; 
Locale: fr-FR (fr.UTF-8)
Comment 13 Cor Nouws 2016-08-23 09:23:24 UTC
without a clear commit that fixes anything, we set as WorksForMe