Uploaded image for project: 'OFBiz'
  1. OFBiz
  2. OFBIZ-5534

Dirty reads from entity cache



    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • Release Branch 11.04, Release Branch 12.04, Release Branch 13.07, Trunk, Upcoming Branch
    • None
    • framework
    • None
    • Bug Crush Event - 21/2/2015


      Even if database transaction isolation level is set to "ReadCommitted", a transaction can get uncommitted records from the entity cache, under certain circumstances.
      Here is a test case:
      1) transaction T1 creates a record
      2) T1 calls findOne to retrieve it: the read will be successful (because T1 can read data generated in T1 even if not committed) and the record will be added to the cache
      3) T1 calls another service with requireNewTransaction set to true: this will run the second service in a new transaction T2
      4) T2 calls findOne to retrieve the record created by T1: if useCache is set to false it should fail; if useCache is set to true it will succeed (getting the record from cache, even if the data is not committed to the db)

      The result in #4 is wrong because T2 should not see the uncommitted record
      We should never add uncommitted records to the entity cache.


        1. unittest-dirtyreadsfromcache.patch
          5 kB
          Jacopo Cappellato

        Issue Links



              doogie Adam Heath
              jacopoc Jacopo Cappellato
              0 Vote for this issue
              6 Start watching this issue