commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 9206] New: - FastArrayList, FastHashMap and FastTreeMap not cross-platform
Date Fri, 17 May 2002 16:51:23 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=9206>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=9206

FastArrayList, FastHashMap and FastTreeMap not cross-platform

           Summary: FastArrayList, FastHashMap and FastTreeMap not cross-
                    platform
           Product: Commons
           Version: unspecified
          Platform: Other
        OS/Version: Other
            Status: NEW
          Severity: Major
          Priority: Other
         Component: Collections
        AssignedTo: commons-dev@jakarta.apache.org
        ReportedBy: pjack@sfaf.org


An optimizing compiler or a processor pipeline can reorder the operations that 
clone the internal collection and reassign the reference to the clone.  A 
thread invoking a read operation can conceivably fetch a reference to a non-
fully-cloned collection, resulting in arbitrary behavior.  

There seems to be no way to actually fix this bug, given the current Java 
Memory Model.  The code does seem to work on architectures that supply their 
own more strict memory models, such as single-processor 386 systems.

At minimum, the documentation for these classes should be updated to indicate 
that they are not cross-platform.  

The Java Memory Model is currently under revision, and some future version of 
Java will allow these classes to work by making the internal collection 
reference volatile.  (In the future, the volatile keyword will have better 
semantics; a write to any volatile field by a thread will force a write of ALL 
modifications made by that thread).

References:

http://www.cs.umd.edu/~pugh/java/memoryModel/DoubleCheckedLocking.html
http://www.javaworld.com/javaworld/jw-02-2001/jw-0209-double.html
http://www.javaworld.com/javaworld/jw-05-2001/jw-0525-double.html

(These all deal with the double-checked locking algorithm, but the concepts 
apply to these classes as well.  Do a google search for "Bill Pugh" for more in-
depth information).

--
To unsubscribe, e-mail:   <mailto:commons-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:commons-dev-help@jakarta.apache.org>


Mime
View raw message