Hi There Is active record 3.1.1 supposed to be threadsafe? In other words, should the following (concurrent access to a model) work?
Thread.new do MyModel.where(some_condition).first end Thread.new do MyModel.where(some_condition).first end I ask because upon the answer, it depends which component should handle synchronization, and in consequence, which component to patch/fix. A bit of background: We stumbled over a concurrency issue when using capybara-webkit with rails3.1. We traced the issue down to one thread querying and trying to accessing the cache while another thread cleared the same cache. Assuming active record 3.1.1 is supposed to be threadsafe, then the culprit for the issue would be ActiveRecord::ConnectionAdapters::QueryCache, which doesn't synchronize access to its @query_cache. See https://github.com/awd-switzerland/rails/commit/22aeda0f0553fdcabca156012b67f2aa2add293c for a possible way to resolve that. However, I'm not sure in which layer the rails team wants to handle synchronization. Also notice that the patch is naive in that it simply assumes thread support in ruby to be enabled. Best regards Stefan Rusterholz -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

