Uploaded image for project: 'Cassandra'
  1. Cassandra
  2. CASSANDRA-4111

Serializing cache can cause Segfault in 1.1

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Normal
    • Resolution: Fixed
    • Fix Version/s: 1.1.0
    • Component/s: None
    • Labels:
      None
    • Severity:
      Normal

      Description

      Rare but this can happen per sure, looks like this issue is after CASSANDRA-3862 hence affectes only 1.1

      FreeableMemory old = map.get(key);
      if (old == null)
      return false;

      // see if the old value matches the one we want to replace
      FreeableMemory mem = serialize(value);
      if (mem == null)
      return false; // out of memory. never mind.
      V oldValue = deserialize(old);
      boolean success = oldValue.equals(oldToReplace) && map.replace(key, old, mem);

      if (success)
      old.unreference();
      else
      mem.unreference();
      return success;

      in the above code block we deserialize(old) without taking reference to the old memory, this can case seg faults when the old is reclaimed (free is called)
      Fix is to get the reference just for deserialization

      V oldValue;
      // reference old guy before de-serializing
      old.reference();
      try

      { oldValue = deserialize(old); }

      finally

      { old.unreference(); }

        Attachments

        1. 0001-CASSANDRA-4111.patch
          1 kB
          Vijay
        2. 0001-CASSANDRA-4111-v2.patch
          1 kB
          Vijay

          Activity

            People

            • Assignee:
              vijay2win@yahoo.com Vijay
              Reporter:
              vijay2win@yahoo.com Vijay
              Authors:
              Vijay
              Reviewers:
              Jonathan Ellis
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: