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

2012-08-16 Thread Stephan Bergmann
On 08/15/2012 04:58 PM, anwen wrote: A brief summary of this discussion: My purpose is to develop a Calc extension based on LibreOffice environment. As an extension, it registers itself as a UNO component and provides some add-in functions which retrieve streaming data. This extension object

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

2012-08-15 Thread Michael Stahl
On 14/08/12 16:30, Stephan Bergmann wrote: On 08/14/2012 03:20 PM, anwen wrote: In addition, from the link (http://www.openoffice.org/api/docs/common/ref/com/sun/star/sdb/OfficeDatabaseDocument.html), I saw that both OnPrepareUnload and OnUnload events are synchronously broadcaster. Does it

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

2012-08-15 Thread anwen
Thank you, Stephan and Michael. Stephan, I will explain my observations with the Doc events later. Michael, would you mind explaining more about figuring out how to fix all that without losing the synchronous nature of the notification that i bet extensions depend upon? As an extension Developer,

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

2012-08-14 Thread Stephan Bergmann
On 08/14/2012 12:35 AM, anwen wrote: I implemented the above code with c++ . However, it did not work. Anything wrong with the following code: m_xCC is a given ReferenceXComponentContext ReferenceXEventBroadcaster

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

2012-08-14 Thread anwen
Stephan Bergmann-2 wrote On 08/14/2012 12:35 AM, anwen wrote: I implemented the above code with c++ . However, it did not work. Anything wrong with the following code: m_xCC is a given ReferenceXComponentContext ReferenceXEventBroadcaster

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

2012-08-14 Thread Stephan Bergmann
On 08/14/2012 03:20 PM, anwen wrote: In addition, from the link (http://www.openoffice.org/api/docs/common/ref/com/sun/star/sdb/OfficeDatabaseDocument.html), I saw that both OnPrepareUnload and OnUnload events are synchronously broadcaster. Does it mean SolarMutex protection again? I really hope

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

2012-08-13 Thread anwen
Michael Stahl-2 wrote On 09/08/12 15:56, anwen wrote: I am also interested in XDocumentEventBroadcaster/XDocumentEventListener. I am wondering if you could correct my following code which tries to register a XDocumentListener with the XDocumentEventBroadcaster in a Calc Extension. I did

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

2012-08-10 Thread Stephan Bergmann
On 08/10/2012 03:35 PM, anwen wrote: Stephan Bergmann-2 wrote 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

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

2012-08-09 Thread Stephan Bergmann
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

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

2012-08-09 Thread Michael Meeks
Hi there, On Wed, 2012-08-08 at 11:34 -0700, anwen wrote: 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.

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

2012-08-09 Thread Michael Stahl
On 09/08/12 12:50, Michael Meeks wrote: In case things arn't tangled enough - you can release the SolarMutex in your current thread and give another thread a chance to get in using XToolkit's reschedule method. Whether that is likely to make your life only yet more tangled is unclear to

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

2012-08-09 Thread Michael Meeks
On Thu, 2012-08-09 at 13:21 +0200, Michael Stahl wrote: On 09/08/12 12:50, Michael Meeks wrote: In case things arn't tangled enough - you can release the SolarMutex in your current thread and give another thread a chance to get in using XToolkit's reschedule method. Whether that is

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

2012-08-09 Thread Stephan Bergmann
On 08/09/2012 01:21 PM, Michael Stahl wrote: WTF, there is an API to release SolarMutex? ... /me hides under desk Yes, and its a gross, broken hack, never to be used. (As the outer code that locked the SolarMutex presumably did so to be able to temporarily break invariants. Now if inner

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

2012-08-09 Thread anwen
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

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

2012-08-09 Thread anwen
anwen wrote BTW, I am not sure how to initialize a XDocumentEventBroadcaster which you mentioned previously in a Calc Extension. I tried this method: ReferenceXSpreadsheetDocument

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

2012-08-09 Thread Michael Stahl
On 09/08/12 15:56, anwen wrote: I am also interested in XDocumentEventBroadcaster/XDocumentEventListener. I am wondering if you could correct my following code which tries to register a XDocumentListener with the XDocumentEventBroadcaster in a Calc Extension. I did some research on this topic.

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

2012-08-09 Thread anwen
Thank you, Michael. This will solve my doubt with XDocumentEventBroadcaster. I will publish my experience and c++ code with XTermination, XGlobalEventBroadcaster/XEventListener, and also mutithread at Openoffice/Libreoffice Extension developers forums after I finish the project. Then others can

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

2012-08-08 Thread anwen
Hi Eike, Thank you for your advices. After doing some research, I decided to use XTerminateListener which is registered with the LibreOffice desktop. The reason is that once the Calc extension gets started, it is alive until the desktop termination. So does the worker thread associated with the

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

2012-08-01 Thread Eike Rathke
Hi anwen, On Tuesday, 2012-07-31 08:30:30 -0700, anwen wrote: Eike, I agree with you that the listeners are destroyed during document close. I observed it in my log file. However, the worker thread is running asynchronously if not calling the listeners' modified function. How can it know

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

2012-08-01 Thread anwen
Hi Eike, Thank you for your quick and nice response. I am checking out the events and classes you recommended. Here is a minor remind that modified() is a method of XResultListener (not XVolatileResult). It is implemented in Calc by SCAddInListener class. Best, Wendi Eike Rathke-2 wrote Hi

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

2012-08-01 Thread Eike Rathke
Hi anwen, On Wednesday, 2012-08-01 07:57:00 -0700, anwen wrote: Here is a minor remind that modified() is a method of XResultListener (not XVolatileResult). Bah, yes, of course, thanks. It is implemented in Calc by SCAddInListener class. I know, see my .signature below ;-) Eike --

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

2012-07-31 Thread Eike Rathke
Hi anwen, On Friday, 2012-07-27 08:43:25 -0700, anwen wrote: 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

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

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

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

2012-07-31 Thread anwen
Stephan, thank you for your kind and response. There is not a crash when I closed the spreadsheet window and the processes still hung. I used explorer process to create a mini dump file and a full dump file. Then I analyzed the dump files at WinDBG. There are more than two threads, and I posted

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

2012-07-31 Thread anwen
Eike, thank you for your kind response. I just now submitted a bug report with the same title. I attached a text file which is the analyzed result of a full dump file. If you are assigned this bug and would like to check out the full/mini dump files, or need more information, please feel free to

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

2012-07-31 Thread anwen
Eike, I agree with you that the listeners are destroyed during document close. I observed it in my log file. However, the worker thread is running asynchronously if not calling the listeners' modified function. How can it know that the document is closed, stop calling the modified function, and

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

2012-07-30 Thread Stephan Bergmann
On 07/27/2012 05:43 PM, anwen wrote: 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