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

ColumnFamilyRecordWriter fails to throw a write exception encountered after the user begins to close the writer

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Low
    • Resolution: Fixed
    • 0.7.7, 0.8.2
    • None
    • None
    • Low

    Description

      There appears to be a race condition in ColumnFamilyRecordWriter that can result in the loss of an exception. Here is how it can happen (W stands for the RangeClient's worker thread; U stands for the ColumnFamilyRecordWriter user's thread):

      1. W: RangeClient's run method catches an exception originating in the Thrift client/socket, but doesn't get a chance to set it on the lastException field before it the thread is preempted.
      2. U: The user calls close which calls stopNicely. Because the lastException field is null, stopNicely does not throw anything. close then joins on the worker thread.
      3. W: The RangeClient's run method sets the lastException field and exits.
      4. U: Although the thread in close is waiting for the worker thread to exit, it has already checked the lastException field so it doesn't detect the presence of the last exception. Instead, close returns without throwing anything.

      This race condition means that intermittently write failures will go undetected.

      Attachments

        1. CASSANDRA-2755.patch
          3 kB
          Michael Semb Wever
        2. 2755-v2.txt
          4 kB
          Jonathan Ellis

        Activity

          People

            mck Michael Semb Wever
            gregkatz Greg Katz
            Michael Semb Wever
            Jonathan Ellis
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: