Re: CA_DEBUG_TRANSACTIONS=1

2012-09-06 Thread Eric Wing
On 9/5/12, John MacMullin  wrote:
> I am getting the following message:  CoreAnimation: warning, deleted thread
> with uncommitted CATransaction; set CA_DEBUG_TRANSACTIONS=1 in environment
> to log backtraces.
>
> What in general would be causing this?
>


Just another data point. This recently started appearing in my code
when running in 10.8. It's been hard to track down, but I'm now
certain the problem was in Apple's IKImageView implementation (i.e. an
Apple bug) which I had no control over. I think this was sometimes
leading to crashes as well. The problem is hard to reproduce, but my
theory is that changing a property on the IKImageView while it was
animating or removing/releasing the view while it was animating would
cause this. Since I discovered a serious memory leak in the framework
too, I had to ditch using it completely. All these problems went away
when I did that.

But the overall point is that the message can also be generated by
Apple's own frameworks and it is possible that it not coming from your
code. 10.8 in particular seemed to make a lot of changes to Core
Animation under the hood to make it more multithreaded which may have
also created new bugs.

-Eric
-- 
Beginning iPhone Games Development
http://playcontrol.net/iphonegamebook/
___

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: CA_DEBUG_TRANSACTIONS=1

2012-09-06 Thread Kyle Sluder
On Thu, Sep 6, 2012, at 09:09 AM, John MacMullin wrote:
> More or less.
> 
> It appears that since the documentation in NSBundle does not state that
> its thread safe, it isn't.

This really isn't the whole story. NSBundle isn't thread-safe (don't
send it messages from multiple threads), but is probably safe to use
from non-main threads, as long as it's only used from one thread.

By contrast, you should NEVER load a nib from a background thread.
AppKit is very dependent on running on the main thread.

> 
> From Core Animation tho, it would appear that executing a CATransaction
> flush may have resolved my original message, but perhaps not the problem.
> 
> If I read this correctly, this updates the layers, which wouldn't
> otherwise be updated on a background thread.

Doubtful; +flush pushes values from the model tree to the presentation
tree, but it doesn't actually close a transaction. You'd still have an
open transaction when the thread was exited.

> 
> It would seem that if I call a non-thread safe function in a background
> thread, i.e., from an NSOperationQueue, that a compile or other error
> should result.

In order to know that you're doing this, the compiler would need to be
able to simulate execution of your code. Given the design of the C type
system and program execution model, this is an impossibility. You cannot
build a compiler with this functionality that will also allow
compilation of all valid C programs. You could design a language with
this safety feature (for example, a "background" attribute built into
the type system), but there would then exist valid programs that the
compiler would reject. C prefers to let you shoot yourself in the foot
rather than restrict you from writing programs simply because the
compiler cannot prove they are correct.

--Kyle Sluder
___

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: CA_DEBUG_TRANSACTIONS=1

2012-09-06 Thread John MacMullin
More or less.

It appears that since the documentation in NSBundle does not state that its 
thread safe, it isn't.

>From Core Animation tho, it would appear that executing a CATransaction flush 
>may have resolved my original message, but perhaps not the problem.

If I read this correctly, this updates the layers, which wouldn't otherwise be 
updated on a background thread.

It would seem that if I call a non-thread safe function in a background thread, 
i.e., from an NSOperationQueue, that a compile or other error should result.

On Sep 5, 2012, at 5:48 PM, Kyle Sluder  wrote:

> On Sep 5, 2012, at 5:13 PM, John MacMullin  wrote:
> 
>> Ok, that was it.  I loaded [NSBundle loadNibNamed:XXX] in a background 
>> thread.
>> 
>> Fixing that problem resolved the message.
> 
> Did the process of fixing it also illuminate other areas you seem to be hazy 
> on, such as how Core Animation works, why loading nibs on background threads 
> is always incorrect, and how the debugger fits into the Xcode 
> edit/compile/debug cycle?
> 
> --Kyle Sluder

Best regards,

John MacMullin
___

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: CA_DEBUG_TRANSACTIONS=1

2012-09-05 Thread Kyle Sluder
On Sep 5, 2012, at 5:13 PM, John MacMullin  wrote:

> Ok, that was it.  I loaded [NSBundle loadNibNamed:XXX] in a background thread.
> 
> Fixing that problem resolved the message.

Did the process of fixing it also illuminate other areas you seem to be hazy 
on, such as how Core Animation works, why loading nibs on background threads is 
always incorrect, and how the debugger fits into the Xcode edit/compile/debug 
cycle?

--Kyle Sluder
___

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: CA_DEBUG_TRANSACTIONS=1

2012-09-05 Thread John MacMullin
Ok, that was it.  I loaded [NSBundle loadNibNamed:XXX] in a background thread.

Fixing that problem resolved the message.

Thanks.
On Sep 5, 2012, at 4:13 PM, Kyle Sluder  wrote:

> On Sep 5, 2012, at 4:12 PM, John MacMullin wrote:
> 
>> Ok, I went to the scheme in Xcode and added the variable.  Running again 
>> produced the following backtrace.
>> 
>> 0   QuartzCore  0x7fff8a736b95 
>> _ZN2CA11Transaction4pushEv + 219
>> 1   QuartzCore  0x7fff8a73676d 
>> _ZN2CA11Transaction15ensure_implicitEv + 273
>> 2   QuartzCore  0x7fff8a73660a 
>> _ZN2CA11Transaction9set_valueEj12_CAValueTypePKv + 40
>> 3   QuartzCore  0x7fff8a73659e +[CATransaction 
>> setDisableActions:] + 38
>> 4   AppKit  0x7fff8e3ef8ae -[NSScrollerImp 
>> _updateLayerGeometry] + 67
>> 5   AppKit  0x7fff8e3eee8d 
>> -[NSScroller(NSInternal2) _replaceScrollerImp] + 368
>> 6   AppKit  0x7fff8e486ff8 -[NSScroller 
>> initWithCoder:] + 305
>> 7   Foundation  0x7fff8b763c39 
>> _decodeObjectBinary + 2741
>> 8   Foundation  0x7fff8b764a16 
>> -[NSKeyedUnarchiver _decodeArrayOfObjectsForKey:] + 1189
>> 9   Foundation  0x7fff8b764f88 
>> -[NSArray(NSArray) initWithCoder:] + 538
>> 10  Foundation  0x7fff8b763c39 
>> _decodeObjectBinary + 2741
>> 11  Foundation  0x7fff8b762fe4 _decodeObject + 
>> 226
>> 12  AppKit  0x7fff8e309061 -[NSView 
>> initWithCoder:] + 976
>> 13  AppKit  0x7fff8e484597 -[NSScrollView 
>> initWithCoder:] + 335
>> 14  Foundation  0x7fff8b763c39 
>> _decodeObjectBinary + 2741
>> 15  Foundation  0x7fff8b762fe4 _decodeObject + 
>> 226
>> 
>> Is is possible to attach the debugger to this so that I can see the problem 
>> in my code?
> 
> You should already be running in the debugger.
> 
> Are you perhaps decoding a nib on a background thread?
> 
>> 
>> Or can/should this be resolved with Atos?
>> 
>> And back to the beginning, what is an uncommitted CATransaction?
> 
> Re-read the Core Animation Programming Guide. Core Animation uses a 
> per-thread transaction model.
> 
> --Kyle Sluder

Best regards,

John MacMullin
___

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: CA_DEBUG_TRANSACTIONS=1

2012-09-05 Thread Kyle Sluder
On Sep 5, 2012, at 4:12 PM, John MacMullin wrote:

> Ok, I went to the scheme in Xcode and added the variable.  Running again 
> produced the following backtrace.
> 
> 0   QuartzCore  0x7fff8a736b95 
> _ZN2CA11Transaction4pushEv + 219
> 1   QuartzCore  0x7fff8a73676d 
> _ZN2CA11Transaction15ensure_implicitEv + 273
> 2   QuartzCore  0x7fff8a73660a 
> _ZN2CA11Transaction9set_valueEj12_CAValueTypePKv + 40
> 3   QuartzCore  0x7fff8a73659e +[CATransaction 
> setDisableActions:] + 38
> 4   AppKit  0x7fff8e3ef8ae -[NSScrollerImp 
> _updateLayerGeometry] + 67
> 5   AppKit  0x7fff8e3eee8d 
> -[NSScroller(NSInternal2) _replaceScrollerImp] + 368
> 6   AppKit  0x7fff8e486ff8 -[NSScroller 
> initWithCoder:] + 305
> 7   Foundation  0x7fff8b763c39 
> _decodeObjectBinary + 2741
> 8   Foundation  0x7fff8b764a16 
> -[NSKeyedUnarchiver _decodeArrayOfObjectsForKey:] + 1189
> 9   Foundation  0x7fff8b764f88 -[NSArray(NSArray) 
> initWithCoder:] + 538
> 10  Foundation  0x7fff8b763c39 
> _decodeObjectBinary + 2741
> 11  Foundation  0x7fff8b762fe4 _decodeObject + 226
> 12  AppKit  0x7fff8e309061 -[NSView 
> initWithCoder:] + 976
> 13  AppKit  0x7fff8e484597 -[NSScrollView 
> initWithCoder:] + 335
> 14  Foundation  0x7fff8b763c39 
> _decodeObjectBinary + 2741
> 15  Foundation  0x7fff8b762fe4 _decodeObject + 226
> 
> Is is possible to attach the debugger to this so that I can see the problem 
> in my code?

You should already be running in the debugger.

Are you perhaps decoding a nib on a background thread?

> 
> Or can/should this be resolved with Atos?
> 
> And back to the beginning, what is an uncommitted CATransaction?

Re-read the Core Animation Programming Guide. Core Animation uses a per-thread 
transaction model.

--Kyle Sluder
___

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: CA_DEBUG_TRANSACTIONS=1

2012-09-05 Thread John MacMullin
Ok, I went to the scheme in Xcode and added the variable.  Running again 
produced the following backtrace.

0   QuartzCore  0x7fff8a736b95 
_ZN2CA11Transaction4pushEv + 219
1   QuartzCore  0x7fff8a73676d 
_ZN2CA11Transaction15ensure_implicitEv + 273
2   QuartzCore  0x7fff8a73660a 
_ZN2CA11Transaction9set_valueEj12_CAValueTypePKv + 40
3   QuartzCore  0x7fff8a73659e +[CATransaction 
setDisableActions:] + 38
4   AppKit  0x7fff8e3ef8ae -[NSScrollerImp 
_updateLayerGeometry] + 67
5   AppKit  0x7fff8e3eee8d 
-[NSScroller(NSInternal2) _replaceScrollerImp] + 368
6   AppKit  0x7fff8e486ff8 -[NSScroller 
initWithCoder:] + 305
7   Foundation  0x7fff8b763c39 _decodeObjectBinary 
+ 2741
8   Foundation  0x7fff8b764a16 -[NSKeyedUnarchiver 
_decodeArrayOfObjectsForKey:] + 1189
9   Foundation  0x7fff8b764f88 -[NSArray(NSArray) 
initWithCoder:] + 538
10  Foundation  0x7fff8b763c39 _decodeObjectBinary 
+ 2741
11  Foundation  0x7fff8b762fe4 _decodeObject + 226
12  AppKit  0x7fff8e309061 -[NSView 
initWithCoder:] + 976
13  AppKit  0x7fff8e484597 -[NSScrollView 
initWithCoder:] + 335
14  Foundation  0x7fff8b763c39 _decodeObjectBinary 
+ 2741
15  Foundation  0x7fff8b762fe4 _decodeObject + 226

Is is possible to attach the debugger to this so that I can see the problem in 
my code?

Or can/should this be resolved with Atos?

And back to the beginning, what is an uncommitted CATransaction?

On Sep 5, 2012, at 3:41 PM, Kyle Sluder  wrote:

> On Wed, Sep 5, 2012, at 03:35 PM, John MacMullin wrote:
>> I am getting the following message:  CoreAnimation: warning, deleted
>> thread with uncommitted CATransaction; set CA_DEBUG_TRANSACTIONS=1 in
>> environment to log backtraces.
>> 
>> What in general would be causing this?
> 
> In general, it would be caused by deleting a thread with an uncommitted
> CATransaction. ;-)
> 
>> 
>> How do I set CA_DEBUG_TRANSACTIONS=1?
> 
> It's an environment variable. Set it in the Environment Variables
> section of the Arguments tab in the settings for the Run action of your
> scheme.
> 
> --Kyle Sluder

Best regards,

John MacMullin

___

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: CA_DEBUG_TRANSACTIONS=1

2012-09-05 Thread Kyle Sluder
On Wed, Sep 5, 2012, at 03:35 PM, John MacMullin wrote:
> I am getting the following message:  CoreAnimation: warning, deleted
> thread with uncommitted CATransaction; set CA_DEBUG_TRANSACTIONS=1 in
> environment to log backtraces.
> 
> What in general would be causing this?

In general, it would be caused by deleting a thread with an uncommitted
CATransaction. ;-)

> 
> How do I set CA_DEBUG_TRANSACTIONS=1?

It's an environment variable. Set it in the Environment Variables
section of the Arguments tab in the settings for the Run action of your
scheme.

--Kyle Sluder
___

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


CA_DEBUG_TRANSACTIONS=1

2012-09-05 Thread John MacMullin
I am getting the following message:  CoreAnimation: warning, deleted thread 
with uncommitted CATransaction; set CA_DEBUG_TRANSACTIONS=1 in environment to 
log backtraces.

What in general would be causing this?

How do I set CA_DEBUG_TRANSACTIONS=1?

Best regards,

John MacMullin

___

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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