Uploaded image for project: 'Samza'
  1. Samza
  2. SAMZA-1370

Memory leak in CachedStore when using ByteBufferSerde as key serde

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 0.13.1
    • Component/s: None
    • Labels:
      None

      Description

      ByteBufferSerde uses relative bulk get to serialize the provided ByteBuffer which changes its internal position. ByteBuffer's `equals` and `hashCode` depend upon its remaining elements, i.e. on its position. This means that when using ByteBuffers as keys in the CachedStore, flushing cache contents to the underlying store changes their hashCode. Since the hashCode for the key no longer matches the one used when inserting it into the map, the LinkedHashMap cannot correctly evict or remove these entries, leading to a memory leak.

      Changing ByteBufferSerde to use absolute get operations or duplicate the provided ByteBuffer before copying should fix this issue.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                pmaheshwari Prateek Maheshwari
                Reporter:
                pmaheshwari Prateek Maheshwari
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: