Re: PropertyLocks?: strange exc_bad_access crash
Re: PropertyLocks?: strange exc_bad_access crash
- Subject: Re: PropertyLocks?: strange exc_bad_access crash
- From: Quincey Morris <email@hidden>
- Date: Mon, 9 Aug 2010 11:03:07 -0700
On Aug 9, 2010, at 10:07, James Maxwell wrote:
> I'm getting a crash with this trace:
>
> #0 0x99535ed7 in objc_msgSend
> #1 0xa0bf5224 in PropertyLocks
> #2 0x0001b792 in -[HSMM_Sequencer inputMemory] at HSMM_Sequencer.m:664
> #3 0x0001903b in -[HSMM_Sequencer predictForward:] at HSMM_Sequencer.m:262
> #4 0x00010253 in __-[HSMM_NetworkController runNetworkPrediction]_block_invoke_ at HSMM_NetworkController.m:256
> #5 0x97762aa0 in _dispatch_apply2
> #6 0x976332b2 in _dispatch_worker_thread2
> #7 0x97632d41 in _pthread_wqthread
> #8 0x97632b86 in start_wqthread
>
>
> It only happens when running a particular function from its saved state (i.e., from initWithCoder). I've looked for the usual suspects, in terms of zombies and such, but I can't see anything obvious. The same algorithm runs fine from its newly created state (i.e., using init, rather than initWithCoder), so decoding must be somehow involved.
> Does this trace indicate anything special? Snooping into the objc_msgSend in gdb I see that the selector is a retain, which I'm assuming would only cause a crash if it was sent to a released object. I've not been able to find any info on "PropertyLocks", but it certainly sounds as though it's related to locking atomic properties... don't know though. What's strange, to me, is that if this is a threading problem, why does it only happen from a decoded state, not from a clean inited state?
Where is initWithCoder? Are you saying that you spun off a background thread that uses just-decoded objects from within initWithCoder in a different thread? In that case, how do you ensure that the decoding is complete first?
Unless you do something special, the original decoding path is going to continue in parallel with the background operation. That means a mutable and possibly changing object graph is actively being used by 2 threads, which could be a recipe for disaster, even if only one of the threads is changing anything. It could even mean that the decoding itself proceeds simultaneously in multiple threads, which is likely an even bigger disaster.
Or your problem could easily be a memory management error, as Graham suggests, but the conjunction of initWithCoder: and multithreading set off very loud alarm bells in my head.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden