Uploaded image for project: 'Commons JCS'
  1. Commons JCS
  2. JCS-74

Some data may be lost when adding/removing entries with the same key

    XMLWordPrintableJSON

Details

    Description

      I see this problem in jcs-1.3.3.5-RC.jar.

      When adding/removing data to IndexedDiskCache some data may be lost.

      Consider the following sample:

      cache.put("key", "value1");
      cache.put("key", "value2");
      cache.put("key", "value3");

      After running this code the cache often stores only "value1", other values may be lost. It looks like this is caused by asynchronous cache update mechanism, adding some pause (say Thread.sleep(100)) between different puts fixes the problem.

      Also (it may be another bug actually) it could happen that the following code will not write any data to the cache:

      cache.put("key", "value1");
      cache.remove("key");
      cache.put("key", "value2");

      This happens non-deterministically on my machine, in case of problems with reproducing this try put some other data before this test to make the queue longer.

      Attachments

        Issue Links

          Activity

            People

              asmuts Aaron Smuts
              asofronov Alexander Sofronov
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: