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

Expiration in OutboundTcpConnection can block the reader Thread

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Normal
    • Resolution: Fixed
    • Fix Version/s: 3.0.14, 3.11.0, 4.0, 4.0-alpha1
    • Component/s: Messaging/Internode
    • Labels:
      None
    • Environment:

      Cassandra 3.0.9
      Java HotSpot(TM) 64-Bit Server VM version 25.112-b15 (Java version 1.8.0_112-b15)
      Linux 3.16

    • Bug Category:
      Availability - Unavailable
    • Severity:
      Normal

      Description

      I observed that sometimes a single node in a Cassandra cluster fails to communicate to the other nodes. This can happen at any time, during peak load or low load. Restarting that single node from the cluster fixes the issue.

      Before going in to details, I want to state that I have analyzed the situation and am already developing a possible fix. Here is the analysis so far:

      • A Threaddump in this situation showed 324 Threads in the OutboundTcpConnection class that want to lock the backlog queue for doing expiration.
      • A class histogram shows 262508 instances of OutboundTcpConnection$QueuedMessage.

      What is the effect of it? As soon as the Cassandra node has reached a certain amount of queued messages, it starts thrashing itself to death. Each of the Thread fully locks the Queue for reading and writing by calling iterator.next(), making the situation worse and worse.

      • Writing: Only after 262508 locking operation it can progress with actually writing to the Queue.
      • Reading: Is also blocked, as 324 Threads try to do iterator.next(), and fully lock the Queue

      This means: Writing blocks the Queue for reading, and readers might even be starved which makes the situation even worse.


      The setup is:

      • 3-node cluster
      • replication factor 2
      • Consistency LOCAL_ONE
      • No remote DC's
      • high write throughput (100000 INSERT statements per second and more during peak times).

        Attachments

        1. cassandra.pb-cache4-dus.2017-02-17-19-36-26.chist.xz
          28 kB
          Christian Esken
        2. cassandra.pb-cache4-dus.2017-02-17-19-36-26.td.xz
          13 kB
          Christian Esken
        3. cassandra-13265-2.2-dtest_stdout.txt
          27 kB
          Ariel Weisberg
        4. cassandra-13265-trun-dtest_stdout.txt
          106 kB
          Ariel Weisberg

          Issue Links

            Activity

              People

              • Assignee:
                cesken Christian Esken
                Reporter:
                cesken Christian Esken
                Authors:
                Christian Esken
                Reviewers:
                Ariel Weisberg
              • Votes:
                0 Vote for this issue
                Watchers:
                9 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: