Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Unnamed tasks leaking on RPC nodes #1255

Closed
tomaka opened this issue Jun 12, 2020 · 10 comments
Closed

Unnamed tasks leaking on RPC nodes #1255

tomaka opened this issue Jun 12, 2020 · 10 comments
Labels
I9-footprint An enhancement to provide a smaller (system load, memory, network or disk) footprint.

Comments

@tomaka
Copy link
Contributor

tomaka commented Jun 12, 2020

Screenshot from 2020-06-12 16-30-10

Here is a screenshot of the number of unnamed tasks on our RPC nodes.
As you can see, we're at around 25000 such tasks at the moment, and it is increasing, which I suppose isn't normal.

An "unnamed task" in this context is a Future that we spawn through the futures::task::Spawn trait. If I'm not mistaken, we don't have any unnamed task in Substrate anymore, so this is probably coming from somewhere in Polkadot.
cc #1244

This leak apparently happens on our two Polkadot RPC nodes and Kusama RPC node, but not our bootnode nor on my own node that has been running for two days. Also doesn't happen on any Kusama non-RPC node.
The flags on these RPC nodes are --ws-port 5556 --unsafe-ws-external --ws-max-connections 5000 --rpc-cors '*'.

@tomaka
Copy link
Contributor Author

tomaka commented Jun 12, 2020

Memory consumption seems to increase by around 100 MiB/day on these nodes, but it's unclear how much that is due to these tasks.

@rphmeier rphmeier added the I9-footprint An enhancement to provide a smaller (system load, memory, network or disk) footprint. label Jun 12, 2020
@bkchr
Copy link
Member

bkchr commented Jun 12, 2020

I think this could be fixed by this pr as well: paritytech/substrate#6341

It lead to transaction notifiers not being closed down, but this would mean the connection stayed open all the time or there is also a bug on the RPC not closing tasks properly. Maybe worth to monitor with 0.8.8.

@tomaka
Copy link
Contributor Author

tomaka commented Jun 19, 2020

Still leaking on 0.8.10-183848b6

@tomaka
Copy link
Contributor Author

tomaka commented Jun 21, 2020

Around 150,000 such tasks alive on each RPC node at the moment.

@tomaka
Copy link
Contributor Author

tomaka commented Jul 17, 2020

The tasks are still unnamed despite running 0.8.14.
We probably have to do #1378 to continue here.

@tomaka
Copy link
Contributor Author

tomaka commented Jul 21, 2020

The leaking task is still unnamed on 0.8.17, despite #1430 being in

The number of tasks seems to stay between 300k and 500k.

@tomaka
Copy link
Contributor Author

tomaka commented Jul 23, 2020

We have reached a peak of 772k tasks a bit earlier

@tomaka
Copy link
Contributor Author

tomaka commented Jul 23, 2020

As Rob suggested, this might be the JSON-RPC code registering finality and chain heads notifications for when users subscribe.

@tomaka
Copy link
Contributor Author

tomaka commented Jul 29, 2020

The leaking task is substrate_rpc_subscription

@tomaka
Copy link
Contributor Author

tomaka commented Jun 15, 2021

Tasks are now named. A new issue should be opened if a task is leaking.

@tomaka tomaka closed this as completed Jun 15, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
I9-footprint An enhancement to provide a smaller (system load, memory, network or disk) footprint.
Projects
None yet
Development

No branches or pull requests

3 participants