[ https://issues.apache.org/jira/browse/THRIFT-5172?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Eric Bléher updated THRIFT-5172: -------------------------------- Flags: Patch,Important (was: Patch) Patch Info: Patch Available Description: 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. was: 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 wanted to push a branch with the fix, but I don't have permission on the Thrift repo. remote: Permission to apache/thrift.git denied to xxxx. fatal: unable to access 'https://github.com/apache/thrift/': The requested URL returned error: 403 > 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)