Commons JCS
  1. Commons JCS
  2. JCS-1

Recylce bin can erroneously overwrite live data entries

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: jcs-1.2.7.9
    • Component/s: Indexed Disk Cache
    • Labels:
      None

      Description

      There is a bug in the SortedPreferrentialArray in which after the Recyclye bin has been filled, and a spot in the bin is requested that is larger than the largest element, the last element in the array is returned. If the last recycle bin spot is not actually the last element in the data file, the element after the recycle bin element will be partially overwritten with the new data. That element will no longer be valid, which will eventually cause the entire cache to be reset.

        Issue Links

          Activity

          Brian Crow created issue -
          Hide
          Brian Crow added a comment -

          The attached patch contains a fix of the bug as well as new test cases that will illustrate the problem in unpatched code.

          Show
          Brian Crow added a comment - The attached patch contains a fix of the bug as well as new test cases that will illustrate the problem in unpatched code.
          Brian Crow made changes -
          Field Original Value New Value
          Attachment recycleBin.patch [ 12336433 ]
          Peter Schwarz made changes -
          Link This issue blocks JCS-3 [ JCS-3 ]
          Aaron Smuts made changes -
          Assignee Scott Eade [ seade ] Aaron Smuts [ asmuts ]
          Aaron Smuts made changes -
          Component/s Indexed Disk Cache [ 12311318 ]
          Aaron Smuts made changes -
          Status Open [ 1 ] In Progress [ 3 ]
          Hide
          Aaron Smuts added a comment -

          I could use the test but not the patch.

          The patch broke a sorted pref unit test. The problem is that the find larger or equal method must return the last element if what you are looking for is bigger than everything in the array. This method is used by the insert. If I'm inserting something bigger than everything in the array, then this method will return the last spot if the array is full.

          The bug was in the take larger method. It was not verifying that the element was actually larger. I'm changing the name of the find method to make it more explicit.

          The test for the disk cache now passes.

          The fix will be in 1.2.7.9

          Show
          Aaron Smuts added a comment - I could use the test but not the patch. The patch broke a sorted pref unit test. The problem is that the find larger or equal method must return the last element if what you are looking for is bigger than everything in the array. This method is used by the insert. If I'm inserting something bigger than everything in the array, then this method will return the last spot if the array is full. The bug was in the take larger method. It was not verifying that the element was actually larger. I'm changing the name of the find method to make it more explicit. The test for the disk cache now passes. The fix will be in 1.2.7.9
          Hide
          Aaron Smuts added a comment -

          I added a check in the take method to make sure that the element is smaller.

          Show
          Aaron Smuts added a comment - I added a check in the take method to make sure that the element is smaller.
          Aaron Smuts made changes -
          Status In Progress [ 3 ] Resolved [ 5 ]
          Resolution Fixed [ 1 ]
          Hide
          Aaron Smuts added a comment -

          The fix is in 1.2.7.9

          Show
          Aaron Smuts added a comment - The fix is in 1.2.7.9
          Aaron Smuts made changes -
          Status Resolved [ 5 ] Closed [ 6 ]
          Aaron Smuts made changes -
          Resolution Fixed [ 1 ]
          Status Closed [ 6 ] Reopened [ 4 ]
          Aaron Smuts made changes -
          Fix Version/s jcs-1.2.7.9 [ 12312036 ]
          Aaron Smuts made changes -
          Status Reopened [ 4 ] Closed [ 6 ]
          Resolution Fixed [ 1 ]
          Gavin made changes -
          Link This issue blocks JCS-3 [ JCS-3 ]
          Gavin made changes -
          Link This issue is depended upon by JCS-3 [ JCS-3 ]

            People

            • Assignee:
              Aaron Smuts
              Reporter:
              Brian Crow
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development