question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

MinioClient generates a lot of connections in TIME_WAIT

See original GitHub issue

I ran into some stability problems while listing and downloading metadata from one of our services using Minio. I’ve traced it down to the RestSharp dependency in the minio-dotnet client. I’ve added a comment regarding this in an existing issue in the RestSharp repo https://github.com/restsharp/RestSharp/issues/1322

To reproduce issue I’ve made two equivalent scripts for .net core 2.2 using the most recent (at this time) version of the Minio SDK as well as the Amazon SDK as a reference. You can download them from this gist: https://gist.github.com/DynamicOperationsFacilitator/fc3148bad05552fd5138a12c79399c17

While listing buckets in an infinite loop isn’t really a normal workload. it’s a fast operation that highlights the difference in how well persistent HTTP connections work in minio-dotnet vs. awssdk.s3

Example of how to run:

git clone https://gist.github.com/DynamicOperationsFacilitator/fc3148bad05552fd5138a12c79399c17
cd fc3148bad05552fd5138a12c79399c17
docker-compose build && docker-compose up -d
docker-compose exec minioclient netstat -n
docker-compose exec amazons3client netstat -n

Sample output from running netstat in each container:

$ docker-compose exec minioclient netstat -n |  head
Active Internet connections (w/o servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State
tcp        0      0 172.19.0.4:37547        172.19.0.2:9000         TIME_WAIT
tcp        0      0 172.19.0.4:36883        172.19.0.2:9000         TIME_WAIT
tcp        0      0 172.19.0.4:46841        172.19.0.2:9000         TIME_WAIT
tcp        0      0 172.19.0.4:34095        172.19.0.2:9000         TIME_WAIT
tcp        0      0 172.19.0.4:46111        172.19.0.2:9000         TIME_WAIT
tcp        0      0 172.19.0.4:38251        172.19.0.2:9000         TIME_WAIT
tcp        0      0 172.19.0.4:43549        172.19.0.2:9000         TIME_WAIT
tcp        0      0 172.19.0.4:42931        172.19.0.2:9000         TIME_WAIT

$ docker-compose exec minioclient netstat -n | wc -l
4019
$ docker-compose exec amazons3client netstat -n
Active Internet connections (w/o servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State
tcp        0    550 172.19.0.5:38061        172.19.0.2:9000         ESTABLISHED
tcp        0      0 172.19.0.5:34379        172.19.0.2:9000         ESTABLISHED
Active UNIX domain sockets (w/o servers)
Proto RefCnt Flags       Type       State         I-Node   Path

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

3reactions
tonyquscommented, Feb 5, 2020

Hi, has this issue been resolved? This issue may potentially make .net program unstable.

2reactions
harshavardhanacommented, Feb 10, 2022

We moved away from RestSharp with a full re-implementation with HttpClientFactory

Read more comments on GitHub >

github_iconTop Results From Across the Web

linux - Huge amount of TIME_WAIT connections says netstat
A high number of TIME_WAIT connections is a symptom of getting lots of short lived connections, not nothing to worry about.
Read more >
What could cause so many TIME_WAIT connections to be ...
TCP's TIME_WAIT indicates that local endpoint (this side) has closed the connection. The connection is being kept around so that any delayed ...
Read more >
Too many connections in TIME_WAIT state [solved]
If you seeing a lot of connections in TIME_WAIT state then each socket in TIME_WAIT consumes some memory in the kernel, usually somewhat ......
Read more >
HTTP Client - Lots of Connections in TIME_WAIT
I have a problem where a simple program performing concurrent requests to a Node.JS webserver starts to pile up LOTS of connections in...
Read more >
Connections in TIME_WAIT State
Connections in TIME_WAIT State. After running your HTTP application, you use the netstat command and detect a lot of connections in state TIME_WAIT....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found