# Storagenode creates way too many TCP Sockets

**URL:** <https://forum.storj.io/t/storagenode-creates-way-too-many-tcp-sockets/20644>\
**Category:** Node Operators\
**Tags:** tcp-sockets, bug\
**Created:** [December 8, 2022, 6:28pm UTC](https://forum.storj.io/t/storagenode-creates-way-too-many-tcp-sockets/20644 "2022-12-08T18:28:56Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![yEinFallsLos](https://storj.bcdn.literatehosting.com/user_avatar/forum.storj.io/yeinfallslos/32/67_2.png) [@yEinFallsLos](https://forum.storj.io/u/yEinFallsLos)\
**Post date:** [December 8, 2022, 6:28pm UTC](https://forum.storj.io/t/storagenode-creates-way-too-many-tcp-sockets/20644/1 "2022-12-08T18:28:56Z")

</div>

Recently my storagenodes are causing me some problems and after some debugging I found out the culprit: Sometimes, over time, some storagenode creates ever more TCP Sockets, without connecting or binding them.  
This goes on until 100s of thousands of unused sockets are created and all networking infrastructure becomes sluggish and unstable.

Some output of `lsof -p (storagenode pid)`:

```auto
storageno 1026179 root 1107u sock 0,8 0t0 353589940 protocol: TCPv6
storageno 1026179 root 1108u sock 0,8 0t0 353588189 protocol: TCPv6
storageno 1026179 root 1109u sock 0,8 0t0 353589177 protocol: TCPv6
storageno 1026179 root 1110u sock 0,8 0t0 353589918 protocol: TCPv6
storageno 1026179 root 1111u sock 0,8 0t0 353590874 protocol: TCPv6
storageno 1026179 root 1112u sock 0,8 0t0 353591823 protocol: TCPv6
storageno 1026179 root 1113u sock 0,8 0t0 353588203 protocol: TCPv6
storageno 1026179 root 1114u sock 0,8 0t0 353589923 protocol: TCPv6
storageno 1026179 root 1115u sock 0,8 0t0 353589932 protocol: TCPv6
storageno 1026179 root 1116u sock 0,8 0t0 353589928 protocol: TCPv6
storageno 1026179 root 1117u sock 0,8 0t0 353588208 protocol: TCPv6
storageno 1026179 root 1118u sock 0,8 0t0 353590880 protocol: TCPv6
storageno 1026179 root 1119u sock 0,8 0t0 353593505 protocol: TCPv6

```

this is only a very small subset, as the output was over 500k lines long…

I am a storagenode operator for several years now and the exact same setup ran for many months without a problem. It’s only been happening since around last week, so I’m guessing some recent update caused it.

Of course I’m willing to provide any further information if needed, hope this can be fixed soon 🙂

---

<div class="post-metadata">

**Author:** ![thepaul](https://storj.bcdn.literatehosting.com/user_avatar/forum.storj.io/thepaul/32/65_2.png) [@thepaul](https://forum.storj.io/u/thepaul)\
**Post date:** [December 8, 2022, 8:02pm UTC](https://forum.storj.io/t/storagenode-creates-way-too-many-tcp-sockets/20644/2 "2022-12-08T20:02:28Z")

</div>

You’re right, it looks like a file descriptor leak. That’s a big deal.

You said this happens “sometimes”. So, not every time? Any ideas about what’s different between the times it doesn’t happen and the times it does?

When it happens, are you able to tell approximately how fast new sockets are being allocated?

Finally, if you know your debug port, could you send the output of `curl 'http://your-node:debugport/debug/pprof/goroutine?debug=2'` ? That will output the stacks of all existing lightweight threads (‘goroutines’) and shouldn’t include any sensitive information.

_edit: updated to add:_ we have confirmation of this on some other nodes, and are stopping the rollout of v1.68.2 for now while we diagnose.

---

<div class="post-metadata">

**Author:** ![yEinFallsLos](https://storj.bcdn.literatehosting.com/user_avatar/forum.storj.io/yeinfallslos/32/67_2.png) [@yEinFallsLos](https://forum.storj.io/u/yEinFallsLos)\
**Post date:** [December 8, 2022, 8:45pm UTC](https://forum.storj.io/t/storagenode-creates-way-too-many-tcp-sockets/20644/3 "2022-12-08T20:45:13Z")

</div>

> [@thepaul](#):
>
> You said this happens “sometimes”. So, not every time? Any ideas about what’s different between the times it doesn’t happen and the times it does?

I’m not sure what’s different, but now that I’m observing it, it could have always been the same node. I restarted the node about when I wrote this post, and now the same node has over 31k open sockets again. The other ones are fine for now.

> [@thepaul](#):
>
> When it happens, are you able to tell approximately how fast new sockets are being allocated?

Well about 15-20k per hour.

> [@thepaul](#):
>
> Finally, if you know your debug port, could you send the output of `curl 'http://your-node:debugport/debug/pprof/goroutine?debug=2'` ? That will output the stacks of all existing lightweight threads (‘goroutines’) and shouldn’t include any sensitive information.

> **[Easyupload.io - Upload Files and Share Them Easily](https://easyupload.io/i638ch)**
>
> Uplaod files easily and share them with your friends and colleagues. File upload solution for everyone. Upload big files and get a link to share effortlesly.

_edit: updated broken link_  
This was taken at around 30k open sockets.

> [@thepaul](#):
>
> _edit: updated to add:_ we have confirmation of this on some other nodes, and are stopping the rollout of v1.68.2 for now while we diagnose.

Unfortunately, that node is still on v1.67.3

---

<div class="post-metadata">

**Author:** ![thepaul](https://storj.bcdn.literatehosting.com/user_avatar/forum.storj.io/thepaul/32/65_2.png) [@thepaul](https://forum.storj.io/u/thepaul)\
**Post date:** [December 8, 2022, 8:55pm UTC](https://forum.storj.io/t/storagenode-creates-way-too-many-tcp-sockets/20644/4 "2022-12-08T20:55:00Z")

</div>

Thank you! This should help a lot. We already have some good leads from that output.

If the file sharing is a problem, you could always use [https://transfer.sh/](https://transfer.sh/) - it’s powered by Storj!

---

<div class="post-metadata">

**Author:** ![yEinFallsLos](https://storj.bcdn.literatehosting.com/user_avatar/forum.storj.io/yeinfallslos/32/67_2.png) [@yEinFallsLos](https://forum.storj.io/u/yEinFallsLos)\
**Post date:** [December 8, 2022, 8:59pm UTC](https://forum.storj.io/t/storagenode-creates-way-too-many-tcp-sockets/20644/5 "2022-12-08T20:59:21Z")

</div>

Glad I could help 🙂  
Haha thank you, will keep that in mind next time I need file sharing 😃

---

<div class="post-metadata">

**Author:** ![yEinFallsLos](https://storj.bcdn.literatehosting.com/user_avatar/forum.storj.io/yeinfallslos/32/67_2.png) [@yEinFallsLos](https://forum.storj.io/u/yEinFallsLos)\
**Post date:** [December 15, 2022, 7:05pm UTC](https://forum.storj.io/t/storagenode-creates-way-too-many-tcp-sockets/20644/6 "2022-12-15T19:05:22Z")

</div>

Has there been any progress to this? Will it get fixed in the next release?  
The same node still produces lots of sockets for me, while the other ones are fine

---

<div class="post-metadata">

**Author:** ![snorkel](https://storj.bcdn.literatehosting.com/letter_avatar/snorkel/32/6_449c533f586939b6e5f246632a46421f.png) [@snorkel](https://forum.storj.io/u/snorkel)\
**Post date:** [December 15, 2022, 8:30pm UTC](https://forum.storj.io/t/storagenode-creates-way-too-many-tcp-sockets/20644/7 "2022-12-15T20:30:28Z")

</div>

Transfer.sh is marked by Virus Total as dangerous. Even my antivirus blocked a transfer from a friend through it. I think it is also used to deliver malware by bad actors.

---

<div class="post-metadata">

**Author:** ![arrogantrabbit](https://storj.bcdn.literatehosting.com/user_avatar/forum.storj.io/arrogantrabbit/32/11200_2.png) [@arrogantrabbit](https://forum.storj.io/u/arrogantrabbit)\
**Post date:** [December 16, 2022, 1:26am UTC](https://forum.storj.io/t/storagenode-creates-way-too-many-tcp-sockets/20644/8 "2022-12-16T01:26:37Z")

</div>

> [@snorkel](#):
>
> Transfer.sh is marked by Virus Total as dangerous.

Are you sure it’s .sh and not .com that is [reported](https://github.com/dutchcoders/transfer.sh/#disclaimer)?

> The service at transfersh.com is of unknown origin and reported as cloud malware.

---

<div class="post-metadata">

**Author:** ![snorkel](https://storj.bcdn.literatehosting.com/letter_avatar/snorkel/32/6_449c533f586939b6e5f246632a46421f.png) [@snorkel](https://forum.storj.io/u/snorkel)\
**Post date:** [December 16, 2022, 4:49am UTC](https://forum.storj.io/t/storagenode-creates-way-too-many-tcp-sockets/20644/9 "2022-12-16T04:49:48Z")

</div>

![image](https://storj-s3.bcdn.literatehosting.net/original/2X/3/390d93b4f6781f14ed17090b7c61da2410913986.jpeg)

---

<div class="post-metadata">

**Author:** ![thepaul](https://storj.bcdn.literatehosting.com/user_avatar/forum.storj.io/thepaul/32/65_2.png) [@thepaul](https://forum.storj.io/u/thepaul)\
**Post date:** [December 16, 2022, 7:31pm UTC](https://forum.storj.io/t/storagenode-creates-way-too-many-tcp-sockets/20644/10 "2022-12-16T19:31:22Z")

</div>

> [@yEinFallsLos](#):
>
> Has there been any progress to this? Will it get fixed in the next release?

I’m afraid we hit a dead end with the lead we thought we had. We’re not even sure if the reproduction we saw is the same issue as yours. We’re still investigating, but unfortunately it won’t be fixed in the next release.

---

<div class="post-metadata">

**Author:** ![Vadim](https://storj.bcdn.literatehosting.com/letter_avatar/vadim/32/6_449c533f586939b6e5f246632a46421f.png) [@Vadim](https://forum.storj.io/u/Vadim)\
**Post date:** [December 16, 2022, 7:32pm UTC](https://forum.storj.io/t/storagenode-creates-way-too-many-tcp-sockets/20644/11 "2022-12-16T19:32:40Z")

</div>

is it posible that he just has some kind of atack?

---

<div class="post-metadata">

**Author:** ![thepaul](https://storj.bcdn.literatehosting.com/user_avatar/forum.storj.io/thepaul/32/65_2.png) [@thepaul](https://forum.storj.io/u/thepaul)\
**Post date:** [December 17, 2022, 10:20pm UTC](https://forum.storj.io/t/storagenode-creates-way-too-many-tcp-sockets/20644/12 "2022-12-17T22:20:29Z")

</div>

Yes, that’s a very distinct possibility. Even if it is, though, the node should be more resistant.

---

<div class="post-metadata">

**Author:** ![yEinFallsLos](https://storj.bcdn.literatehosting.com/user_avatar/forum.storj.io/yeinfallslos/32/67_2.png) [@yEinFallsLos](https://forum.storj.io/u/yEinFallsLos)\
**Post date:** [December 21, 2022, 10:01am UTC](https://forum.storj.io/t/storagenode-creates-way-too-many-tcp-sockets/20644/13 "2022-12-21T10:01:10Z")

</div>

Okay, just let me know if you need any more data.
