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

Header class not thread safe, but mutated by multiple threads

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Normal
    • Resolution: Fixed
    • 1.0.4
    • None
    • None
    • Normal

    Description

      With Cassandra 1.0.3 we are getting exceptions like,

      Fatal exception in thread Thread[WRITE-/xx.xx.xx.xx,5,main]java.util.ConcurrentModificationException
      at java.util.Hashtable$Enumerator.next(Unknown Source)
      at org.apache.cassandra.net.Header.serializedSize(Header.java:97)
      at org.apache.cassandra.net.OutboundTcpConnection.messageLength(OutboundTcpConnection.java:164)
      at org.apache.cassandra.net.OutboundTcpConnection.write(OutboundTcpConnection.java:154)
      at org.apache.cassandra.net.OutboundTcpConnection.writeConnected(OutboundTcpConnection.java:115)
      at org.apache.cassandra.net.OutboundTcpConnection.run(OutboundTcpConnection.java:94)

      and,

      ERROR [WRITE-/xx.xx.xx.xx] 2011-11-24 22:08:28,981 AbstractCassandraDaemon.java (line 133) Fatal exception in thread Thread[WRITE-/10.30.12.79,5,main]java.lang.NullPointerException
      at org.apache.cassandra.net.Header.serializedSize(Header.java:101)
      at org.apache.cassandra.net.OutboundTcpConnection.messageLength(OutboundTcpConnection.java:164)
      at org.apache.cassandra.net.OutboundTcpConnection.write(OutboundTcpConnection.java:154)
      at org.apache.cassandra.net.OutboundTcpConnection.writeConnected(OutboundTcpConnection.java:115)
      at org.apache.cassandra.net.OutboundTcpConnection.run(OutboundTcpConnection.java:94)

      It looks like Header is not thread safe, but the same header instance is modified concurrently while being sent to several threads in StorageProxy.sendMessages.

      This bug eventually causes the node to OOM, as it kills the OutboundTcpConnection thread, which means nothing is dequeing from queue.

      Attachments

        1. 3530-0.8.txt
          8 kB
          Jonathan Ellis
        2. 3530-v2.txt
          8 kB
          Jonathan Ellis
        3. CASSANDRA-3530.patch
          8 kB
          Sean Bridges

        Activity

          People

            jbellis Jonathan Ellis
            sgbridges Sean Bridges
            Jonathan Ellis
            Sylvain Lebresne
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: