Name: nt126004 Date: 02/24/2003
FULL PRODUCT VERSION :
java version "1.4.1_01"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1_01-b01)
Java HotSpot(TM) Client VM (build 1.4.1_01-b01, mixed mode)
FULL OPERATING SYSTEM VERSION :
SunOS pantar 5.7 Generic_106541-17 sun4u sparc SUNW,Ultra-4
EXTRA RELEVANT SYSTEM CONFIGURATION :
System has 4 CPUs.
A DESCRIPTION OF THE PROBLEM :
The length() method of java.io.RandomAccessFile temporarily
changes the file pointer. If it is called in one thread,
another thread that does a read() or write() can do so at
the wrong offset. Conversely, a seek() in another thread
can be lost due to a simultaneous call to length().
This should either be clearly documented in the API
specification (requiring users to synchronize calls to
length() with those to other file methods) or fixed using
some kind of internal lock.
This bug can be reproduced occasionally.
CUSTOMER WORKAROUND :
synchronize all calls to relevant methods on some object,
e.g. the RandomAccessFile instance itself.
(Review ID: 181612)