[ 
https://issues.apache.org/jira/browse/CASSANDRA-1057?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12865016#action_12865016
 ] 

Kenny commented on CASSANDRA-1057:
----------------------------------

One solution would be to create your own TThreadPoolServer so you can replace 
the ExecutorService with one that overrides the afterExecute() method and 
clears out the ThreadLocal data.

I'm trying to figure out the best way to accomplish this, but TThreadPoolServer 
is all private, so the only way to replace the ExecutorService is to copy/paste 
it, or use reflection.

If you create the ExecutorService in the CassandraDaemon and pass it into the 
new TThreadPoolServer you'll have access to the CassandraServer to call the 
logout() method on it (once you write the simple logout to clean the 
ThreadLocal data).

If I find a good solution I'll post a patch. How against using reflection are 
you?

> Login information stored in threads may be reused.
> --------------------------------------------------
>
>                 Key: CASSANDRA-1057
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-1057
>             Project: Cassandra
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 0.6
>            Reporter: Kenny
>            Priority: Minor
>             Fix For: 0.6.2
>
>
> CassandraServer stores the login information in a ThreadLocal<AccessLevel>.
> CassandraDaemon starts the server with 64 threads. When the first 64 clients 
> connect they should get their own thread, but after that threads will be 
> reused.
> In a quick test I created a Server with 5 threads, and a 
> ThreadLocal<Integer>, and the value is seen by new clients connecting.
> Thrift doesn't destroy the threads when a client disconnects. Maybe an option 
> in Thrift would make more sense to make this method usable.

-- 
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