Re: Core Animation Deadlock

2008-04-25 Thread Colin Cornaby
I may have the bug isolated. I fixed a bug in my own code, and the  
deadlock is no longer happening. It may be related to a situation  
involving removing a sublayer from it's super. In my code I was  
removing a layer that I didn't intend to remove, and the deadlock  
would result.


I still think there is an underlying bug in CoreAnimation. Certainly  
you shouldn't be able to cause a deadlock. If I can isolate the bug to  
a specific case I will build a test case and submit.


On Apr 24, 2008, at 11:11 PM, Colin Cornaby wrote:

Enabled NSZombie and friends didn't seem to fix the issue (or log  
anything.)


This isn't going to be too easy to track down. Once I figure out  
what series of events is triggering it I will try to put together a  
test case.


On Apr 24, 2008, at 9:14 PM, John Harper wrote:



On Apr 24, 2008, at 7:38 PM, Colin Cornaby wrote:

It looks like NSUIHeartBeat could be attempting to lock something.  
Although I could be wrong, it may not be related.


The render thread got stuck while depth sorting:


Thread 11 (process 13823 thread 0x8803):
#0  0x90a27d9c in CARenderLayerDepthSortSublayers ()
#1  0x90a27611 in prepare_layer0 ()
#2  0x90a27597 in prepare_layer0 ()
#3  0x90a27597 in prepare_layer0 ()
#4  0x90a26dd4 in CARenderUpdateAddContext ()
#5  0x90a25f72 in view_draw ()
#6  0x90a34f60 in view_display_link ()
#7  0x90a26936 in link_callback ()
#8  0x94cc1015 in CVDisplayLink::performIO ()
#9  0x94cc1641 in CVDisplayLink::runIOThread ()
#10 0x958e06f5 in _pthread_start ()
#11 0x958e05b2 in thread_start ()



this is done while holding the lock the main thread is trying to  
take. I can't think of any way you could cause this other than heap  
corruption, or maybe over-releasing objects, so it could be a CA  
bug. I would try running with NSZombies enabled first; if you don't  
see anything wrong that way, file a bug report (with a test case  
showing the hang if possible, otherwise there's probably no way we  
can debug it…)


John





___

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/colin.cornaby%40mac.com

This email sent to [EMAIL PROTECTED]


___

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 [EMAIL PROTECTED]


Core Animation Deadlock

2008-04-24 Thread Colin Cornaby

Hi,

I'm currently trying to track down a deadlock. After adding a series  
of layers, CoreAnimation deadlocks here on the main thread:


#0  0x958af4ee in semaphore_wait_signal_trap
#1  0x958b6fc5 in pthread_mutex_lock
#2  0x909f8d72 in CAContextCommitTransaction
#3  0x909f89bd in CATransactionCommit
#4  0x90375351 in -[NSView(NSLayerKitGlue) _drawRectAsLayerTree:]
#5  0x9010ab1e in -[NSView _drawRect:clip:]
#6	0x901091ed in -[NSView  
_recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView 
:]
#7	0x90109c23 in -[NSView  
_recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView 
:]
#8	0x90109c23 in -[NSView  
_recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView 
:]
#9	0x90109c23 in -[NSView  
_recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView 
:]
#10	0x90109c23 in -[NSView  
_recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView 
:]
#11	0x90109c23 in -[NSView  
_recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView 
:]
#12	0x9010870b in -[NSThemeFrame  
_recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView 
:]
#13	0x9010522f in -[NSView  
_displayRectIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:]

#14 0x90045c87 in -[NSView displayIfNeeded]
#15 0x90045835 in -[NSWindow displayIfNeeded]
#16 0x90045658 in _handleWindowNeedsDisplay
#17 0x910f89a2 in __CFRunLoopDoObservers
#18 0x910f9d05 in CFRunLoopRunSpecific
#19 0x910facf8 in CFRunLoopRunInMode
#20 0x9159fda4 in RunCurrentEventLoopInMode
#21 0x9159faf6 in ReceiveNextEventCommon
#22 0x9159fa31 in BlockUntilNextEventMatchingListInMode
#23 0x900434fd in _DPSNextEvent
#24	0x90042db0 in -[NSApplication  
nextEventMatchingMask:untilDate:inMode:dequeue:]

#25 0x9003bdeb in -[NSApplication run]
#26 0x90009028 in NSApplicationMain
#27 0x7401 in main at main.m:13

There are a bunch of other threads, too many to reasonably list in a  
message to the list.


While I continue debugging and trying to track down what I'm doing  
that starts the deadlock, does anyone have any general ideas on where  
it would be best to look?


Thanks,
Colin
___

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 [EMAIL PROTECTED]


Re: Core Animation Deadlock

2008-04-24 Thread John Stiles
You could also show any other thread stuck trying to lock a mutex? I 
assume there's another thread holding this lock or stuck trying to lock 
something else.



Colin Cornaby wrote:

Hi,

I'm currently trying to track down a deadlock. After adding a series 
of layers, CoreAnimation deadlocks here on the main thread:


#00x958af4ee in semaphore_wait_signal_trap
#10x958b6fc5 in pthread_mutex_lock
#20x909f8d72 in CAContextCommitTransaction
#30x909f89bd in CATransactionCommit
#40x90375351 in -[NSView(NSLayerKitGlue) _drawRectAsLayerTree:]
#50x9010ab1e in -[NSView _drawRect:clip:]
#60x901091ed in -[NSView 
_recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:] 

#70x90109c23 in -[NSView 
_recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:] 

#80x90109c23 in -[NSView 
_recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:] 

#90x90109c23 in -[NSView 
_recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:] 

#100x90109c23 in -[NSView 
_recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:] 

#110x90109c23 in -[NSView 
_recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:] 

#120x9010870b in -[NSThemeFrame 
_recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:] 

#130x9010522f in -[NSView 
_displayRectIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:]

#140x90045c87 in -[NSView displayIfNeeded]
#150x90045835 in -[NSWindow displayIfNeeded]
#160x90045658 in _handleWindowNeedsDisplay
#170x910f89a2 in __CFRunLoopDoObservers
#180x910f9d05 in CFRunLoopRunSpecific
#190x910facf8 in CFRunLoopRunInMode
#200x9159fda4 in RunCurrentEventLoopInMode
#210x9159faf6 in ReceiveNextEventCommon
#220x9159fa31 in BlockUntilNextEventMatchingListInMode
#230x900434fd in _DPSNextEvent
#240x90042db0 in -[NSApplication 
nextEventMatchingMask:untilDate:inMode:dequeue:]

#250x9003bdeb in -[NSApplication run]
#260x90009028 in NSApplicationMain
#270x7401 in main at main.m:13

There are a bunch of other threads, too many to reasonably list in a 
message to the list.


While I continue debugging and trying to track down what I'm doing 
that starts the deadlock, does anyone have any general ideas on where 
it would be best to look?


Thanks,
Colin
___

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/jstiles%40blizzard.com

This email sent to [EMAIL PROTECTED]

___

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 [EMAIL PROTECTED]


Re: Core Animation Deadlock

2008-04-24 Thread Colin Cornaby
It looks like NSUIHeartBeat could be attempting to lock something.  
Although I could be wrong, it may not be related.


Here's the full stack trace across all threads.

(gdb) thread apply all bt

Thread 37 (process 13823 thread 0xf11b):
#0  0x958af506 in semaphore_timedwait_signal_trap ()
#1  0x958e184f in _pthread_cond_wait ()
#2  0x958e30d3 in pthread_cond_timedwait_relative_np ()
#3  0x90e5ae8c in -[NSCondition waitUntilDate:] ()
#4  0x90e5aca0 in -[NSConditionLock lockWhenCondition:beforeDate:] ()
#5  0x90e5ac05 in -[NSConditionLock lockWhenCondition:] ()
#6  0x900a9468 in -[NSUIHeartBeat _heartBeatThread:] ()
#7  0x90e14f1d in -[NSThread main] ()
#8  0x90e14ac4 in __NSThread__main__ ()
#9  0x958e06f5 in _pthread_start ()
#10 0x958e05b2 in thread_start ()

Thread 36 (process 13823 thread 0xf207):
#0  0x958af506 in semaphore_timedwait_signal_trap ()
#1  0x958e184f in _pthread_cond_wait ()
#2  0x958e30d3 in pthread_cond_timedwait_relative_np ()
#3  0x96dd52fe in TSWaitOnConditionTimedRelative ()
#4  0x96df5fc4 in MPWaitOnQueue ()
#5  0x918f99b8 in TFolderSizeTask::FolderSizeTaskProc ()
#6  0x96df455b in PrivateMPEntryPoint ()
#7  0x958e06f5 in _pthread_start ()
#8  0x958e05b2 in thread_start ()

Thread 35 (process 13823 thread 0xf513):
#0  0x958af506 in semaphore_timedwait_signal_trap ()
#1  0x958e184f in _pthread_cond_wait ()
#2  0x958e30d3 in pthread_cond_timedwait_relative_np ()
#3  0x96dd52fe in TSWaitOnConditionTimedRelative ()
#4  0x96df5fc4 in MPWaitOnQueue ()
#5  0x918f99b8 in TFolderSizeTask::FolderSizeTaskProc ()
#6  0x96df455b in PrivateMPEntryPoint ()
#7  0x958e06f5 in _pthread_start ()
#8  0x958e05b2 in thread_start ()

Thread 34 (process 13823 thread 0xcf57):
#0  0x958af506 in semaphore_timedwait_signal_trap ()
#1  0x958e184f in _pthread_cond_wait ()
#2  0x958e30d3 in pthread_cond_timedwait_relative_np ()
#3  0x96dd52fe in TSWaitOnConditionTimedRelative ()
#4  0x96df5fc4 in MPWaitOnQueue ()
#5  0x918f99b8 in TFolderSizeTask::FolderSizeTaskProc ()
#6  0x96df455b in PrivateMPEntryPoint ()
#7  0x958e06f5 in _pthread_start ()
#8  0x958e05b2 in thread_start ()

Thread 33 (process 13823 thread 0xe35f):
#0  0x958ff5e2 in select$DARWIN_EXTSN ()
#1  0x9110550f in __CFSocketManager ()
#2  0x958e06f5 in _pthread_start ()
#3  0x958e05b2 in thread_start ()

Thread 32 (process 13823 thread 0xdc07):
#0  0x958dff66 in kevent ()
#1  0x910cf39f in __monitor_file_descriptor__ ()
#2  0x958e06f5 in _pthread_start ()
#3  0x958e05b2 in thread_start ()

Thread 31 (process 13823 thread 0xce57):
#0  0x958af506 in semaphore_timedwait_signal_trap ()
#1  0x958e184f in _pthread_cond_wait ()
#2  0x958e30d3 in pthread_cond_timedwait_relative_np ()
#3  0x96dd52fe in TSWaitOnConditionTimedRelative ()
#4  0x96df5fc4 in MPWaitOnQueue ()
#5  0x918ff3bb in TPropertyTask::PropertyTaskProc ()
#6  0x96df455b in PrivateMPEntryPoint ()
#7  0x958e06f5 in _pthread_start ()
#8  0x958e05b2 in thread_start ()

Thread 30 (process 13823 thread 0xc657):
#0  0x958b668e in __semwait_signal ()
#1  0x958e1986 in _pthread_cond_wait ()
#2  0x958e136d in pthread_cond_wait$UNIX2003 ()
#3  0x96df6347 in TSWaitOnCondition ()
#4  0x96dd52d2 in TSWaitOnConditionTimedRelative ()
#5  0x96df5fc4 in MPWaitOnQueue ()
#6  0x918f7a6e in TNodeSyncTask::SyncTaskProc ()
#7  0x96df455b in PrivateMPEntryPoint ()
#8  0x958e06f5 in _pthread_start ()
#9  0x958e05b2 in thread_start ()

Thread 29 (process 13823 thread 0xb803):
#0  0x958af4a6 in mach_msg_trap ()
#1  0x958b6c9c in mach_msg ()
#2  0x910fa0be in CFRunLoopRunSpecific ()
#3  0x910fad54 in CFRunLoopRun ()
#4  0x918ec5dc in  
TFSEventsNotificationTask::FSEventsNotificationTaskProc ()

#5  0x96df455b in PrivateMPEntryPoint ()
#6  0x958e06f5 in _pthread_start ()
#7  0x958e05b2 in thread_start ()

Thread 28 (process 13823 thread 0xb407):
#0  0x958af4a6 in mach_msg_trap ()
#1  0x958b6c9c in mach_msg ()
#2  0x910fa0be in CFRunLoopRunSpecific ()
#3  0x910fad54 in CFRunLoopRun ()
#4  0x918ec463 in TSystemNotificationTask::SystemNotificationTaskProc ()
#5  0x96df455b in PrivateMPEntryPoint ()
#6  0x958e06f5 in _pthread_start ()
#7  0x958e05b2 in thread_start ()

Thread 27 (process 13823 thread 0xb203):
#0  0x in ?? ()
Cannot access memory at address 0x0

Thread 26 (process 13823 thread 0x320f):
#0  0x in ?? ()
Cannot access memory at address 0x0

Thread 25 (process 13823 thread 0x5e0f):
#0  0x in ?? ()
Cannot access memory at address 0x0

Thread 24 (process 13823 thread 0x5d1b):
#0  0x in ?? ()
Cannot access memory at address 0x0

Thread 23 (process 13823 thread 0x7e0b):
#0  0x in ?? ()
Cannot access memory at address 0x0

Thread 22 (process 13823 thread 0xb007):
#0  0x in ?? ()
Cannot access memory at address 0x0

Thread 21 (process 13823 thread 0x7c47):
#0  0x in ?? ()
Cannot access memory at address 0x0

Thread 20 (process 13823 thread 0xaf27):
#0  0x9591907a in __workq_ops ()
#1  0x9591a772 in workqueue_exit ()
#2  0x959190aa in start_wqthread ()

Thread 19 

Re: Core Animation Deadlock

2008-04-24 Thread John Harper


On Apr 24, 2008, at 7:38 PM, Colin Cornaby wrote:

It looks like NSUIHeartBeat could be attempting to lock something.  
Although I could be wrong, it may not be related.


The render thread got stuck while depth sorting:


Thread 11 (process 13823 thread 0x8803):
#0  0x90a27d9c in CARenderLayerDepthSortSublayers ()
#1  0x90a27611 in prepare_layer0 ()
#2  0x90a27597 in prepare_layer0 ()
#3  0x90a27597 in prepare_layer0 ()
#4  0x90a26dd4 in CARenderUpdateAddContext ()
#5  0x90a25f72 in view_draw ()
#6  0x90a34f60 in view_display_link ()
#7  0x90a26936 in link_callback ()
#8  0x94cc1015 in CVDisplayLink::performIO ()
#9  0x94cc1641 in CVDisplayLink::runIOThread ()
#10 0x958e06f5 in _pthread_start ()
#11 0x958e05b2 in thread_start ()



this is done while holding the lock the main thread is trying to take.  
I can't think of any way you could cause this other than heap  
corruption, or maybe over-releasing objects, so it could be a CA bug.  
I would try running with NSZombies enabled first; if you don't see  
anything wrong that way, file a bug report (with a test case showing  
the hang if possible, otherwise there's probably no way we can debug  
it…)


John



___

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 [EMAIL PROTECTED]