On Saturday, January 31, 2015 at 8:30:20 AM UTC-8, Nels Nelson wrote:
>
> On Thursday, January 29, 2015 at 4:39:20 PM UTC-6, Nels Nelson wrote:
>>
>> On Thursday, January 29, 2015 at 3:41:27 PM UTC-6, Jeremy Evans wrote:
>>>
>>> Could you try adding the :instance_specific => true option when defining 
>>> the tags association and see if the problem still occurs?
>>>
>> Yes, I will definitely try that.  Code is running now with those editions.
>>
>
> Yes, it still occurs.
>
> I let the program run for 48 hours, and it only occurred once.
>

That's helpful.  That means the problem is probably not related to the 
placeholder loader (which is used in the general case).
 

>
> In the method which attempts to access thing.tags, I am doing this:
>
>     def get_tag_names
>       log.error "Why is #{self}.tags nil?" if tags.nil?
>       tags.compact.map(&:to_s)
>     end
>
> This code gets invoked at least once every second.  I may try to invoke it 
> more often, to see if I can coax the error to occur more frequently.
>
> Oddly, the second tags invocation almost never returns nil, only the first 
> invocation in the conditional.  Of course, without the pre-check for 
> tags.nil?, that second invocation would fail with a NoMethodError since 
> NilClass hasn't defined #compact().
>
> I'm not sure why two threads would ever be accessing the same model 
> instance.  Is it possible that a navigation with rcte_tree might return the 
> exact same object in memory as a different tree navigation in another 
> thread?
>

I don't think that should be possible.

If I had to guess, the problem is related to rcte_tree and not the general 
associations code.  Can you show how you are loading the object that is 
calling tags when tags is nil?  Is it from an rcte_tree association, was it 
eager loaded, did it load the tags association earlier (eagerly or not)?

Obviously, a self contained example would be great, but considering how 
rarely the problem seems to occur, I can see how putting one of those 
together would be difficult.

Thanks,
Jeremy

-- 
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sequel-talk.
For more options, visit https://groups.google.com/d/optout.

Reply via email to