Buggy code:
public class CassandraDaemon extends AbstractCassandraDaemon { private static Logger logger = LoggerFactory . getLogger ( CassandraDaemon . class ) ; private TServer serverEngine ; protected void setup ( ) throws IOException { int listenPort = DatabaseDescriptor . getRpcPort ( ) ; InetAddress listenAddr = DatabaseDescriptor . getRpcAddress ( ) ; if ( listenAddr == null ) listenAddr = FBUtilities . getLocalAddress ( ) ; Thread . setDefaultUncaughtExceptionHandler ( new Thread . UncaughtExceptionHandler ( ) { public void uncaughtException ( Thread t , Throwable e ) { CassandraDaemon . logger . error ( ( "Uncaught<seq2seq4repair_space>exception<seq2seq4repair_space>in<seq2seq4repair_space>thread<seq2seq4repair_space>" + t ) , e ) ; if ( e instanceof OutOfMemoryError ) { System . exit ( 100 ) ; } } } ) ; try { SystemTable . checkHealth ( ) ; } catch ( ConfigurationException e ) { CassandraDaemon . logger . error ( "Fatal<seq2seq4repair_space>exception<seq2seq4repair_space>during<seq2seq4repair_space>initialization" , e ) ; System . exit ( 100 ) ; } try { DatabaseDescriptor . loadSchemas ( ) ; } catch ( IOException e ) { CassandraDaemon . logger . error ( "Fatal<seq2seq4repair_space>exception<seq2seq4repair_space>during<seq2seq4repair_space>initialization" , e ) ; System . exit ( 100 ) ; } for ( String table : DatabaseDescriptor . getTables ( ) ) { if ( CassandraDaemon . logger . isDebugEnabled ( ) ) CassandraDaemon . logger . debug ( ( "opening<seq2seq4repair_space>keyspace<seq2seq4repair_space>" + table ) ) ; Table . open ( table ) ; } CommitLog . recover ( ) ; instance . checkAllColumnFamilies ( ) ; UUID currentMigration = DatabaseDescriptor . getDefsVersion ( ) ; UUID lastMigration = Migration . getLastMigrationId ( ) ; if ( ( lastMigration != null ) && ( ( lastMigration . timestamp ( ) ) > ( currentMigration . timestamp ( ) ) ) ) { MigrationManager . applyMigrations ( currentMigration , lastMigration ) ; } StorageService . instance . initServer ( ) ; final CassandraServer cassandraServer = new CassandraServer ( ) ; Cassandra . Processor processor = new Cassandra . Processor ( cassandraServer ) ; TServerSocket tServerSocket = null ; try { tServerSocket = new TServerSocket ( new InetSocketAddress ( listenAddr , listenPort ) ) ; } catch ( TTransportException e ) { throw new IOException ( String . format ( "Unable<seq2seq4repair_space>to<seq2seq4repair_space>create<seq2seq4repair_space>thrift<seq2seq4repair_space>socket<seq2seq4repair_space>to<seq2seq4repair_space>%s:%s" , listenAddr , listenPort ) , e ) ; } CassandraDaemon . logger . info ( String . format ( "Binding<seq2seq4repair_space>thrift<seq2seq4repair_space>service<seq2seq4repair_space>to<seq2seq4repair_space>%s:%s" , listenAddr , listenPort ) ) ; TProtocolFactory tProtocolFactory = new org . apache . thrift . protocol . TBinaryProtocol . Factory ( true , true , DatabaseDescriptor . getThriftMaxMessageLength ( ) ) ; TTransportFactory inTransportFactory ; TTransportFactory outTransportFactory ; if ( DatabaseDescriptor . isThriftFramed ( ) ) { int tFramedTransportSize = DatabaseDescriptor . getThriftFramedTransportSize ( ) ; inTransportFactory = new TFramedTransport . Factory ( tFramedTransportSize ) ; outTransportFactory = new TFramedTransport . Factory ( tFramedTransportSize ) ; CassandraDaemon . logger . info ( "Using<seq2seq4repair_space>TFramedTransport<seq2seq4repair_space>with<seq2seq4repair_space>a<seq2seq4repair_space>max<seq2seq4repair_space>frame<seq2seq4repair_space>size<seq2seq4repair_space>of<seq2seq4repair_space>{}<seq2seq4repair_space>bytes." , tFramedTransportSize ) ; } else { inTransportFactory = new TTransportFactory ( ) ; outTransportFactory = new TTransportFactory ( ) ; } CustomTThreadPoolServer . Options options = new CustomTThreadPoolServer . Options ( ) ; options . minWorkerThreads = 64 ; SynchronousQueue < Runnable > executorQueue = new SynchronousQueue < Runnable > ( ) ; ExecutorService executorService = new ThreadPoolExecutor ( options . minWorkerThreads , options . maxWorkerThreads , 60 , TimeUnit . SECONDS , executorQueue ) { @ Override protected void afterExecute ( Runnable r , Throwable t ) { super . afterExecute ( r , t ) ; <START_BUG> cassandraServer . clientState . logout ( ) ; <END_BUG> } } ; serverEngine = new CustomTThreadPoolServer ( new org . apache . thrift . TProcessorFactory ( processor ) , tServerSocket , inTransportFactory , outTransportFactory , tProtocolFactory , tProtocolFactory , options , executorService ) ; } public void start ( ) { } public void stop ( ) { } public static void main ( String [ ] args ) { } }

Fix:
cassandraServer . logout ( ) ;