• Bug
  • Status: Closed
  • 0 Showstopper
  • Resolution: Fixed
  • cdennis
  • Reporter: mantree
  • October 15, 2010
  • 0
  • Watchers: 4
  • March 24, 2011
  • December 15, 2010

Description

Raised following forum discussion: http://forums.terracotta.org/forums/posts/list/4333.page.

As mentioned appears that the queue allows taking threads to decrement the count between an offering thread adding to the queue and incrementing the count. This leads to the offering thread getting a -1 value, returning false and thereby an IllegalStateException is thrown by the AbstractQueue.add method.

Comments

Tim Eck 2010-10-18

Unless I’m mistaken I think you said you wanted a crack at this

Tom Coupland 2010-10-21

Bug comes down to the consumer node calling back to the producer to the __tc_take method, which reduces the count before the producer increments it.

Which actually would’nt be a problem, except the offer method is using ‘c’ as both a handle on the number of items in the queue and to signify whether the queue is full. That ‘and’ is the problem here IMO.

I would add a seperate variable to handle that concept (boolean queued = false @ 215), setting it to true after the item has been added (224) and have that returned instead of the test on c.

Fiona OShea 2010-12-10

P0 as expected for Beta2

Chris Dennis 2010-12-15

Resolved by moving the getAndIncrement/Decrement to be within the same transaction scope as the logicalInvoke, this means that the local node modifies it’s count due to the running operation before notifying remote threads that the opposite operation might be possible.