[ 
https://issues.apache.org/jira/browse/THRIFT-3226?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Paweł Janicki updated THRIFT-3226:
----------------------------------
    Description: 
TNamedPipeServer can trap itself in infinite loop if the client closed Pipe 
before server instantiated TPipe object in NamedPipeServer::acceptImpl().

The accept loop waits for connected client on GetOverlappedResult(Pipe_.h , ..) 
then wraps the connected pipe client hande into TPipe object, opens another 
pipe handle to wait for next client and returns the newly created pipe wrapper 
object.

TPipe object may throw on c-tor if the pipe in meantime has been closed by the 
client. If so the new pipe instance for next client will NOT be created as the 
implementation expects. The accept is called with no inital valid pipe handle 
what causes it to throw and restart accept. It happens then forever.

I propose to solve the issue by handling the case when TPipe throws: The failed 
handle should be dropped and new pipe created and wait for next client repeated 
within acceptImpl


  was:
TNamedPipeServer can trap itself in infinite loop if the client closed Pipe 
before server instantiated TPipe object in NamedPipeServer::acceptImpl().

The accept loop waits for connected client on GetOverlappedResult(Pipe_.h , ..) 
then wraps the connected pipe client hande into TPipe object, opens another 
pipe handle to wait for next client nd returns the newly created pipe object.

TPipe object may throw on c-tor. If so the new pipe instance for next client 
will not be created. If accept is called with no inital valid pipe handle it 
throws and restarts. It happens then forever with no possiblity to interrupt.

To solve the issue, the case when TPipe throws should be handled. The failed 
connection should be dropped and new pipe created and wait for next client 
repeated.



> Fix TNamedPipeServer trapped in loop on accept
> ----------------------------------------------
>
>                 Key: THRIFT-3226
>                 URL: https://issues.apache.org/jira/browse/THRIFT-3226
>             Project: Thrift
>          Issue Type: Bug
>            Reporter: Paweł Janicki
>            Priority: Critical
>              Labels: patch
>
> TNamedPipeServer can trap itself in infinite loop if the client closed Pipe 
> before server instantiated TPipe object in NamedPipeServer::acceptImpl().
> The accept loop waits for connected client on GetOverlappedResult(Pipe_.h , 
> ..) then wraps the connected pipe client hande into TPipe object, opens 
> another pipe handle to wait for next client and returns the newly created 
> pipe wrapper object.
> TPipe object may throw on c-tor if the pipe in meantime has been closed by 
> the client. If so the new pipe instance for next client will NOT be created 
> as the implementation expects. The accept is called with no inital valid pipe 
> handle what causes it to throw and restart accept. It happens then forever.
> I propose to solve the issue by handling the case when TPipe throws: The 
> failed handle should be dropped and new pipe created and wait for next client 
> repeated within acceptImpl



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to