Ken - I never knew how to take a sample of the processes.  It's given me some 
visibility into the spinning beach ball.  I still get the deadlock in the 
commitEditing which is in saveDocumentWithDelegate only on some documents when 
I edit text that requires me to scroll an NSTextView.  Does anything jump out 
at you in this call graph?  What is NSOperation waiting for?

Call graph:
    2761 Thread_1166668   DispatchQueue_1: com.apple.main-thread  (serial)
      2761 start
        2761 main
          2761 NSApplicationMain
            2761 -[NSApplication run]
              2761 -[NSApplication 
nextEventMatchingMask:untilDate:inMode:dequeue:]
                2761 _DPSNextEvent
                  2761 BlockUntilNextEventMatchingListInMode
                    2761 ReceiveNextEventCommon
                      2761 RunCurrentEventLoopInMode
                        2761 CFRunLoopRunSpecific
                          2761 __CFRunLoopRun
                            2761 __NSFireTimer
                              2761 -[SRMainWindowController 
checkToSaveDirtyDoc:]
                                2761 -[PNDocument 
saveDocumentWithDelegate:didSaveSelector:contextInfo:]
                                  2761 
-[NSManagedObjectContext(NSEditorAndEditorRegistration) commitEditing]
                                    2761 -[NSController commitEditing]
                                      2761 -[NSValueBinder commitEditing]
                                        2761 -[NSValueBinder discardEditing]
                                          2761 -[_NSTextPlugin 
showValue:inObject:]
                                            2761 -[NSTextStorage endEditing]
                                              2761 -[NSTextStorage 
processEditing]
                                                2761 -[NSTextStorage 
_notifyEdited:range:changeInLength:invalidatedRange:]
                                                  2761 -[NSLayoutManager 
textStorage:edited:range:changeInLength:invalidatedRange:]
                                                    2761 
-[NSLayoutManager(NSPrivate) _resizeTextViewForTextContainer:]
                                                      2761 
-[NSTextView(NSPrivate) _setFrameSize:forceScroll:]
                                                        2761 -[NSView 
setFrameSize:]
                                                          2761 -[NSView 
_postFrameChangeNotification]
                                                            2761 -[NSClipView 
_reflectDocumentViewFrameChange]
                                                              2761 -[NSClipView 
_scrollTo:animate:]
                                                                2761 
-[NSScrollView scrollClipView:toPoint:]
                                                                  2761 
-[NSClipView scrollToPoint:]
                                                                    2761 
-[NSClipView _immediateScrollToPoint:]
                                                                      2761 
-[NSView displayIfNeeded]
                                                                        2761 
-[NSView _displayRectIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:]
                                                                          2761 
-[NSOperationQueue waitUntilAllOperationsAreFinished]
                                                                            
2761 -[NSOperation waitUntilFinished]
                                                                              
2761 -[__NSOperationInternal waitUntilFinished]
                                                                                
2761 _pthread_cond_wait
                                                                                
  2761 __semwait_signal
    2761 Thread_1166672   DispatchQueue_2: com.apple.libdispatch-manager  
(serial)
      2761 start_wqthread
        2761 _pthread_wqthread
          2761 _dispatch_worker_thread2
            2761 _dispatch_queue_invoke
              2761 _dispatch_mgr_invoke
                2761 kevent
    2761 Thread_1166673   DispatchQueue_6: com.apple.root.default-priority  
(serial)
      2761 start_wqthread
        2761 _pthread_wqthread
          2761 _dispatch_worker_thread2
            2761 _dispatch_call_block_and_release
              2761 __doStart2
                2761 -[__NSOperationInternal start]
                  2761 -[_NSViewDrawOperation main]
                    2761 -[NSTextView _drawRect:clip:]
                      2761 -[NSTextView drawRect:]
                        2761 -[NSConcreteTextStorage _lockForReading]
                          2761 -[NSViewHierarchyLock 
lockForReadingWithExceptionHandler:]
                            2761 _pthread_cond_wait
                              2761 __semwait_signal



On Dec 22, 2010, at 12:37 AM, Ken Thomases wrote:

> On Dec 21, 2010, at 10:08 PM, Brad Stone wrote:
> 
>> I have an NSTextView that has about 1,900 characters in it.  Just regular 
>> text.  If I edit the text and save my app hangs at  [[self 
>> managedObjectContext] commitEditing];  I found setting nonContinuousLayout 
>> to NO in the NSTextView prevents the hang but that's not really solving the 
>> problem.
>> 
>> Here's what's strange.  If I expand the window so the all the text shows 
>> without the scroll bar it doesn't hang.  If I edit the same text but scroll 
>> down the get it I get a hang.  If I set nonContiguousLayout to NO it doesn't 
>> hang in either scenario.
>> 
>> What advice can anyone give as to how I can address this problem?
> 
> One useful tool is a sample of the process to see where each of its threads 
> is spending its time.  This can help identify causes of deadlocks, which is 
> what it seems like you have.
> 
> There are several process-sampling tools in Mac OS X: the "sample" command, 
> the Sample Process command in Activity Monitor, the Time Profile (All Thread 
> States) tools of Shark or Instruments.  For sharing on a mailing list, the 
> text files produced by the sample command are probably simplest.
> 
> Regards,
> Ken
> 

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to