Solarmutex Deadlock when Closing Calc which contains functions with XVolatileResult return values

anwen anwenfish at hotmail.com
Thu Aug 9 06:29:16 PDT 2012


Thank you everyone for your kind and quick response.

Stephan, I checked the impl_sendNotifyTerminationEvent in desktop.cxx. Yes,
it is protected by TransactionGuard aTransaction( m_aTransactionManager,
E_HARDEXCEPTIONS ), the same as impl_sendQueryTerminationEvent, :-(


Stephan Bergmann-2 wrote
> 
> On 08/08/2012 08:34 PM, anwen wrote:
>> With the TerminateListener, I successfully get the desktop termination
>> event
>> by queryTermination() function. Although you told me that I could veto
>> this
>> termination signal by throwing TerminationVetoException. I am not sure
>> how
>> and where to handle the TerminationVetoException and re-call
>> XDesktop.terminate() to finally close the office. So I tried to handle
>> everything inside queryTermination().
> 
> I think you should execute your shutdown activies on notifyTermination, 
> not queryTermination.  The latter can be veto'ed by some other listener, 
> in which case Desktop would cancel the termination and continue running 
> (and notify you with queryTermination eventually followed by 
> notifyTermination again later on).
> 
>> However, deadlock happened sometimes again. Here is my analysis: this
>> function is called by the main thread and is protected by the SolarMutex.
>> If
>> a modified() function is called by the worker thread at the same time,
>> the
>> worker thread is waiting for the SolarMutex. Then the main thread tries
>> to
>> stop the worker thread by calling realtime_session->stop(). This session
>> is
>> designed with thread safe strategy by a third-party. It fails to close
>> the
>> worker thread because the worker thread is waiting for the Main thread to
>> release the SolarMutex.
> 
> That queryTermination is called with SolarMutex locked is a bug.  (Is 
> notifyTermination also called with SolarMutex locked?  Would need to 
> check, in framework/source/services/desktop.cxx.)  However, it might be 
> a bug not easy to fix without opening any number of pandora's boxes...
> 
> Stephan
> _______________________________________________
> LibreOffice mailing list
> LibreOffice at .freedesktop
> http://lists.freedesktop.org/mailman/listinfo/libreoffice
> 




--
View this message in context: http://nabble.documentfoundation.org/Solarmutex-Deadlock-when-Closing-Calc-which-contains-functions-with-XVolatileResult-return-values-tp3998056p4000178.html
Sent from the Dev mailing list archive at Nabble.com.


More information about the LibreOffice mailing list