Solarmutex Deadlock when Closing Calc which contains functions with XVolatileResult return values
anwen
anwenfish at hotmail.com
Fri Jul 27 08:43:25 PDT 2012
Recently, I am working on developing a Calc extension for showing dynamic
streaming data, such as Bloomberg and Reuters real time data. The extension
is written in C++ for Windows OS and contains add-in functions for
retrieving dynamic financial data. Based on the OpenOffice/LibreOffice
developer's guide, the function returns XVolatileResult derived data type.
There are two threads. The main thread deals with spreadsheet, such as
calling functions. The second thread gets the streaming messages, processes
them and notify spreadsheet (the main thread) data changes via
Reference<XResultListener> -> modified(EventResult) function within
XVolatileResult derived object.
The deadlock scenario is that the spreadsheet called the functions many
times and was showing dynamical financial data. Then I closed the
spreadsheet window. The window quit immediately, but the soffice.bin and
soffice.exe were still in task manager. I had to kill these processes
manually. From the log file, I saw that main thread hung at destruction
process, trying to close the second thread, and the second thread hang at
Reference<XResultLisenter> -> modified(), trying to update the spreadsheet.
After doing some research, I suspect that the deadlock is because of
SolarMutex. The main thread starts termination process, acquires SolarMutex,
and tries to close the second thread. But the second thread can not complete
if the Listener->modified() function is waiting for SolarMutex too.
This is a multi-threads issue. I saw a similar bug report at
http://nabble.documentfoundation.org/Base-hangs-when-trying-to-close-it-td3798832.html
A patch tried to solve the above bug:
https://bugs.freedesktop.org/attachment.cgi?id=58176. However, this patch is
reverted from release version LibreOffice 3.6.0 :
http://wiki.documentfoundation.org/Releases/3.6.0/RC2
(do#47021 revert "attempt fix of hang on base close, due to solarmutex
deadlock on join" [Michael Stahl]) .
I am wondering if there is a signal which I can detect when the termination
process starts. If yes, then I can prepare for the termination in the
extension. Or if I can release the Solarmutex in my code to let thread 2
complete the modified() function? Any other suggestions?
Thank you for your kind help.
--
View this message in context: http://nabble.documentfoundation.org/Solarmutex-Deadlock-when-Closing-Calc-which-contains-functions-with-XVolatileResult-return-values-tp3998056.html
Sent from the Dev mailing list archive at Nabble.com.
More information about the LibreOffice
mailing list