On Friday, February 28, 2014 7:47:08 PM UTC-8, Nels Nelson wrote: > > Occasionally, when I run this code in a multi-threaded environment, I > observe the provided error when accessing for example apple.tags. > > https://gist.github.com/nelsnelson/9284736 > > Not quite sure how to debug this, or fix it. The invoking code is simply > attempting to retrieve the an object's tags within its own thread. >
So this error appears to be due to the fact that it is trying to eager load the tags (maybe due to the combination of eager_each and tactical_eager_loading) and the id_map for the eager_loader contains objects that aren't in the rows that eager loader is supposed to be loading. Alternatively, it could be caused by objects being added to the rows while the eager_loader is running. This might be due to tactical_eager_loading, single_table_inheritance, eager_each, or some combination of those plugins, but obviously I'll need to be able to reproduce it to debug it. How are you running that code in a multi-threaded environment? I don't see it starting any threads. Are you able to reproduce it just by running it? I see eager_each in the backtrace and not in the code, which leads me to believe that the code you posted is not the code that generated the backtrace you posted. You can try removing tactical_eager_loading and/or eager_each plugins and see if the issue goes away, that would be good to know to help narrow down the problem. Also, just FYI, you don't need to require 'jdbc-postgres' or set Sequel::Model.db manually. Also, your tagged association (which you don't appear to be using), needs to use a :key_method option, since object_id is an existing ruby method. Finally, Model#save returns self, so you don't need to return self explicitly in tag and untag. 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/groups/opt_out.
