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

Eric Bléher commented on THRIFT-5172:
-------------------------------------

Looking further in some TTransport implementations, the Open implementation 
prevents to be called twice:

if (IsOpen)          \{               throw new 
TTransportException(TTransportException.ExceptionType.AlreadyOpen, "Socket 
already connected");           }

so the wrong code in TBaseClient should come here, and is probably not related 
to the OutOfMemory Exception I got.

But anyway, the proposed pull request is still valid, even if without 
consequences.

> NetStd OutOfMemoryException
> ---------------------------
>
>                 Key: THRIFT-5172
>                 URL: https://issues.apache.org/jira/browse/THRIFT-5172
>             Project: Thrift
>          Issue Type: Bug
>          Components: netstd - Library
>    Affects Versions: 0.13.0
>            Reporter: Eric Bléher
>            Priority: Major
>              Labels: patch
>   Original Estimate: 5m
>  Remaining Estimate: 5m
>
> When I have some network issues to connect to my Thrift server, it tries many 
> attempts to connect to it. After a while, I get a "OutOfMemory" Exception.
> I read that it may be related to too many sockets opened.
> Looking quickly at the code in .NET Standard:
> TBaseClient
> public virtual async Task OpenTransportAsync(CancellationToken 
> cancellationToken)
>  {
>  if (!_inputProtocol.Transport.IsOpen)
> { await _inputProtocol.Transport.OpenAsync(cancellationToken); }
> if (!*_inputProtocol*.Transport.IsOpen)
> { await _outputProtocol.Transport.OpenAsync(cancellationToken); }
> }
>  
>  
> This last check seems a bad copy/paste and should probably be
> if (!*_outputProtocol*.Transport.IsOpen)
> Otherwise, we indeed get the transport on the output protocol getting opened 
> many times!
>  
> I just proposed a pull request with the fix.
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to