Uploaded image for project: 'Infinispan'
  1. Infinispan
  2. ISPN-1345

Dirty reads may occurs on mutable objects

    XMLWordPrintable

Details

    • Bug
    • Resolution: Won't Do
    • Critical
    • 5.3.0.Final
    • 5.0.0.FINAL
    • Transactions
    • None

    Description

      In local mode, I create a cache like this:

      cacheManager = new DefaultCacheManager();
      cacheManager.getDefaultConfiguration().fluent().storeAsBinary().transaction().cacheStopTimeout(5000);
      final Configuration config = new Configuration().fluent().transactionManagerLookup(this.tmLookup).locking()
                      .isolationLevel(IsolationLevel.READ_COMMITED).build();
      this.cacheManager.defineConfiguration("Gruik", config);
      this.cache = this.cacheManager.getCache("Gruik");
      

      When retrieving data using cache.get(key) I find out that Infinispan returns the object instance actually stored in the cache datastore. This is OK when the inserted objects are immutable but fails to achieve isolation when using mutable objects.

      For instance on a simple Pojo with a get/setValue.

      Step Reader Writer
      1 Starts transaction  
      2 value = cache.get(KEY);  
      3 System.out.println(value.getValue()); Prints 42  
      4   Starts transaction
      5   value = cache.get(KEY); Same instance than step 2
      6   value.setValue(666); // Prepare update
      7 System.out.println(value.getValue()); Prints 666 !  
      8 value = cache.get(KEY); Same instance than step 2  
      9   cache.put(KEY,value);
      10   Commits transaction
      11 value = cache.get(KEY); Same instance than step 2  
      12 System.out.println(value.getValue()); Prints 666  
      13 Commits transaction  

      According to the READ_COMMITTED specification, the value printed on step 7 should be 42 as the change to 666 is not committed yet.

      Attachments

        Activity

          People

            manik_jira Manik Surtani (Inactive)
            gabuzo_jira Christophe Labouisse (Inactive)
            Votes:
            8 Vote for this issue
            Watchers:
            7 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: