Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Memory leak issue #2477

Closed
twoeths opened this issue Apr 11, 2024 · 9 comments · Fixed by #2478 or #2719
Closed

Memory leak issue #2477

twoeths opened this issue Apr 11, 2024 · 9 comments · Fixed by #2478 or #2719

Comments

@twoeths
Copy link
Contributor

twoeths commented Apr 11, 2024

  • Version:
    v1.1.1

  • Platform:
    Linux 5.15.0-79-generic #86-Ubuntu SMP Mon Jul 10 16:07:21 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux

  • Subsystem:

Severity:

Medium

Description:

Refer to the profile taken by a lodestar beacon-node here

There are > 15k of objects retained belonging to these classes:

  • Socket
  • ConnectionImpl
  • Timeout
  • XXHandShake
  • MPlexStreamMuxer

Steps to reproduce the error:

Run a lodestar mainnet node and leave it for a long time, then monitor heap size of network thread

@twoeths twoeths added the need/triage Needs initial labeling and prioritization label Apr 11, 2024
@twoeths
Copy link
Contributor Author

twoeths commented Apr 11, 2024

I found all Sockets have a timeout and they're all destroyed
Screenshot 2024-04-11 at 14 39 33

all connection statuses are also "closed"
Screenshot 2024-04-11 at 14 40 39

also there are socket events attached during the MultiaddrConnection.close() function, especially the "drain" one

Screenshot 2024-04-11 at 14 42 36

it seems to me the MultiaddrConnection.close() was called, but somehow it still keep some resources especially the socket listeners

@SgtPooki
Copy link
Member

SgtPooki commented Apr 11, 2024

@tuyennhv slightly off-topic but is there any chance you could share the grafana dashboard json you use over at lodestar so we can use it in ipfs/helia-http-gateway ?

@twoeths
Copy link
Contributor Author

twoeths commented Apr 11, 2024

@SgtPooki here's the libp2p dashboard in lodestar https://github.com/ChainSafe/lodestar/blob/unstable/dashboards/lodestar_libp2p.json

Screenshot 2024-04-11 at 19 54 28 Screenshot 2024-04-11 at 19 54 46

@twoeths
Copy link
Contributor Author

twoeths commented Apr 15, 2024

@achingbrain need to reopen until it's confirmed this is fixed in lodestar, waiting for a new release of transport-tcp to test

@achingbrain
Copy link
Member

@tuyennhv did you manage to test the new release?

@achingbrain achingbrain added need/author-input Needs input from the original author need/triage Needs initial labeling and prioritization and removed need/triage Needs initial labeling and prioritization labels Apr 23, 2024
@twoeths
Copy link
Contributor Author

twoeths commented Apr 25, 2024

@achingbrain we tested v9.0.22 and found it does not resolve the memory leak issue. It also introduced some performance impact that caused node to forward less gossip messages to mesh peers, I'm not sure if it links to libp2p-tcp specifically or other libs during the upgrade to have to rollback in our release

see https://github.com/ChainSafe/lodestar/pull/6701/files

@twoeths
Copy link
Contributor Author

twoeths commented Apr 25, 2024

I think we need to upgrade all libp2p dependencies to the latest versions and evaluate again cc @wemeetagain
need to take a new profile with leaked memory for libp2p-tcp >= v9.0.22 to move this forward

@achingbrain achingbrain removed the need/author-input Needs input from the original author label Apr 25, 2024
@achingbrain
Copy link
Member

I think we need to upgrade all libp2p dependencies to the latest versions

Please do, there was a small leak fixed by @libp2p/[email protected] so that's a good idea in general.

@twoeths
Copy link
Contributor Author

twoeths commented Apr 26, 2024

in progress PR by @wemeetagain : ChainSafe/lodestar#6711

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants