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

BufferUnderflowException when writing a null value to a UDT field

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Normal
    • Resolution: Cannot Reproduce
    • None
    • None
    • None
    • Ubuntu 14.04. Cassandra 2.1.0. Single node.

    • Normal

    Description

      The schema that was being used when this error was produced is attached.

      Whenever I write a null value to any of the id, name, or description fields for a LOAD_BALANCER_POOL udt in the pools set of the LOAD_BALANCER_SERVICE table or to the name, enabled, description, or ip_addresses fields of the LOAD_BALANCER_VIRTUAL_SERVER table in the virtual_servers set of the LOAD_BALANCER_SERVICE table, I get the following error from cqlsh:

      <ErrorMessage code=0000 [Server error] message="java.nio.BufferUnderflowException">
      

      When doing the same from the Java Datastax driver, this seems to succeed on the first write but fail with a timeout exception on all subsequent writes until either the table is truncated or both the pools and virtual_servers collections are both written as empty sets.

      Having null values in other UDT fields in the hierarchy doesn't seem to cause any issues.

      When I restart Cassandra after having these errors, Cassandra fails to start and throws the following error when trying to replay the commit logs:

      ERROR [main] 2014-09-30 13:43:04,183 CassandraDaemon.java:474 - Exception encountered during startup
      java.lang.RuntimeException: java.util.concurrent.ExecutionException: java.nio.BufferUnderflowException
              at org.apache.cassandra.utils.FBUtilities.waitOnFuture(FBUtilities.java:411) ~[apache-cassandra-2.1.0.jar:2.1.0]
              at org.apache.cassandra.utils.FBUtilities.waitOnFutures(FBUtilities.java:400) ~[apache-cassandra-2.1.0.jar:2.1.0]
              at org.apache.cassandra.db.commitlog.CommitLogReplayer.recover(CommitLogReplayer.java:426) ~[apache-cassandra-2.1.0.jar:2.1.0]
              at org.apache.cassandra.db.commitlog.CommitLogReplayer.recover(CommitLogReplayer.java:95) ~[apache-cassandra-2.1.0.jar:2.1.0]
              at org.apache.cassandra.db.commitlog.CommitLog.recover(CommitLog.java:137) ~[apache-cassandra-2.1.0.jar:2.1.0]
              at org.apache.cassandra.db.commitlog.CommitLog.recover(CommitLog.java:117) ~[apache-cassandra-2.1.0.jar:2.1.0]
              at org.apache.cassandra.service.CassandraDaemon.setup(CassandraDaemon.java:296) [apache-cassandra-2.1.0.jar:2.1.0]
              at org.apache.cassandra.service.CassandraDaemon.activate(CassandraDaemon.java:457) [apache-cassandra-2.1.0.jar:2.1.0]
              at org.apache.cassandra.service.CassandraDaemon.main(CassandraDaemon.java:546) [apache-cassandra-2.1.0.jar:2.1.0]
      Caused by: java.util.concurrent.ExecutionException: java.nio.BufferUnderflowException
              at org.apache.cassandra.concurrent.AbstractTracingAwareExecutorService$FutureTask.get(AbstractTracingAwareExecutorService.java:198) ~[apache-cassandra-2.1.0.jar:2.1.0]
              at org.apache.cassandra.utils.FBUtilities.waitOnFuture(FBUtilities.java:407) ~[apache-cassandra-2.1.0.jar:2.1.0]
              ... 8 common frames omitted
      Caused by: java.nio.BufferUnderflowException: null
              at java.nio.Buffer.nextGetIndex(Buffer.java:506) ~[na:1.8.0_20]
              at java.nio.HeapByteBuffer.getInt(HeapByteBuffer.java:361) ~[na:1.8.0_20]
              at org.apache.cassandra.serializers.CollectionSerializer.readCollectionSize(CollectionSerializer.java:85) ~[apache-cassandra-2.1.0.jar:2.1.0]
              at org.apache.cassandra.db.marshal.ListType.compareListOrSet(ListType.java:96) ~[apache-cassandra-2.1.0.jar:2.1.0]
              at org.apache.cassandra.db.marshal.SetType.compare(SetType.java:77) ~[apache-cassandra-2.1.0.jar:2.1.0]
              at org.apache.cassandra.db.marshal.SetType.compare(SetType.java:29) ~[apache-cassandra-2.1.0.jar:2.1.0]
              at org.apache.cassandra.db.marshal.TupleType.compare(TupleType.java:95) ~[apache-cassandra-2.1.0.jar:2.1.0]
              at org.apache.cassandra.db.marshal.TupleType.compare(TupleType.java:38) ~[apache-cassandra-2.1.0.jar:2.1.0]
              at org.apache.cassandra.db.marshal.ColumnToCollectionType.compareCollectionMembers(ColumnToCollectionType.java:74) ~[apache-cassandra-2.1.0.jar:2.1.0]
              at org.apache.cassandra.db.composites.CompoundSparseCellNameType$WithCollection.compare(CompoundSparseCellNameType.java:292) ~[apache-cassandra-2.1.0.jar:2.1.0]
              at org.apache.cassandra.db.composites.AbstractCellNameType$1.compare(AbstractCellNameType.java:60) ~[apache-cassandra-2.1.0.jar:2.1.0]
              at org.apache.cassandra.db.composites.AbstractCellNameType$1.compare(AbstractCellNameType.java:57) ~[apache-cassandra-2.1.0.jar:2.1.0]
              at org.apache.cassandra.utils.btree.NodeBuilder.update(NodeBuilder.java:148) ~[apache-cassandra-2.1.0.jar:2.1.0]
              at org.apache.cassandra.utils.btree.Builder.update(Builder.java:74) ~[apache-cassandra-2.1.0.jar:2.1.0]
              at org.apache.cassandra.utils.btree.BTree.update(BTree.java:186) ~[apache-cassandra-2.1.0.jar:2.1.0]
              at org.apache.cassandra.db.AtomicBTreeColumns.addAllWithSizeDelta(AtomicBTreeColumns.java:189) ~[apache-cassandra-2.1.0.jar:2.1.0]
              at org.apache.cassandra.db.Memtable.put(Memtable.java:194) ~[apache-cassandra-2.1.0.jar:2.1.0]
              at org.apache.cassandra.db.ColumnFamilyStore.apply(ColumnFamilyStore.java:1142) ~[apache-cassandra-2.1.0.jar:2.1.0]
              at org.apache.cassandra.db.Keyspace.apply(Keyspace.java:394) ~[apache-cassandra-2.1.0.jar:2.1.0]
              at org.apache.cassandra.db.Keyspace.apply(Keyspace.java:351) ~[apache-cassandra-2.1.0.jar:2.1.0]
              at org.apache.cassandra.db.commitlog.CommitLogReplayer$1.runMayThrow(CommitLogReplayer.java:418) ~[apache-cassandra-2.1.0.jar:2.1.0]
              at org.apache.cassandra.utils.WrappedRunnable.run(WrappedRunnable.java:28) ~[apache-cassandra-2.1.0.jar:2.1.0]
              at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) ~[na:1.8.0_20]
              at org.apache.cassandra.concurrent.AbstractTracingAwareExecutorService$FutureTask.run(AbstractTracingAwareExecutorService.java:163) ~[apache-cassandra-2.1.0.jar:2.1.0]
              at org.apache.cassandra.concurrent.SEPWorker.run(SEPWorker.java:103) ~[apache-cassandra-2.1.0.jar:2.1.0]
              at java.lang.Thread.run(Thread.java:745) ~[na:1.8.0_20]
      

      I'm not sure if null values are supposed to be acceptable for UDT fields, but in any case, it would be nice to handle these errors more gracefully.

      Attachments

        1. schema.txt
          1 kB
          Cory Snyder

        Activity

          People

            Unassigned Unassigned
            cfsnyder Cory Snyder
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: