[Libreoffice-bugs] [Bug 53008] New: : Solarmutex Deadlock when Closing Calc which contains functions with XVolatileResult return values

bugzilla-daemon at freedesktop.org bugzilla-daemon at freedesktop.org
Tue Jul 31 17:09:11 CEST 2012


https://bugs.freedesktop.org/show_bug.cgi?id=53008

             Bug #: 53008
           Summary: : Solarmutex Deadlock when Closing Calc which contains
                    functions with XVolatileResult return values
    Classification: Unclassified
           Product: LibreOffice
           Version: 3.5.0 Beta2
          Platform: Other
        OS/Version: All
            Status: UNCONFIRMED
 Status Whiteboard: BSA
          Severity: normal
          Priority: medium
         Component: Spreadsheet
        AssignedTo: libreoffice-bugs at lists.freedesktop.org
        ReportedBy: anwenfish at hotmail.com


Created attachment 64997
  --> https://bugs.freedesktop.org/attachment.cgi?id=64997
The analyzed result of a full dump file

Problem description: 

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?

I attached the analyzed result of a full dump file which is created manually by
Explorer Process (no crash with the processes hanging). If you'd like to check
out the mini/full dump files, or need more information, please feel free to let
me know. thanks.

Wendi

Steps to reproduce:
1. ....
2. ....
3. ....

Current behavior:

Expected behavior:

Platform (if different from the browser): Windows XP

Browser: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:12.0) Gecko/20100101
Firefox/12.0

-- 
Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the Libreoffice-bugs mailing list