Thanks for the information. I haven't look into the mechanics of how this works 
before, but I did peak into EOCustomObject's ___setRetainCount. Unfortunately 
it's a final method.

I guess we can use some sort of home grown method based on something like 
ERXRetainer, but it makes me feel pretty uncomfortable to be writing our own 
code to work around a bug as fundamental as this. I would have guessed that 
nested editing contexts are a widely used feature, so I am surprised I don't 
here more about the issue. I guess I should file a bug report with Apple. A 
Wonder workaround would be really nice though!

--
James

On 25 Mar 2010, at 21:38, Mike Schrag wrote:

> I don't have a patch you can easily apply. The workaround on your side is to 
> not let the EO in the parent EC garbage collect (basically, keep a reference 
> to the parent EO around for any EO that you fault into child EC). There's not 
> an easy recovery from this -- you have to toss your EC stack ... or .. maybe 
> you could refetch the snapshot underneath it, but i think you're probably 
> left with a __retainCount of -1 at that point, so probably even that won't 
> help you.
> 
> I think this could be fixed pretty easily  in wonder by overriding 
> ERXGenericRecord.__setRetainCount .. When count is set >0, call back to your 
> EC and retain the object in a dict and when it drops to 0, release that ref.
> 
> On Mar 25, 2010, at 4:25 PM, Brook, James wrote:
> 
>> Mike,
>> 
>> That sounds all too familiar to me. We are experiencing errors just like 
>> that. We have a feature that creates nested editing contexts several levels 
>> deep and fetches EOs all the way down to the bottom. Do you know of a 
>> workaround, patch or some way to recover from the bug you mention? I seem to 
>> remember a similar bug years ago in the days when EOF kept strong 
>> references. We are using Wonder.
>> 
>> Sorry for selfishly jumping in. Disappearing snapshots are causing us lots 
>> of pain because whole instances of our application become useless.
>> 
>> --
>> James
>> ________________________________________
>> From: webobjects-dev-bounces+jbrook=upcbroadband....@lists.apple.com 
>> [webobjects-dev-bounces+jbrook=upcbroadband....@lists.apple.com] On Behalf 
>> Of Mike Schrag [msch...@mdimension.com]
>> Sent: 25 March 2010 20:20
>> To: Marc Guenther
>> Cc: webobjects-dev@lists.apple.com
>> Subject: Re: Snapshots mysteriously vanishing?
>> 
>>>> by any chance was this an EO in a parent editing context that also existed 
>>>> in a child editingcontext?
>>> 
>>> I don't think so, but I'm not sure. That particular EO could have been in 
>>> all differents ECs at the time, as it's entity is used all over the place.
>>> 
>>> Do you have anything specific in mind?
>> yeah, there's a bug with refcounting of eo's in child ec's if the parent ec 
>> copy of the EO gets garbage collected ... the result of this bug is 
>> disappearing snapshots. this specifically applies to eo's fetched into a 
>> child that were already fetched into the parent, though, not to peer ec's.
>> 
>> ms
>> _______________________________________________
>> Do not post admin requests to the list. They will be ignored.
>> Webobjects-dev mailing list      (Webobjects-dev@lists.apple.com)
>> Help/Unsubscribe/Update your Subscription:
>> http://lists.apple.com/mailman/options/webobjects-dev/jbrook%40upcbroadband.com
>> 
>> This email sent to jbr...@upcbroadband.com
> 
> 

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

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

Reply via email to