• Bug
  • Status: Closed
  • 3 Minor
  • Resolution: Fixed
  • Lock Manager
  • hhuynh
  • Reporter: stulscot
  • June 05, 2008
  • 0
  • Watchers: 1
  • August 04, 2008
  • July 18, 2008



If the write lock of a ReentrantReadWriteLock is held then the read lock taken and a shared object modified a ReadOnlyException will be thrown even though the write lock is held (see attached example ThrowReadOnlyException.java).

This is also the case if the write lock and read locks of different ReentrantReadWriteLocks are held (see forum post http://forums.terracotta.org/forums/posts/list/1124.page#6770).

It appears that when checking if a shared object is writable only the very last lock taken counts.

The simple work around is to make sure the write lock is the last lock taken before modifying the shared object.


Fiona OShea 2008-06-05

If this is low hanging fruit fix, then fix for 2.7

Geert Bevin 2008-07-16

I committed a fix in revision 9244. I’d appreciate a code review on this.