>  Are there any claims as to whether Dependencies is thread safe? I was
>  working on an odd startup problem one of our scripts has and it turns
>  out that there seems to be a race condition:

We actually discussed this in #rails-contrib earlier today.   As it
stands there are absolutely no locks or synchronisation in
dependencies.rb, so it's completely thread-dangerous.  There are a
couple of things we could do:

1) Have a giant 'doing dependencies lock

By wrapping a big lock around load_missing_constant and friends so
only one thread goes about creating classes at any given time.  All
the other threads would have to wait for that lock to be released.
This would probably be a little difficult to test, but not too
difficult.

2) Have an alternative Dependencies mode.

Just load everything up front before we start dispatching requests.

Both these options were discussed in #9155 like tarmo said.  Rather
than Thread#exclusive we could use some specific mutexes so other
threads can go about their other business.  Any takers?



-- 
Cheers

Koz

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Core" 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-core?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to