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.
Context
- Solarmutex Deadlock when Closing Calc which contains functions with XVolatileResult return values · anwen
Privacy Policy |
Impressum (Legal Info) |
Copyright information: Unless otherwise specified, all text and images
on this website are licensed under the
Creative Commons Attribution-Share Alike 3.0 License.
This does not include the source code of LibreOffice, which is
licensed under the Mozilla Public License (
MPLv2).
"LibreOffice" and "The Document Foundation" are
registered trademarks of their corresponding registered owners or are
in actual use as trademarks in one or more countries. Their respective
logos and icons are also subject to international copyright laws. Use
thereof is explained in our
trademark policy.