Callback deadlock

Matthew J. Francis mjay.francis at gmail.com
Mon Jun 29 01:53:16 PDT 2015


On 29/06/2015 15:47, Piet van Oostrum wrote:
> It is not completely clear if you are calling from a remote Python program, or from inside LO.
> Assuming that it is remote, yes, there are problems with listeners in this situation. It can easily deadlock. I have posted a similar situation on this list some months ago, where I did a paragraph enumeration in a listener callback and it also deadlocked. See lists.freedesktop.org/archives/libreoffice/2015-April/067601.html
>
> Basically the conclusion was the LO does too much locking here, but that it could not be avoided because of severe problems if it wouldn't lock.

It's remote - a test running as an external process.

The Python side of the deadlock is http://pastebin.com/qPkyVTkk
(this is a different run - the corresponding soffice.bin trace is 
http://pastebin.com/g4F8zcUi )

The two things that seem to be happening are:

In thread 1, the main Python thread has got the Text property for the 
text document being worked on, and PyUNO_new_UNCHECKED() is called to 
make a Python object for the result, which calls 
createInstanceWithArguments()

Meanwhile, in thread 2, the windowActivated() callback bas been 
received, and pyuno::PyUNO_new_UNCHECKED() is called to make a Python 
object for the argument, which calls createInstanceWithArguments()


If this sequence doesn't work, I'm not sure what if anything the Python 
side can do better here.

Regards
Matthew Francis


More information about the LibreOffice mailing list