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

Alexey Sviridov commented on THRIFT-1523:
-----------------------------------------

After a little explain i'm found method {{createServer(SSLServerSocketFactory 
factory, int port, int timeout,...}} that creates TServerSocket by {{return new 
TServerSocket(serverSocket);}} 

this method used timeout parameter with wrong way - by setting 
{{serverSocket.setSoTimeout(timeout);}} but this is no matter because this 
timeout setted on server socket and affect only accept() method, and not used 
for read timeout as desired (btw, later in methos listen() even serverSocket 
soTimeout setted to 0). For properly handle clientTimeout we need call 
setSoTimeout on client socket, after we accepted them. This done in method 
acceptImpl(), but there used internal field clientTimeout_ stored in  constucot 
of TServerSocket!!! ({{result2.setTimeout(clientTimeout_);}} ) but, as i'm 
mentioned before, in createServer TServerSocket created by {{new 
TServerSocket(serverSocket);}} This called constructor 
{{TServerSocket(serverSocket,0)}} and set internal field clientTimeout_ to 0, 
what mean wait infinite!

so we only need replace line 
  
  {{return new TServerSocket(serverSocket);}} 
by 
  {{return new TServerSocket(serverSocket,timeout);}} in 
TSSLTransportFactory.createServer method


                
> clientTimeout not worked as expected in TServerSocket created by 
> TSSLTransportFactory
> -------------------------------------------------------------------------------------
>
>                 Key: THRIFT-1523
>                 URL: https://issues.apache.org/jira/browse/THRIFT-1523
>             Project: Thrift
>          Issue Type: Bug
>          Components: Java - Library
>    Affects Versions: 0.6.1, 0.7, 0.8, 0.9
>            Reporter: Alexey Sviridov
>            Priority: Blocker
>
> TSSLTransportFactory has method 
>    public static TServerSocket getServerSocket(int port, int clientTimeout) 
> there is parameter clientTimeout that need to close idle client connections 
> (after clientTimeout amount of millis of client inactivity server closes 
> opened connection themself, not waiting while client called close() method). 
> This parameter work fine when create TServerSocket through new, but not 
> working at all when creating TServerSocket through 
> TSSLTransportFactory.getServerSocket

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to