Hello, I recently wrote a Rails app that launches 7 threads that each need to do ActiveRecord::Base.finds on a PostgreSQL database. I figured that since no database information is being changed on calls to find, these calls would not require mutual exclusion. However, if I don''t use mutual exclusion, I get all sorts of weird errors not long after the threads are spawned. It works just fine if I use mutual exclusion. Anyone know why this is? Thanks! --~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Matt White schrieb:> Hello, > > I recently wrote a Rails app that launches 7 threads that each need to > do ActiveRecord::Base.finds on a PostgreSQL database. I figured that > since no database information is being changed on calls to find, these > calls would not require mutual exclusion. However, if I don''t use > mutual exclusion, I get all sorts of weird errors not long after the > threads are spawned. It works just fine if I use mutual exclusion. > Anyone know why this is? Thanks! > > > > >you wouldn''t happen to be sharing variables among threads? I recently had that problem; I had mistakenly used instance vars in a threaded server. Then each new thread would change the instance vars and the old thread would go crazy with the new values. never used the mutual exclusion though, the pick-axe discussion scared me away /ak --~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On Jul 6, 3:42 pm, Andy Koch <andy.k...-sBIqA0PYact54TAoqtyWWQ@public.gmane.org> wrote:> you wouldn''t happen to be sharing variables among threads? > > I recently had that problem; I had mistakenly used instance vars in a > threaded server. Then each new thread would change the instance vars > and the old thread would go crazy with the new values. > > never used the mutual exclusion though, the pick-axe discussion scared > me away > > /akNope, I was pretty careful about launching each thread with its own instance variables. --~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---