require should be made either threadsafe or guaranteed to run the discovered 
file exactly once
----------------------------------------------------------------------------------------------

                 Key: JRUBY-3078
                 URL: http://jira.codehaus.org/browse/JRUBY-3078
             Project: JRuby
          Issue Type: Bug
          Components: Core Classes/Modules
            Reporter: Charles Oliver Nutter
             Fix For: JRuby 1.1.6


In examining JRUBY-3057, we discovered that requires are not really as 
thread-safe as they could be. They may cause two threads to execute the same 
file at the same time, which is both a risk for concurrency and a violation of 
require's implicit "execute exactly once" guarantee. A simple global 
synchronization of require could lead two threads requiring the same files in 
different orders to deadlock, so a full-on synchronization is not likely to be 
possible. We must explore that possibility.

If it turns out that a general synchronization of require is not possible, we 
must fall back on our alternative option: at least guarantee that require does 
not ever execute a file that has been or is currently being required by another 
thread. This is a much smaller goal, since it largely only requires 
synchronizing on the list of loaded features and guaranteeing that features in 
that list have at least "started" to load, if not finished (the latter 
guarantee being impossible without a global synchronization).

JRUBY-3057 was fixed by avoiding concurrent requires due to time constraints 
and the potential for an overreaching require synchronization to cause 
catastrophic failures under heavily concurrent load. We should look into the 
described require thread-safety options for a future release.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply via email to