The unchanged offending code is shown below the 4 stack traces. At the time, my app was on a long response page and the background thread (Thread [EMAIL PROTECTED]) hung when calling dispose on an editing context.

BTW, I see there is a EOSharedEditingContext lock in the first stack trace below, what has that got to do with my ec being locked ...... I recall discussion on the list about EOShared EC being bad and to "turn it off" .... would turning it off help and if so, how can I turn it off?

I will guess that it would help. Call ec.setSharedEditingContext (null). Are you using the shared EC at all?
Eliminated it after sending this post. No longer being used. I am hopeful that the shared ec elimination will solve. We'll just have to wait and see if lock timing during testing or real world use causes a deadlock at some time in the future.



The difficult part is that I can stop the app, run it again and I cannot reproduce this again right now with no code changes....

Which strongly points to concurrency and the EOF stack synchronizer as at least an involved party.


Skip down, the read back up.



Any suggestions on how to prevent this and make my code more robust?

        Thread [EMAIL PROTECTED] (Suspended)    
                Object.wait(long) line: not available [native method]

6. Something else has the SEC locked for writing so this thread blocks
        
                NSMultiReaderLock$ConditionLock(Object).wait() line: 474        
                NSMultiReaderLock$ConditionLock.await() line: 506       
                NSMultiReaderLock._lockForWriting() line: 204   
                NSMultiReaderLock.lockForWriting() line: 165    
                EOSharedEditingContext.lock() line: 700 
                WKEditingContext(EOEditingContext).lockObjectStore() line: 4733 

5. The change requires invalidating objects
WKEditingContext(EOEditingContext).refaultObject (EOEnterpriseObject, EOGlobalID, EOEditingContext) line: 4041 WKEditingContext(ERXEC).refaultObject(EOEnterpriseObject, EOGlobalID, EOEditingContext) line: 1064 WKEditingContext(EOEditingContext)._refaultObjectWithGlobalID (EOEnterpriseObject, EOGlobalID) line: 3293 WKEditingContext (EOEditingContext)._newChangesFromInvalidatingObjectsWithGlobalIDs (NSArray) line: 3522

4. There was a change to process:
WKEditingContext(EOEditingContext)._processObjectStoreChanges (NSDictionary) line: 3558 GeneratedMethodAccessor373.invoke(Object, Object[]) line: not available
                DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 25  
                Method.invoke(Object, Object...) line: 585      
                NSSelector.invoke(Object, Object[]) line: 354   
NSSelector._safeInvokeSelector(NSSelector, Object, Object[]) line: 108

3. lock() processes pending notifications (e.g. from the EOF stack synchronizer:
Logically, one would expect that pending notifications would be ignored in an ec after dispose is called

WKEditingContext(EOEditingContext)._processNotificationQueue() line: 4810

2. Dispose locks the ec:
                WKEditingContext(EOEditingContext).lock() line: 4688    
                WKEditingContext(ERXEC).lock() line: 436        

1. This is the dispose call:
                WKEditingContext(EOEditingContext)._dispose(boolean) line: 1064 
                WKEditingContext(EOEditingContext).dispose() line: 1059 
                WKEditingContext(ERXEC).dispose() line: 574     
                ShipRtbsCampaignsLRTask.performAction() line: 97        
ShipRtbsCampaignsLRTask(ERXLongResponseTask $DefaultImplementation).run() line: 163
                ERXLongResponseTask$WorkerThread(Thread).run() line: 613        
                ERXLongResponseTask$WorkerThread.run() line: 60 




        Thread [Thread-1] (Suspended)   
                Object.wait(long) line: not available [native method]   
                NSMultiReaderLock$ConditionLock(Object).wait() line: 474        
                NSMultiReaderLock$ConditionLock.await() line: 506       
                NSMultiReaderLock._lockForWriting() line: 204   
                NSMultiReaderLock.lockForWriting() line: 165    
                EOSharedEditingContext.lock() line: 700 
                WKEditingContext(EOEditingContext).lockObjectStore() line: 4733 
WKEditingContext(EOEditingContext)._processReferenceQueue() line: 4829 WKEditingContext(EOEditingContext)._processRecentChanges() line: 1930 WKEditingContext(EOEditingContext).processRecentChanges() line: 1951
                WKEditingContext(ERXEC).processRecentChanges() line: 623        
WKEditingContext(EOEditingContext)._processObjectStoreChanges (NSDictionary) line: 3536 GeneratedMethodAccessor373.invoke(Object, Object[]) line: not available
                DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 25  
                Method.invoke(Object, Object...) line: 585      
                NSSelector.invoke(Object, Object[]) line: 354   
NSSelector._safeInvokeSelector(NSSelector, Object, Object[]) line: 108 WKEditingContext(EOEditingContext)._processNotificationQueue() line: 4810
                WKEditingContext(EOEditingContext).lock() line: 4688    
                WKEditingContext(ERXEC).lock() line: 436        
                WKEditingContext(EOEditingContext).tryLock() line: 4700 
WKEditingContext(EOEditingContext)._sendOrEnqueueNotification (NSNotification, NSSelector) line: 4774 WKEditingContext(EOEditingContext)._objectsChangedInStore (NSNotification) line: 3598 WKEditingContext(ERXEC)._objectsChangedInStore(NSNotification) line: 1241 GeneratedMethodAccessor372.invoke(Object, Object[]) line: not available
                DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 25  
                Method.invoke(Object, Object...) line: 585      
                NSSelector._safeInvokeMethod(Method, Object, Object[]) line: 
120        
                NSNotificationCenter$_Entry.invokeMethod(NSNotification) line: 
601      
                NSNotificationCenter.postNotification(NSNotification) line: 545 
NSNotificationCenter.postNotification(String, Object, NSDictionary) line: 575 EOObjectStoreCoordinator._objectsChangedInSubStore (NSNotification) line: 744 GeneratedMethodAccessor376.invoke(Object, Object[]) line: not available
                DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 25  
                Method.invoke(Object, Object...) line: 585      
                NSSelector._safeInvokeMethod(Method, Object, Object[]) line: 
120        
                NSNotificationCenter$_Entry.invokeMethod(NSNotification) line: 
601      
                NSNotificationCenter.postNotification(NSNotification) line: 545 
NSNotificationCenter.postNotification(String, Object, NSDictionary) line: 575 ERXObjectStoreCoordinatorSynchronizer$ProcessChangesQueue $InsertSnapshotProcessor.processSnapshots(EODatabaseContext, EODatabase, NSDictionary) line: 273 ERXObjectStoreCoordinatorSynchronizer $ProcessChangesQueue._process(EOObjectStoreCoordinator, EOObjectStoreCoordinator, NSMutableDictionary, ERXObjectStoreCoordinatorSynchronizer$ProcessChangesQueue $SnapshotProcessor, NSDictionary, String) line: 432 ERXObjectStoreCoordinatorSynchronizer$ProcessChangesQueue.process (EOObjectStoreCoordinator, ERXObjectStoreCoordinatorSynchronizer $ProcessChangesQueue$SnapshotProcessor, NSDictionary, String) line: 450 ERXObjectStoreCoordinatorSynchronizer$ProcessChangesQueue.run() line: 524
                Thread.run() line: 613  

I will leave that one to Mike. The ERXObjectStoreCoordinatorSynchronizer is processing a change and sending notifications. It also needs a write lock on the SEC and blocks because someone else has it.



        Thread [WorkerThread3] (Suspended)      
                Object.wait(long) line: not available [native method]   
                NSRecursiveLock(Object).wait() line: 474        
                NSRecursiveLock.lock() line: 72 
                EOObjectStoreCoordinator.lock() line: 466       
                WKEditingContext(EOEditingContext).lockObjectStore() line: 4735 
WKEditingContext(EOEditingContext)._processReferenceQueue() line: 4829 WKEditingContext(EOEditingContext)._processRecentChanges() line: 1930 WKEditingContext(EOEditingContext).processRecentChanges() line: 1951
                WKEditingContext(ERXEC).processRecentChanges() line: 623        
WKEditingContext(EOEditingContext)._processObjectStoreChanges (NSDictionary) line: 3536 GeneratedMethodAccessor373.invoke(Object, Object[]) line: not available
                DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 25  
                Method.invoke(Object, Object...) line: 585      
                NSSelector.invoke(Object, Object[]) line: 354   
NSSelector._safeInvokeSelector(NSSelector, Object, Object[]) line: 108 WKEditingContext(EOEditingContext)._processNotificationQueue() line: 4810
                WKEditingContext(EOEditingContext).lock() line: 4688    
                WKEditingContext(ERXEC).lock() line: 436        
                Session(WOSession)._awakeInContext(WOContext) line: 717 
Application(WOApplication).restoreSessionWithID(String, WOContext) line: 1550 Application(ERXApplication).restoreSessionWithID(String, WOContext) line: 1335 WOComponentRequestHandler._dispatchWithPreparedApplication (WOApplication, WOContext, NSDictionary) line: 314
                WOComponentRequestHandler._handleRequest(WORequest) line: 358   
                WOComponentRequestHandler.handleRequest(WORequest) line: 432    
                Application(WOApplication).dispatchRequest(WORequest) line: 
1306        
                Application(ERXApplication).dispatchRequest(WORequest) line: 
1117       
                Application.dispatchRequest(WORequest) line: 195        
                WOWorkerThread.runOnce() line: 173      
                WOWorkerThread.run() line: 254  
                Thread.run() line: 613  


Late to the party, this one blocks locking the OSC which has been locked by another thread. I don't see it in the trace, but I am guessing that ERXObjectStoreCoordinatorSynchronizer has it locked while it processes the changes.


None of this answers the crucial question: who is holding the SEC writer lock?

Were there any exceptions that happened before this deadlock?

No, the app just froze and the meta-refresh page's R-R locked

Chuck






_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to