[ 
https://issues.apache.org/jira/browse/THRIFT-2046?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13878155#comment-13878155
 ] 

Todd Lipcon commented on THRIFT-2046:
-------------------------------------

A few comments on the patch:
- The requestTimeout argument should have a name which includes its unit. Given 
that most times in Java are specified in seconds, it was surprising to see that 
this one is actually in seconds. It might make more sense to specify it in 
seconds, and have the sleep loop do an exponential backoff or something on its 
sleeps. (as it stands today a momentary spike in connections can cause a 1 
second long "bubble" in accepting new ones, even if the old ones go away)
- Could you solve this in a more efficient way (i.e not spinning) by making an 
executor that blocks on submission if the queue is full? I think you could do 
this by making a BlockingQueue implementation which wraps another one, and make 
its 'offer' method delegate to 'wrapped.offer(elem, timeoutMillis, 
TimeUnit.MILLISECONDS)'. Then you wouldn't have this somewhat ugly spin-loop in 
the first place
- Setting {{wp.skipRun}} and then calling {{run()}} seems pretty inelegant. Why 
not just call client.close(), since you're just trying to drop the connection 
anyway? I'd think that doing the whole "skipRun" thing may end up causing a 
needless SASL negotiation for a connection you just plan on dropping, for 
example.

> The worktask can be timed out in TThreadPoolServer (Java) when the max# 
> thrift thread is reached
> ------------------------------------------------------------------------------------------------
>
>                 Key: THRIFT-2046
>                 URL: https://issues.apache.org/jira/browse/THRIFT-2046
>             Project: Thrift
>          Issue Type: Improvement
>          Components: Java - Library
>    Affects Versions: 0.9
>            Reporter: Chaoyu Tang
>         Attachments: THRIFT-2046.patch, THRIFT-2046_1.patch
>
>
> Once the max# of thrift threads is reached, a new task (workprocess) is 
> attempted to be executed in an infinite loop, then the client may hang.
> An improvement is to introduce a task timeout. after a certain time, if the 
> task is still not got queued to be executed. It will be invalidated.



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)

Reply via email to