Cassandra.Client/Thrift errors not cleaned up between executions
----------------------------------------------------------------

                 Key: CASSANDRA-1510
                 URL: https://issues.apache.org/jira/browse/CASSANDRA-1510
             Project: Cassandra
          Issue Type: Bug
          Components: API
    Affects Versions: 0.7 beta 1, 0.7 beta 2
            Reporter: Jesse McConnell
            Priority: Critical



It seems that if a Cassandra.Client returns with a certain type of error it is 
not being cleaned up enough to make another call using that same client 
instance.  In the example below you see a get slice call being made with a 
poorly formatted SliceRange and the errors are being caught and printed out.  A 
subsequent call on that client to do something like set_keyspace now returns 
with additional error information from that previous execution...and then ends 
with the 'Missing version in readMessageBegin' error that makes you think that 
the server/client are not in sync re: framed vs non-framed.

In pooling environments where that client might be cached and then back to be 
reused this can lead to a bit of a red herring chase to track down transport 
issues while its really a previous bogus call like described.

org.apache.thrift.protocol.TProtocolException: Required field 'finish' was not 
present! Struct: SliceRange(start:, finish:null, reversed:false, count:100)
        at org.apache.cassandra.thrift.SliceRange.validate(SliceRange.java:623)
        at org.apache.cassandra.thrift.SliceRange.write(SliceRange.java:552)
        at 
org.apache.cassandra.thrift.SlicePredicate.write(SlicePredicate.java:429)
        at 
org.apache.cassandra.thrift.Cassandra$get_slice_args.write(Cassandra.java:6603)
        at 
org.apache.cassandra.thrift.Cassandra$Client.send_get_slice(Cassandra.java:534)
        at 
org.apache.cassandra.thrift.Cassandra$Client.get_slice(Cassandra.java:522)
        ...
CassandraException: org.apache.thrift.protocol.TProtocolException: Required 
field 'finish' was not present! Struct: SliceRange(start:, finish:null, 
reversed:false, count:100)
        at 
com.foo.ThriftCassandraInterface.getColumnSlice(ThriftCassandraInterface.java:471)
        at 
com.foo.ThriftInterfaceTest.testBadBehaviour(ThriftInterfaceTest.java:73)
...
Caused by: org.apache.thrift.protocol.TProtocolException: Required field 
'finish' was not present! Struct: SliceRange(start:, finish:null, 
reversed:false, count:100)
        at org.apache.cassandra.thrift.SliceRange.validate(SliceRange.java:623)
        at org.apache.cassandra.thrift.SliceRange.write(SliceRange.java:552)
        at 
org.apache.cassandra.thrift.SlicePredicate.write(SlicePredicate.java:429)
        at 
org.apache.cassandra.thrift.Cassandra$get_slice_args.write(Cassandra.java:6603)
        at 
org.apache.cassandra.thrift.Cassandra$Client.send_get_slice(Cassandra.java:534)
        at 
org.apache.cassandra.thrift.Cassandra$Client.get_slice(Cassandra.java:522)
        at 
com.foo.ThriftCassandraInterface.getColumnSlice(ThriftCassandraInterface.java:416)
        ... 23 more
org.apache.thrift.TApplicationException: Required field 'reversed' was not 
found in serialized data! Struct: SliceRange(start:null, finish:null, 
reversed:false, count:100)
        at 
org.apache.thrift.TApplicationException.read(TApplicationException.java:108)
        at 
org.apache.cassandra.thrift.Cassandra$Client.recv_set_keyspace(Cassandra.java:454)
        at 
org.apache.cassandra.thrift.Cassandra$Client.set_keyspace(Cassandra.java:437)
        at 
com.foo.ThriftCassandraInterface.setKeyspace(ThriftCassandraInterface.java:975)
        at 
com.foo.ThriftInterfaceTest.testBadBehaviour(ThriftInterfaceTest.java:83)
        ...
53851 [pool-1-thread-3] ERROR 
org.apache.cassandra.thrift.CustomTThreadPoolServer - Thrift error occurred 
during processing of message.
org.apache.thrift.protocol.TProtocolException: Missing version in 
readMessageBegin, old client?
        at 
org.apache.thrift.protocol.TBinaryProtocol.readMessageBegin(TBinaryProtocol.java:211)
        at 
org.apache.cassandra.thrift.Cassandra$Processor.process(Cassandra.java:2634)
        at 
org.apache.cassandra.thrift.CustomTThreadPoolServer$WorkerProcess.run(CustomTThreadPoolServer.java:167)
        at 
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
        at 
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
        at java.lang.Thread.run(Thread.java:619)

Below is a bit of modified code from the testBadBehavior() test case being 
executed in the code above.

Cassandra.Client client = foo.gimmeClient();
                
ColumnParent parent = new ColumnParent();
parent.setColumn_family("Foo");
                
SlicePredicate predicate = new SlicePredicate();
SliceRange range = new SliceRange();
// NOTE: the range is not completely initialized, missing sets for finished and 
reverse which imo ought to be defaulted anyway 
range.setStart("".getBytes());
range.setCount(100);
predicate.setSlice_range(range);
                
try 
{
        Collection<ColumnOrSuperColumn> columns = 
client.get_column_slice("foo", parent, predicate);
}
catch (CassandraException e)
{
        e.printStackTrace();
}
                
client.set_keyspace("FooBar");

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to