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

cannot reserve inbound connection: resource limit exceeded #9432

Closed
3 tasks done
anarkrypto opened this issue Nov 23, 2022 · 69 comments
Closed
3 tasks done

cannot reserve inbound connection: resource limit exceeded #9432

anarkrypto opened this issue Nov 23, 2022 · 69 comments
Assignees
Labels
kind/bug A bug in existing code (including security flaws) P1 High: Likely tackled by core team if no one steps up

Comments

@anarkrypto
Copy link

anarkrypto commented Nov 23, 2022

Checklist

Installation method

built from source

Version

Kubo version: 0.17.0-4485d6b
Repo version: 12
System version: amd64/linux
Golang version: go1.19.1

Config

{
  "API": {
    "HTTPHeaders": {
      "Access-Control-Allow-Origin": [
        "*"
      ]
    }
  },
  "Addresses": {
    "API": "/ip4/0.0.0.0/tcp/5001",
    "Announce": [],
    "AppendAnnounce": [],
    "Gateway": "/ip4/0.0.0.0/tcp/8080",
    "NoAnnounce": [],
    "Swarm": [
      "/ip4/0.0.0.0/tcp/4001",
      "/ip6/::/tcp/4001",
      "/ip4/0.0.0.0/udp/4001/quic",
      "/ip6/::/udp/4001/quic"
    ]
  },
  "AutoNAT": {},
  "Bootstrap": [
    "/dnsaddr/bootstrap.libp2p.io/p2p/QmNnooDu7bfjPFoTZYxMNLWUQJyrVwtbZg5gBMjTezGAJN",
    "/dnsaddr/bootstrap.libp2p.io/p2p/QmQCU2EcMqAqQPR2i9bChDtGNJchTbq5TbXJJ16u19uLTa",
    "/dnsaddr/bootstrap.libp2p.io/p2p/QmbLHAnMoJPWSCR5Zhtx6BHJX9KiKNN6tpvbUcqanj75Nb",
    "/dnsaddr/bootstrap.libp2p.io/p2p/QmcZf59bWwK5XFi76CZX8cbJ4BhTzzA3gU1ZjYZcYW3dwt",
    "/ip4/104.131.131.82/tcp/4001/p2p/QmaCpDMGvV2BGHeYERUEnRQAwe3N8SzbUtfsmvsqQLuvuJ",
    "/ip4/104.131.131.82/udp/4001/quic/p2p/QmaCpDMGvV2BGHeYERUEnRQAwe3N8SzbUtfsmvsqQLuvuJ"
  ],
  "DNS": {
    "Resolvers": {}
  },
  "Datastore": {
    "BloomFilterSize": 0,
    "GCPeriod": "1h",
    "HashOnRead": false,
    "Spec": {
      "mounts": [
        {
          "child": {
            "path": "blocks",
            "shardFunc": "/repo/flatfs/shard/v1/next-to-last/2",
            "sync": true,
            "type": "flatfs"
          },
          "mountpoint": "/blocks",
          "prefix": "flatfs.datastore",
          "type": "measure"
        },
        {
          "child": {
            "compression": "none",
            "path": "datastore",
            "type": "levelds"
          },
          "mountpoint": "/",
          "prefix": "leveldb.datastore",
          "type": "measure"
        }
      ],
      "type": "mount"
    },
    "StorageGCWatermark": 90,
    "StorageMax": "10GB"
  },
  "Discovery": {
    "MDNS": {
      "Enabled": true
    }
  },
  "Experimental": {
    "AcceleratedDHTClient": false,
    "FilestoreEnabled": false,
    "GraphsyncEnabled": false,
    "Libp2pStreamMounting": false,
    "P2pHttpProxy": false,
    "StrategicProviding": false,
    "UrlstoreEnabled": false
  },
  "Gateway": {
    "APICommands": [],
    "HTTPHeaders": {
      "Access-Control-Allow-Headers": [
        "X-Requested-With",
        "Range",
        "User-Agent"
      ],
      "Access-Control-Allow-Methods": [
        "GET"
      ],
      "Access-Control-Allow-Origin": [
        "*"
      ]
    },
    "NoDNSLink": false,
    "NoFetch": false,
    "PathPrefixes": [],
    "PublicGateways": null,
    "RootRedirect": "",
    "Writable": false
  },
  "Identity": {
    "PeerID": "12D3KooWMywfzmLWCWErc9L7CmfLLFbmoSHroHBUveUPaarDbAfF"
  },
  "Internal": {},
  "Ipns": {
    "RecordLifetime": "",
    "RepublishPeriod": "",
    "ResolveCacheSize": 128
  },
  "Migration": {
    "DownloadSources": [],
    "Keep": ""
  },
  "Mounts": {
    "FuseAllowOther": false,
    "IPFS": "/ipfs",
    "IPNS": "/ipns"
  },
  "Peering": {
    "Peers": null
  },
  "Pinning": {
    "RemoteServices": {}
  },
  "Plugins": {
    "Plugins": null
  },
  "Provider": {
    "Strategy": ""
  },
  "Pubsub": {
    "DisableSigning": false,
    "Router": ""
  },
  "Reprovider": {
    "Interval": "12h",
    "Strategy": "all"
  },
  "Routing": {
    "Methods": null,
    "Routers": null,
    "Type": "dht"
  },
  "Swarm": {
    "AddrFilters": null,
    "ConnMgr": {},
    "DisableBandwidthMetrics": false,
    "DisableNatPortMap": false,
    "RelayClient": {},
    "RelayService": {},
    "ResourceMgr": {},
    "Transports": {
      "Multiplexers": {},
      "Network": {},
      "Security": {}
    }
  }
}

Description

Trying to run IPFS on VPS.

  • Port 4001 tcp/udp is open externally
  • Ubuntu 22.04.1 LTS
  • Swarm listens on all interfaces tcp/udp

Error Description:
The node starts, show success swarm announcing addresses, the port 4001 is exposed externally ( I checked) and after a few seconds it closes and I got this error message:

ERROR resourcemanager libp2p/rcmgr_logging.go:53 Resource limits were exceeded 496 times with error "system: cannot reserve inbound connection: resource limit exceeded".

Then the port cannot be reached anymore

Error occurend on both Docker (20.10.21) and installation from binaries

image

@anarkrypto anarkrypto added kind/bug A bug in existing code (including security flaws) need/triage Needs initial labeling and prioritization labels Nov 23, 2022
@anarkrypto
Copy link
Author

This does not happen when running ipfs daemon from snap

Kubo version: 0.16.0-38117db6f
Repo version: 12
System version: amd64/linux
Golang version: go1.19

@mitchds
Copy link

mitchds commented Nov 25, 2022

This does not happen when running ipfs daemon from snap

Kubo version: 0.16.0-38117db6f Repo version: 12 System version: amd64/linux Golang version: go1.19

As mentioned this happens with kubo 0.17. I am facing the same issue. This is not an issue with snap or not but with the new libp2p code i guess which was turned on in 0.17. I have gone back to 0.16 for the moment.

I have tried to increase the inbound connection limits to no avail

@mitchds
Copy link

mitchds commented Nov 25, 2022

I accidentally changed the resource in the wrong server, so changing the inbound connection value does work.

So changing the inbound connections to 1024 cured this for me. So add to your .ipfs/config in the "Swarm" block the following then you can tweak as you need.

 "ResourceMgr": {
      "Limits": {
        "System": {
          "Memory": 1073741824,
          "FD": 512,
          "Conns": 1024,
          "ConnsInbound": 1024,
          "ConnsOutbound": 1024,
          "Streams": 16384,
          "StreamsInbound": 4096,
          "StreamsOutbound": 16384
        }
      }
    },

@dennis-tra
Copy link
Collaborator

Also ran into this problem. My error message is:

Application error 0x0: conn-12133298: system: cannot reserve inbound connection: resource limit exceeded

We are running a customized 0.17.0 build.

ipfs config show
{
  "API": {
    "HTTPHeaders": {}
  },
  "Addresses": {
    "API": "/ip4/127.0.0.1/tcp/5001",
    "Announce": [],
    "AppendAnnounce": [],
    "Gateway": "/ip4/127.0.0.1/tcp/8080",
    "NoAnnounce": [],
    "Swarm": [
      "/ip4/0.0.0.0/tcp/4001",
      "/ip6/::/tcp/4001",
      "/ip4/0.0.0.0/udp/4001/quic",
      "/ip6/::/udp/4001/quic"
    ]
  },
  "AutoNAT": {},
  "Bootstrap": [
    "/dnsaddr/bootstrap.libp2p.io/p2p/QmcZf59bWwK5XFi76CZX8cbJ4BhTzzA3gU1ZjYZcYW3dwt",
    "/ip4/104.131.131.82/tcp/4001/p2p/QmaCpDMGvV2BGHeYERUEnRQAwe3N8SzbUtfsmvsqQLuvuJ",
    "/ip4/104.131.131.82/udp/4001/quic/p2p/QmaCpDMGvV2BGHeYERUEnRQAwe3N8SzbUtfsmvsqQLuvuJ",
    "/dnsaddr/bootstrap.libp2p.io/p2p/QmNnooDu7bfjPFoTZYxMNLWUQJyrVwtbZg5gBMjTezGAJN",
    "/dnsaddr/bootstrap.libp2p.io/p2p/QmQCU2EcMqAqQPR2i9bChDtGNJchTbq5TbXJJ16u19uLTa",
    "/dnsaddr/bootstrap.libp2p.io/p2p/QmbLHAnMoJPWSCR5Zhtx6BHJX9KiKNN6tpvbUcqanj75Nb"
  ],
  "DNS": {
    "Resolvers": {}
  },
  "Datastore": {
    "BloomFilterSize": 0,
    "GCPeriod": "1h",
    "HashOnRead": false,
    "Spec": {
      "mounts": [
        {
          "child": {
            "path": "blocks",
            "shardFunc": "/repo/flatfs/shard/v1/next-to-last/2",
            "sync": true,
            "type": "flatfs"
          },
          "mountpoint": "/blocks",
          "prefix": "flatfs.datastore",
          "type": "measure"
        },
        {
          "child": {
            "compression": "none",
            "path": "datastore",
            "type": "levelds"
          },
          "mountpoint": "/",
          "prefix": "leveldb.datastore",
          "type": "measure"
        }
      ],
      "type": "mount"
    },
    "StorageGCWatermark": 90,
    "StorageMax": "10GB"
  },
  "Discovery": {
    "MDNS": {
      "Enabled": true
    }
  },
  "Experimental": {
    "AcceleratedDHTClient": false,
    "FilestoreEnabled": false,
    "GraphsyncEnabled": false,
    "Libp2pStreamMounting": false,
    "P2pHttpProxy": false,
    "StrategicProviding": false,
    "UrlstoreEnabled": false
  },
  "Gateway": {
    "APICommands": [],
    "HTTPHeaders": {
      "Access-Control-Allow-Headers": [
        "X-Requested-With",
        "Range",
        "User-Agent"
      ],
      "Access-Control-Allow-Methods": [
        "GET"
      ],
      "Access-Control-Allow-Origin": [
        "*"
      ]
    },
    "NoDNSLink": false,
    "NoFetch": false,
    "PathPrefixes": [],
    "PublicGateways": null,
    "RootRedirect": "",
    "Writable": false
  },
  "Identity": {
    "PeerID": "12D3KooWMUTo8FJp9Rm9rwYuCdcR6Xi6wRjBjm2eDaNPEwgKgFdW"
  },
  "Internal": {},
  "Ipns": {
    "RecordLifetime": "",
    "RepublishPeriod": "",
    "ResolveCacheSize": 128
  },
  "Migration": {
    "DownloadSources": [],
    "Keep": ""
  },
  "Mounts": {
    "FuseAllowOther": false,
    "IPFS": "/ipfs",
    "IPNS": "/ipns"
  },
  "Peering": {
    "Peers": null
  },
  "Pinning": {
    "RemoteServices": {}
  },
  "Plugins": {
    "Plugins": null
  },
  "Provider": {
    "Strategy": ""
  },
  "Pubsub": {
    "DisableSigning": false,
    "Router": ""
  },
  "Reprovider": {
    "Interval": "12h",
    "Strategy": "all"
  },
  "Routing": {
    "Methods": null,
    "Routers": null,
    "Type": "dht"
  },
  "Swarm": {
    "AddrFilters": null,
    "ConnMgr": {},
    "DisableBandwidthMetrics": false,
    "DisableNatPortMap": false,
    "RelayClient": {},
    "RelayService": {},
    "ResourceMgr": {
      "Enabled": false
    },
    "Transports": {
      "Multiplexers": {},
      "Network": {},
      "Security": {}
    }
  }
}

We are running an experiment to measure the lookup latencies in the IPFS DHT network. For that we have deployed several, customized kubo nodes. The customization consist of just additional log messages. One of these log messages is right after the GetProviders RPC here:

https://github.com/libp2p/go-libp2p-kad-dht/blob/9896ce5b196a4c262d489b35460056a4b4e5618f/routing.go#L536

It logs the return values. I noticed that I receive a lot of the following errors:

Application error 0x0: conn-12133298: system: cannot reserve inbound connection: resource limit exceeded

Therefore I went ahead and disabled the resource manager (see config above). The error messages still stick around. Then we just deployed more beefy machines and the errors seem to be less but they still happen frequently.

It's also weird that the error message talks about an inbound connection although I'm calling out to the remote peer 🤔 .

@koxon
Copy link

koxon commented Nov 29, 2022

I see the same consistent issue.

2022-11-29T04:08:37.090Z ERROR resourcemanager libp2p/rcmgr_logging.go:53 Resource limits were exceeded 42 times with error "system: cannot reserve inbound connection: resource limit exceeded".

# ipfs --version
ipfs version 0.17.0

anarkrypto added a commit to apptalktime/ipfs-docker that referenced this issue Nov 29, 2022
IPFS Kubo v0.17 has a bug with ResourceMgr:
ipfs/kubo#9432
@anarkrypto
Copy link
Author

I was able to fix by downgrading to v0.16.0

@BigLep @lidel @galargh @ajnavarro

@ajnavarro
Copy link
Member

This error is expected when you have too many inbound connections at the System level to avoid DoS attacks. If your hardware or use case needs to support more inbound connections than the default, you can change that by doing:

# Remove custom params
ipfs config --json Swarm.ResourceMgr '{}'

# Set inbound connection limits to a custom value
ipfs config --json Swarm.ResourceMgr.Limits.System.ConnsInbound 1000

# You might want to change also the number of inbound streams
ipfs config --json Swarm.ResourceMgr.Limits.System.StreamsInbound 1000

# If your hardware configuration is able to handle more connections
# and you are hitting Transient limits, you can also change them:
ipfs config --json Swarm.ResourceMgr.Limits.Transient.ConnsInbound 1000
ipfs config --json Swarm.ResourceMgr.Limits.Transient.StreamsInbound 1000

# Remember to restart the node to apply the changes

# You can see the applied changes executing:
$ ipfs swarm limit system
$ ipfs swarm limit transient

# You can check actual resources in use:
$ ipfs swarm stats system
$ ipfs swarm stats transient

The error is followed by a link: Consider inspecting logs and raising the resource manager limits. Documentation: https://github.com/ipfs/kubo/blob/master/docs/config.md#swarmresourcemgr
There you can learn about all the different knobs to tune ResourceManager, but the more important ones are ConnsInbound and StreamsInbound.

@rotarur
Copy link

rotarur commented Nov 29, 2022

I'm facing the same issue. looking at the stats and comparing with the limits I have it's not even touches the limits but still seeing this error in my logs.

/ # ipfs swarm stats system
{
  "System": {
    "Conns": 563,
    "ConnsInbound": 0,
    "ConnsOutbound": 563,
    "FD": 125,
    "Memory": 44040288,
    "Streams": 868,
    "StreamsInbound": 55,
    "StreamsOutbound": 813
  }
}
/ # ipfs swarm limit system
{
  "Conns": 1024,
  "ConnsInbound": 1024,
  "ConnsOutbound": 1024,
  "FD": 4512,
  "Memory": 1073741824,
  "Streams": 16384,
  "StreamsInbound": 4096,
  "StreamsOutbound": 16384
}

I'm running the IPFS v0.17.0

@ajnavarro
Copy link
Member

@rotarur can you paste the error that you are having? Your node might be hitting another RM level limit, like transient.

@kallisti5
Copy link

kallisti5 commented Nov 29, 2022

I'm running into this issue after upgrading to 0.17.0. Almost continuous in logs...

Nov 29 13:18:36 ipfspri.discord.local ipfs[239746]: 2022-11-29T13:18:36.217-0600        ERROR        resourcemanager        libp2p/rcmgr_logging.go:53        Resource limits were exceeded 261 times with error "system: cannot reserve inbound connection: resource limit exceeded".
Nov 29 13:18:36 ipfspri.discord.local ipfs[239746]: 2022-11-29T13:18:36.218-0600        ERROR        resourcemanager        libp2p/rcmgr_logging.go:57        Consider inspecting logs and raising the resource manager limits. Documentation: https://github.com/ipfs/kubo/blob/master/docs/config.md#swarmresourcemgr
Nov 29 13:18:46 ipfspri.discord.local ipfs[239746]: 2022-11-29T13:18:46.216-0600        ERROR        resourcemanager        libp2p/rcmgr_logging.go:53        Resource limits were exceeded 342 times with error "system: cannot reserve inbound connection: resource limit exceeded".
Nov 29 13:18:46 ipfspri.discord.local ipfs[239746]: 2022-11-29T13:18:46.216-0600        ERROR        resourcemanager        libp2p/rcmgr_logging.go:57        Consider inspecting logs and raising the resource manager limits. Documentation: https://github.com/ipfs/kubo/blob/master/docs/config.md#swarmresourcemgr
Nov 29 13:18:56 ipfspri.discord.local ipfs[239746]: 2022-11-29T13:18:56.216-0600        ERROR        resourcemanager        libp2p/rcmgr_logging.go:53        Resource limits were exceeded 322 times with error "system: cannot reserve inbound connection: resource limit exceeded".
Nov 29 13:18:56 ipfspri.discord.local ipfs[239746]: 2022-11-29T13:18:56.217-0600        ERROR        resourcemanager        libp2p/rcmgr_logging.go:57        Consider inspecting logs and raising the resource manager limits. Documentation: https://github.com/ipfs/kubo/blob/master/docs/config.md#swarmresourcemgr
Nov 29 13:19:06 ipfspri.discord.local ipfs[239746]: 2022-11-29T13:19:06.215-0600        ERROR        resourcemanager        libp2p/rcmgr_logging.go:53        Resource limits were exceeded 396 times with error "system: cannot reserve inbound connection: resource limit exceeded".
Nov 29 13:19:06 ipfspri.discord.local ipfs[239746]: 2022-11-29T13:19:06.216-0600        ERROR        resourcemanager        libp2p/rcmgr_logging.go:57        Consider inspecting logs and raising the resource manager limits. Documentation: https://github.com/ipfs/kubo/blob/master/docs/config.md#swarmresourcemgr
Nov 29 13:19:16 ipfspri.discord.local ipfs[239746]: 2022-11-29T13:19:16.216-0600        ERROR        resourcemanager        libp2p/rcmgr_logging.go:53        Resource limits were exceeded 426 times with error "system: cannot reserve inbound connection: resource limit exceeded".
Nov 29 13:19:16 ipfspri.discord.local ipfs[239746]: 2022-11-29T13:19:16.216-0600        ERROR        resourcemanager        libp2p/rcmgr_logging.go:57        Consider inspecting logs and raising the resource manager limits. Documentation: https://github.com/ipfs/kubo/blob/master/docs/config.md#swarmresourcemgr
Nov 29 13:19:26 ipfspri.discord.local ipfs[239746]: 2022-11-29T13:19:26.216-0600        ERROR        resourcemanager        libp2p/rcmgr_logging.go:53        Resource limits were exceeded 437 times with error "system: cannot reserve inbound connection: resource limit exceeded".
Nov 29 13:19:26 ipfspri.discord.local ipfs[239746]: 2022-11-29T13:19:26.216-0600        ERROR        resourcemanager        libp2p/rcmgr_logging.go:57        Consider inspecting logs and raising the resource manager limits. Documentation: https://github.com/ipfs/kubo/blob/master/docs/config.md#swarmresourcemgr
Nov 29 13:19:36 ipfspri.discord.local ipfs[239746]: 2022-11-29T13:19:36.216-0600        ERROR        resourcemanager        libp2p/rcmgr_logging.go:53        Resource limits were exceeded 387 times with error "system: cannot reserve inbound connection: resource limit exceeded".
Nov 29 13:19:36 ipfspri.discord.local ipfs[239746]: 2022-11-29T13:19:36.219-0600        ERROR        resourcemanager        libp2p/rcmgr_logging.go:57        Consider inspecting logs and raising the resource manager limits. Documentation: https://github.com/ipfs/kubo/blob/master/docs/config.md#swarmresourcemgr

@kallisti5
Copy link

kallisti5 commented Nov 29, 2022

$ ipfs swarm limit system
{
  "Conns": 4611686018427388000,
  "ConnsInbound": 123,
  "ConnsOutbound": 4611686018427388000,
  "FD": 4096,
  "Memory": 1999292928,
  "Streams": 4611686018427388000,
  "StreamsInbound": 1977,
  "StreamsOutbound": 4611686018427388000
}
$ ipfs swarm limit transient
{
  "Conns": 4611686018427388000,
  "ConnsInbound": 46,
  "ConnsOutbound": 4611686018427388000,
  "FD": 1024,
  "Memory": 158466048,
  "Streams": 4611686018427388000,
  "StreamsInbound": 247,
  "StreamsOutbound": 4611686018427388000
}
$ ipfs swarm stats system
{
  "System": {
    "Conns": 213,
    "ConnsInbound": 123,
    "ConnsOutbound": 90,
    "FD": 38,
    "Memory": 5914624,
    "Streams": 197,
    "StreamsInbound": 80,
    "StreamsOutbound": 117
  }
}
$ ipfs swarm stats transient
{
  "Transient": {
    "Conns": 0,
    "ConnsInbound": 0,
    "ConnsOutbound": 0,
    "FD": 0,
    "Memory": 0,
    "Streams": 1,
    "StreamsInbound": 0,
    "StreamsOutbound": 1
  }
}

@kallisti5
Copy link

soo. it looks like when the ResourceMgr limits are undefined ipfs config --json Swarm.ResourceMgr '{}' random limits get set?

@kallisti5
Copy link

Hm. I set defined limits for all the "random values", and still seeing random values after restarting IPFS. It looks like maybe some memory overflow...

config:

    "ResourceMgr": {
      "Limits": {
        "System": {
          "Conns": 2048,
          "ConnsInbound": 1024,
          "ConnsOutbound": 1024,
          "FD:": 8192,
          "Streams:": 16384,
          "StreamsInbound:": 4096,
          "StreamsOutbound:": 16384
        }
      }
    },
$ ipfs swarm limit system
{
  "Conns": 2048,
  "ConnsInbound": 1024,
  "ConnsOutbound": 1024,
  "FD": 4096,
  "Memory": 1999292928,
  "Streams": 4611686018427388000,
  "StreamsInbound": 1977,
  "StreamsOutbound": 4611686018427388000
}

@2color
Copy link
Member

2color commented Nov 30, 2022

I also seem to be experiencing this even though I have the resource manager disabled

@ajnavarro
Copy link
Member

ajnavarro commented Nov 30, 2022

@kallisti5 please check your configuration. It is wrong. Remove : from the variable name.
Also, it is not a memory overflow, it is the max value (like not having limits)

@ajnavarro
Copy link
Member

@2color how did you disable RM? ipfs config --json Swarm.ResourceMgr.Enabled false and restarting the daemon?

@rotarur
Copy link

rotarur commented Nov 30, 2022

@ajnavarro

my logs are always the same and I don't have the documentation link, weird

ipfs 2022-11-30T11:37:52.039Z    INFO    net/identify    identify/id.go:369    failed negotiate identify protocol with peer    {"peer": "12D3KooWMTa2XzV7thiUSKVKUfUYtBGiV7T3fGjayy7voHVKbjAF", "error": "Application error 0x0: conn-3607345: system: cannot reserve inbound connection: resource limit exceeded"}
ipfs 2022-11-30T11:37:52.039Z    WARN    net/identify    identify/id.go:334    failed to identify 12D3KooWMTa2XzV7thiUSKVKUfUYtBGiV7T3fGjayy7voHVKbjAF: Application error 0x0: conn-3607345: system: cannot reserve inbound connection: resource limit exceeded

The transient connections are not used

/ # ipfs swarm limit transient
{
  "Conns": 4611686018427388000,
  "ConnsInbound": 1024,
  "ConnsOutbound": 1024,
  "FD": 131072,
  "Memory": 521011200,
  "Streams": 4611686018427388000,
  "StreamsInbound": 592,
  "StreamsOutbound": 4611686018427388000
}
/ # ipfs swarm stats transient
{
  "Transient": {
    "Conns": 0,
    "ConnsInbound": 0,
    "ConnsOutbound": 0,
    "FD": 0,
    "Memory": 0,
    "Streams": 1,
    "StreamsInbound": 0,
    "StreamsOutbound": 1
  }
}

My server is big enough for the IPFS and it has plenty of resources to use

@ajnavarro
Copy link
Member

ajnavarro commented Nov 30, 2022

@rotarur are you getting errors like Resource limits were exceeded 261 times with error...? Can you paste them here to see the RM level we are hitting?

If there are no errors like these, it is a different problem.

@kallisti5
Copy link

kallisti5 commented Nov 30, 2022

@ajnavarro LOL. I think you just found the issue.

ipfs config --json Swarm.ResourceMgr.Limits.System.FD: 8192

That's the command I used to set FD
Isn't FD a reserved var in golang?

EDIT: Nevermind. I just realized the syntax is indeed ipfs config ... without the :
So, it looks like a little validation needs to happen here, and ipfs can't handle an empty or invalid ResourceMgr limits?

@rotarur
Copy link

rotarur commented Nov 30, 2022

@ajnavarro I don't have any error like Resource limits were exceeded 261 times with error...

@fanhai
Copy link

fanhai commented Dec 1, 2022

Can you configure the number of connections according to the protocol priority
/p2p/id/delta/1.0.0 /ipfs/id/1.0.0 /ipfs/id/push/1.0.0 /ipfs/ping/1.0.0 /libp2p/circuit/relay/0.1.0 /libp2p/circuit/relay/0.2.0/stop /ipfs/lan/kad/1.0.0 /libp2p/autonat/1.0.0 /ipfs/bitswap/1.2.0 /ipfs/bitswap/1.1.0 /ipfs/bitswap/1.0.0 /ipfs/bitswap /meshsub/1.1.0 /meshsub/1.0.0 /floodsub/1.0.0 /x/ /asmb/maons/1.0.0

@Jorropo Jorropo added P1 High: Likely tackled by core team if no one steps up and removed need/triage Needs initial labeling and prioritization labels Dec 1, 2022
@lidel
Copy link
Member

lidel commented Dec 1, 2022

Potentially a controversial take, but this feels like UX problem, and not a problem with default limits.

Printing error every 10 seconds when any limit is hit is bit hardcore.
We have limits for a reason. They are feature.
This constant ERROR messaging makes them feel like "error that needs to be solved by raising/removing limits", which is imo UX antipattern.

👉 ResourceMgr protecting user and working as expected should not look like ERROR.

Quick ideas that would remove the need for relaxing default limits:

  • No need for printing ERROR every 10 seconds, can we bump it to 5m or 1h? Feels as useful, but less noisy.
  • Make it clear ResourceMgr is a feature, not a bug, and that it is protecting end user.
    • Replace Resource limits were exceeded with ResourceMgr protected node from exceeding resource limits
  • Add Swarm.ResourceMgr.VerboseEnforcement Flag set to true by default, when set to false removes ERRORs or moves these messages to WARN or DEBUG level.
    • Change error message to be actionable: To remove this message set Swarm.ResourceMgr.VerboseEnforcement to false (most users won't be able to reason what limits should be changed, and would like the message to go away – we would want to suppress log spam it in GUI apps like ipfs-desktop and Brave too).
  • This way we keep limits protecting users from unwanted resource usage caused by incoming connections, but also give people the ability to remove the noise from logs if they do not plan to change the limits

Potentially a controversial take: maybe there is an UX solution to this?

Printing error every 10 seconds when any limit is hit is bit hardcore.
We have limits for a reason. They are feature.
This constant ERROR messaging makes them feel like "error that needs to be solved by raising/removing limits", which is imo UX antipattern.

👉 ResourceMgr protecting user and working as expected should not look like ERROR.

@ajnavarro
Copy link
Member

ajnavarro commented Dec 1, 2022

@lidel if we bump errors to be printed every hour, you won't notice when you really are hitting limits. Let's say that you hit limits at 1:01 PM then until 2:00 PM you won't have any kind of information, and the limits at that time are just fine, but you are having a warning or an error because you hit limits one hour away.

We can make it possible to silence the error output, but the problem won't disappear. Nodes with better hardware will struggle to handle incoming connections even if they have enough real resources, and small nodes will be like they don't have any resource manager active because default limits will be too high.

My proposal is to set default resource manager limits per peer only by default. It is the only limit that we can set by default knowing that will be right for any user and any hardware: #9443
The ideal solution will be to limit to only one connection per IP but it is something that is not straightforward.

@ShadowJonathan
Copy link

ShadowJonathan commented Jan 24, 2023

Ah, I had that suspicion, but I wasn't entirely sure if this was indeed the case. Thanks for pointing to the (remote) marker, that makes those log entries a lot more understandable, as it was US-daylight hours, with the nodes most likely more overloaded at that time 😅

Then that addresses all my concerns for me personally, except the stall on ping during those hours, that is still a mystery to me.

The log entries could be made more clear if (remote) is turned into (from remote), else it's easy to confuse this as being related to remote something, not that it is coming from the remote node. I'll echo this in the issue you linked as well.

@2color
Copy link
Member

2color commented Jan 25, 2023

TLDR: These errors are errors coming from remote peers that are hitting Resource Manager limits, not the local node. Note the (remote): flag on errors before the connection manager error.

That's good news. However, this also raises the question of why it's an error. If the resource manager is working as it should and it rejects an inbound connection, that isn't an error.

@ShadowJonathan
Copy link

It's a warning-level log, I turned those on to get a better idea of how the node was behaving

@2color
Copy link
Member

2color commented Jan 25, 2023

I don't mean the log level, I'm referring to the log message which shouldn't say error if it isn't one.

@markg85
Copy link
Contributor

markg85 commented Jan 30, 2023

❯ ipfs swarm stats system
{
  "System": {
    "Conns": 182,
    "ConnsInbound": 79,
    "ConnsOutbound": 103,
    "FD": 17,
    "Memory": 4501504,
    "Streams": 107,
    "StreamsInbound": 79,
    "StreamsOutbound": 28
  }
}

And in the config i have:

    "ResourceMgr": {
      "Limits": {
        "System": {
          "FD": 8192
        }
      },
      "MaxMemory": "8GB"
    },

Note the FD. Plenty of room for IPFS.

Yet when i start ipfs with warning level debugging turned on i'm near immediately welcomed with a ton of these resource limit warnings.
What resource is limited?

Would it be possible to be more verbose to tell you what resource is limited and how to fix it?

@BigLep
Copy link
Contributor

BigLep commented Jan 31, 2023

@markg85 : a couple of things:

  1. What Kubo version are you using? 0.18.1 is recomended.
  2. See https://github.com/ipfs/kubo/blob/master/docs/libp2p-resource-management.md#what-do-these-protected-from-exceeding-resource-limits-log-messages-mean for how to interpret the log message.

@markg85
Copy link
Contributor

markg85 commented Jan 31, 2023

@BigLep That was indeed with 0.18.1.

That link helps to paste the correct details, thanks!
Just did an ipfs restart and as soon as i got those warnings again (in mere seconds after restart) i ran these commands:

❯ ipfs swarm limit system
{
  "Conns": 1000000000,
  "ConnsInbound": 7629,
  "ConnsOutbound": 1000000000,
  "FD": 8192,
  "Memory": 8000000000,
  "Streams": 1000000000,
  "StreamsInbound": 1000000000,
  "StreamsOutbound": 1000000000
}
❯ ipfs swarm stats system
{
  "System": {
    "Conns": 547,
    "ConnsInbound": 51,
    "ConnsOutbound": 496,
    "FD": 39,
    "Memory": 8425472,
    "Streams": 170,
    "StreamsInbound": 62,
    "StreamsOutbound": 108
  }
}

I'm not hitting the limits according to those commands yet the logging tells me otherwise.

@ajnavarro
Copy link
Member

ajnavarro commented Jan 31, 2023

@markg85 Does these errors contains the (remote) flag? If yes, these errors are errors coming from remote peers that are hitting Resource Manager limits, not the local node.

@markg85
Copy link
Contributor

markg85 commented Jan 31, 2023

@ajnavarro

2023-01-31T15:18:17.740+0100    WARN    net/identify    identify/id.go:334      failed to identify 12D3KooWQnyn2AtTBf6niZw7dxXBwf4EpKSLU9PsCJX3R69vEKhj: Application error 0x0 (remote): conn-1792826: system: cannot reserve connection: resource limit exceeded
2023-01-31T15:18:17.780+0100    WARN    net/identify    identify/id.go:334      failed to identify 12D3KooWGGGVjJVMHVbo2gFDrjrD5D4zkS3HacYe8WKa753R6n5Z: Application error 0x0 (remote): conn-3326520: system: cannot reserve inbound connection: resource limit exceeded
2023-01-31T15:18:18.253+0100    WARN    net/identify    identify/id.go:334      failed to identify 12D3KooWQnyn2AtTBf6niZw7dxXBwf4EpKSLU9PsCJX3R69vEKhj: Application error 0x0 (remote): conn-1792837: system: cannot reserve connection: resource limit exceeded
2023-01-31T15:18:19.819+0100    WARN    net/identify    identify/id.go:334      failed to identify 12D3KooWRDXfwvAP17Vr2M3AW6uzA3z6WpEpGXutwDCZqXX5mgdL: Application error 0x0 (remote): conn-1120228: system: cannot reserve inbound connection: resource limit exceeded
2023-01-31T15:18:19.883+0100    WARN    net/identify    identify/id.go:334      failed to identify 12D3KooWRDXfwvAP17Vr2M3AW6uzA3z6WpEpGXutwDCZqXX5mgdL: Application error 0x0 (remote): conn-1120230: system: cannot reserve inbound connection: resource limit exceeded
2023-01-31T15:18:19.947+0100    WARN    net/identify    identify/id.go:334      failed to identify 12D3KooWRDXfwvAP17Vr2M3AW6uzA3z6WpEpGXutwDCZqXX5mgdL: Application error 0x0 (remote): conn-1120234: system: cannot reserve inbound connection: resource limit exceeded
2023-01-31T15:18:19.964+0100    WARN    net/identify    identify/id.go:334      failed to identify 12D3KooWHauNhATizMxfb3P4Gq4d9F5uroosWJCYMS2Ps1Ha7svu: Application error 0x0 (remote): conn-8736800: system: cannot reserve inbound connection: resource limit exceeded
2023-01-31T15:18:20.012+0100    WARN    net/identify    identify/id.go:334      failed to identify 12D3KooWHauNhATizMxfb3P4Gq4d9F5uroosWJCYMS2Ps1Ha7svu: Application error 0x0 (remote): conn-8736801: system: cannot reserve inbound connection: resource limit exceeded
2023-01-31T15:18:20.056+0100    WARN    net/identify    identify/id.go:334      failed to identify 12D3KooWHauNhATizMxfb3P4Gq4d9F5uroosWJCYMS2Ps1Ha7svu: Application error 0x0 (remote): conn-8736802: system: cannot reserve inbound connection: resource limit exceeded
2023-01-31T15:18:20.406+0100    WARN    net/identify    identify/id.go:334      failed to identify 12D3KooWS8ZsXHAXzKsSaEfTDHei3Smohvb6TxbiWQkxXHNgA8Ea: Application error 0x0 (remote): conn-6044774: system: cannot reserve inbound connection: resource limit exceeded
2023-01-31T15:18:20.501+0100    WARN    net/identify    identify/id.go:334      failed to identify 12D3KooWJPcvEhgDo8WLsid4LMQ8sEcxQjFMBRyEnwZzupTuYcdx: Application error 0x0 (remote): conn-680951: system: cannot reserve inbound connection: resource limit exceeded
2023-01-31T15:18:20.658+0100    WARN    net/identify    identify/id.go:334      failed to identify 12D3KooWJY8MnDTKhvokMs1ENXAKJzTTT2b2pNgaUHATrkg62ZPe: Application error 0x0 (remote): conn-625453: system: cannot reserve inbound connection: resource limit exceeded
2023-01-31T15:18:20.720+0100    WARN    net/identify    identify/id.go:334      failed to identify 12D3KooWSQw1Thc8m5FNG8rbxdGwDnGm5AFYGP8Ldniotzx1AqYQ: Application error 0x0 (remote): conn-8065151: system: cannot reserve inbound connection: resource limit exceeded
2023-01-31T15:18:20.728+0100    WARN    net/identify    identify/id.go:334      failed to identify 12D3KooWS8ZsXHAXzKsSaEfTDHei3Smohvb6TxbiWQkxXHNgA8Ea: Application error 0x0 (remote): conn-6044784: system: cannot reserve inbound connection: resource limit exceeded
2023-01-31T15:18:20.820+0100    WARN    net/identify    identify/id.go:334      failed to identify 12D3KooWBVgp3pdjGrsrdD8QV2VzPfFJcHTaQnBXqCjTd2KCjABd: Application error 0x0 (remote): conn-16918390: system: cannot reserve inbound connection: resource limit exceeded
2023-01-31T15:18:20.834+0100    WARN    net/identify    identify/id.go:334      failed to identify 12D3KooWJY8MnDTKhvokMs1ENXAKJzTTT2b2pNgaUHATrkg62ZPe: Application error 0x0 (remote): conn-625456: system: cannot reserve inbound connection: resource limit exceeded
2023-01-31T15:18:20.846+0100    WARN    net/identify    identify/id.go:334      failed to identify 12D3KooWJPcvEhgDo8WLsid4LMQ8sEcxQjFMBRyEnwZzupTuYcdx: Application error 0x0 (remote): conn-680958: system: cannot reserve inbound connection: resource limit exceeded
2023-01-31T15:18:20.939+0100    WARN    net/identify    identify/id.go:334      failed to identify 12D3KooWSQw1Thc8m5FNG8rbxdGwDnGm5AFYGP8Ldniotzx1AqYQ: Application error 0x0 (remote): conn-8065152: system: cannot reserve inbound connection: resource limit exceeded
2023-01-31T15:18:21.011+0100    WARN    net/identify    identify/id.go:334      failed to identify 12D3KooWJY8MnDTKhvokMs1ENXAKJzTTT2b2pNgaUHATrkg62ZPe: Application error 0x0 (remote): conn-625457: system: cannot reserve inbound connection: resource limit exceeded
2023-01-31T15:18:21.048+0100    WARN    net/identify    identify/id.go:334      failed to identify 12D3KooWS8ZsXHAXzKsSaEfTDHei3Smohvb6TxbiWQkxXHNgA8Ea: Application error 0x0 (remote): conn-6044792: system: cannot reserve inbound connection: resource limit exceeded
2023-01-31T15:18:21.078+0100    WARN    net/identify    identify/id.go:334      failed to identify 12D3KooWLPs5BXkqXf9G8H3xGENz9GR9a94n9st5QKC5naHnWkdA: Application error 0x0 (remote): conn-6577868: system: cannot reserve inbound connection: resource limit exceeded
2023-01-31T15:18:21.131+0100    WARN    net/identify    identify/id.go:334      failed to identify 12D3KooWLPs5BXkqXf9G8H3xGENz9GR9a94n9st5QKC5naHnWkdA: Application error 0x0 (remote): conn-6577870: system: cannot reserve inbound connection: resource limit exceeded
2023-01-31T15:18:21.157+0100    WARN    net/identify    identify/id.go:334      failed to identify 12D3KooWSQw1Thc8m5FNG8rbxdGwDnGm5AFYGP8Ldniotzx1AqYQ: Application error 0x0 (remote): conn-8065154: system: cannot reserve inbound connection: resource limit exceeded
2023-01-31T15:18:21.161+0100    WARN    net/identify    identify/id.go:334      failed to identify 12D3KooWJPcvEhgDo8WLsid4LMQ8sEcxQjFMBRyEnwZzupTuYcdx: Application error 0x0 (remote): conn-680973: system: cannot reserve inbound connection: resource limit exceeded
2023-01-31T15:18:21.185+0100    WARN    net/identify    identify/id.go:334      failed to identify 12D3KooWLPs5BXkqXf9G8H3xGENz9GR9a94n9st5QKC5naHnWkdA: Application error 0x0 (remote): conn-6577871: system: cannot reserve inbound connection: resource limit exceeded
2023-01-31T15:18:21.197+0100    WARN    net/identify    identify/id.go:334      failed to identify 12D3KooWN82wV9zpxPWMhwVJDvPV96veC7PKCzzLGkP4gYyQiNuc: Application error 0x0 (remote): conn-1606915: system: cannot reserve inbound connection: resource limit exceeded
2023-01-31T15:18:21.233+0100    WARN    net/identify    identify/id.go:334      failed to identify 12D3KooWN82wV9zpxPWMhwVJDvPV96veC7PKCzzLGkP4gYyQiNuc: Application error 0x0 (remote): conn-1606916: system: cannot reserve inbound connection: resource limit exceeded
2023-01-31T15:18:21.268+0100    WARN    net/identify    identify/id.go:334      failed to identify 12D3KooWN82wV9zpxPWMhwVJDvPV96veC7PKCzzLGkP4gYyQiNuc: Application error 0x0 (remote): conn-1606918: system: cannot reserve inbound connection: resource limit exceeded
2023-01-31T15:18:21.334+0100    WARN    net/identify    identify/id.go:334      failed to identify 12D3KooWBVgp3pdjGrsrdD8QV2VzPfFJcHTaQnBXqCjTd2KCjABd: Application error 0x0 (remote): conn-16918396: system: cannot reserve inbound connection: resource limit exceeded
2023-01-31T15:18:21.406+0100    WARN    net/identify    identify/id.go:334      failed to identify 12D3KooWGqcRsXmhprRhA8jh6gEAjkpQ28u3eGito5AbhmgmGtP7: Application error 0x0 (remote): conn-11152474: system: cannot reserve inbound connection: resource limit exceeded
2023-01-31T15:18:21.448+0100    WARN    net/identify    identify/id.go:334      failed to identify 12D3KooWGqcRsXmhprRhA8jh6gEAjkpQ28u3eGito5AbhmgmGtP7: Application error 0x0 (remote): conn-11152475: system: cannot reserve inbound connection: resource limit exceeded

Yup.

Ohh, so i should read it as "the remote hits a Resource Manager limit making a connection from me to that remote not possible" or something along those lines?

@ajnavarro
Copy link
Member

@markg85 Something like that.

Your node tried to make a connection with a remote node, and that node is hitting resource manager limits, so the default behavior is to return a resource manager error to your node.

@markg85
Copy link
Contributor

markg85 commented Jan 31, 2023

That's vague!
The error, on a surface view, looks like a local resource limitation. Is there a way to make this more verbose and helpful?

Also, i'm just going over that list of peer id's and notice something very interesting:
2x 12D3KooWQnyn2AtTBf6niZw7dxXBwf4EpKSLU9PsCJX3R69vEKhj
1x 12D3KooWGGGVjJVMHVbo2gFDrjrD5D4zkS3HacYe8WKa753R6n5Z
3x 12D3KooWRDXfwvAP17Vr2M3AW6uzA3z6WpEpGXutwDCZqXX5mgdL
3x 12D3KooWHauNhATizMxfb3P4Gq4d9F5uroosWJCYMS2Ps1Ha7svu
3x 12D3KooWS8ZsXHAXzKsSaEfTDHei3Smohvb6TxbiWQkxXHNgA8Ea
3x 12D3KooWJPcvEhgDo8WLsid4LMQ8sEcxQjFMBRyEnwZzupTuYcdx
3x 12D3KooWJY8MnDTKhvokMs1ENXAKJzTTT2b2pNgaUHATrkg62ZPe
3x 12D3KooWSQw1Thc8m5FNG8rbxdGwDnGm5AFYGP8Ldniotzx1AqYQ
2x 12D3KooWBVgp3pdjGrsrdD8QV2VzPfFJcHTaQnBXqCjTd2KCjABd
3x 12D3KooWLPs5BXkqXf9G8H3xGENz9GR9a94n9st5QKC5naHnWkdA
3x 12D3KooWN82wV9zpxPWMhwVJDvPV96veC7PKCzzLGkP4gYyQiNuc
2x 12D3KooWGqcRsXmhprRhA8jh6gEAjkpQ28u3eGito5AbhmgmGtP7

This might be stuff for a new issue, but... Kubo is dialing nodes a lot within the same second when it already knows - or can know - that the node it's going to dial has a "resource limit exceeded".

Edit
This is "clear" now though the error is really easy to interpret wrongly. The re-dialing of nodes is a feature. Somewhere else (don't know the point in code) they are put on a back off list for 10-15 minutes before trying again.

@BigLep
Copy link
Contributor

BigLep commented Feb 16, 2023

For those following this issue, driving more clarity about the "remote" log messages is happening in #9653 and libp2p/go-libp2p#1928

The latest issue trying to consolidate on the resource manager/accountant work Kubo maintainers are focused on is here: #9650

lidel pushed a commit that referenced this issue Feb 16, 2023
Being more clear that the "remote" string means its from a remote peer.
This came up in:
#9432 (comment)
#9432 (comment)
#9432 (comment)
@BigLep BigLep self-assigned this Mar 9, 2023
@BigLep
Copy link
Contributor

BigLep commented Mar 10, 2023

Kubo 0.19 RC is out which has further simplification and improvement for the libp2p resource manager/accountant. Please see https://github.com/ipfs/kubo/blob/master/docs/changelogs/v0.19.md#improving-the-libp2p-resource-management-integration and the linked dots. Feedback welcome on if users are running into any issues with 0.19RC.

@BigLep
Copy link
Contributor

BigLep commented Mar 28, 2023

Given Kubo 0.19 has been out for over week, I'm going to close this issue. Per discussion above, relevant learns have been incorporated into code fixes, error messages, and docs: https://github.com/ipfs/kubo/blob/master/docs/libp2p-resource-management.md#how-does-the-resource-manager-resourcemgr-relate-to-the-connection-manager-connmgr

@BigLep BigLep closed this as completed Mar 28, 2023
@SgtPooki
Copy link
Member

SgtPooki commented Apr 2, 2023

I am trying to see limits because i'm getting errors on webtransport testing:

╰─ ✘ 1 ❯ ipfs swarm stats --help
WARNING:   EXPERIMENTAL, command may change in future releases

USAGE
  ipfs swarm stats <scope> - Report resource usage for a scope.

SYNOPSIS
  ipfs swarm stats [--min-used-limit-perc=<min-used-limit-perc>] [--] <scope>

ARGUMENTS

  <scope> - scope of the stat report

OPTIONS

  --min-used-limit-perc  int - Only display resources that are using above the specified percentage of their respective limit.

DESCRIPTION

  Report resource usage for a scope.
  The scope can be one of the following:
  - system        -- reports the system aggregate resource usage.
  - transient     -- reports the transient resource usage.
  - svc:<service> -- reports the resource usage of a specific service.
  - proto:<proto> -- reports the resource usage of a specific protocol.
  - peer:<peer>   -- reports the resource usage of a specific peer.
  - all           -- reports the resource usage for all currently active scopes.

  The output of this command is JSON.

  To see all resources that are close to hitting their respective limit, one can do something like:
    ipfs swarm stats --min-used-limit-perc=90 all


╭─    ~/code/work/protocol.ai/ipfs/kubo    master !2 ?6 ────────────────────────────────────────────────────────────────────────────────────────────── ▼  2.30.3 ▼  1.19   1.19   01:43:15  ─╮
╰─ ✘ INT ❯ ipfs swarm stats --min-used-limit-perc=90 all
Error: Command not found.
Use 'ipfs swarm stats --help' for information about this command

╭─    ~/code/work/protocol.ai/ipfs/kubo    master !2 ?6 ─────────────────────────────────────────────────────────────────────────────────────── 7s   ▼  2.30.3 ▼  1.19   1.19   01:39:47  ─╮
╰─ ✔ ❯ ipfs swarm stats system
Error: Command not found.
Use 'ipfs swarm stats --help' for information about this command

╭─    ~/code/work/protocol.ai/ipfs/kubo    master !2 ?6 ────────────────────────────────────────────────────────────────────────────────────────────── ▼  2.30.3 ▼  1.19   1.19   01:42:42  ─╮
╰─ ✘ 1 ❯ ipfs swarm stats transient
Error: Command not found.
Use 'ipfs swarm stats --help' for information about this command

@SgtPooki SgtPooki reopened this Apr 2, 2023
@SgtPooki
Copy link
Member

SgtPooki commented Apr 2, 2023

the command seems to be ipfs swarm resources now, and throws the following error when trying to set resourceMgr limits now:

ipfs config --json Swarm.ResourceMgr.Limits.Transient.StreamsInbound 1000
Error: failed to set config value: failure to decode config: The Swarm.ResourceMgr.Limits configuration has been removed in Kubo 0.19 and should be empty or not present. To set custom libp2p limits, read https://github.com/ipfs/kubo/blob/master/docs/libp2p-resource-management.md#user-supplied-override-limits (maybe use --json?)

@SgtPooki SgtPooki closed this as completed Apr 2, 2023
@Jorropo
Copy link
Contributor

Jorropo commented Apr 3, 2023

@SgtPooki this is correct, see:

The Swarm.ResourceMgr.Limits configuration has been removed in Kubo 0.19 and should be empty or not present. To set custom libp2p limits, read https://github.com/ipfs/kubo/blob/master/docs/libp2p-resource-management.md#user-supplied-override-limits

json Swarm.ResourceMgr.Limits has been removed in 0.19

@SgtPooki
Copy link
Member

SgtPooki commented Apr 3, 2023

@Jorropo is there something better we can link to? there is not enough info there for me to set up any resource manager limits with confidence.

--- edit:
more specifically that

This is done by defining limits in $IPFS_PATH/libp2p-resource-limit-overrides.json. These values trump anything else and are parsed directly by go-libp2p. (See the go-libp2p Resource Manager README for formatting.)

is not helpful. the go-libp2p docs don't mention how to configure a json file at all, but kubo tells me to do so

@Jorropo
Copy link
Contributor

Jorropo commented Apr 4, 2023

@SgtPooki I don't know how we could improve the docs, basically you just have to move jq .Swarm.ResourceMgr.Limits < $IPFS_PATH/config > $IPFS_PATH/limits.json. If you had any ideas that would be awesome.

I think I'm not seeing the problem here because I know too much on how a golang struct maps to json using encoding/json.

@polus-arcticus
Copy link

polus-arcticus commented Sep 17, 2023

@Jorropo

@SgtPooki I don't know how we could improve the docs, basically you just have to move jq .Swarm.ResourceMgr.Limits < $IPFS_PATH/config > $IPFS_PATH/limits.json. If you had any ideas that would be awesome.

I think I'm not seeing the problem here because I know too much on how a golang struct maps to json using encoding/json.

Coming at this from outside golang and kubo. To begin when i echo $IPFS_PATH it doesn't return with anything, so it wasn't clear to add this json file in the same place the config file is at (in my case .ipfs/)
secondly the structure of the json is unclear, i was looking for a default schema for $IPFS_PATH/libp2p-resource-limit-overrides.json` which i couldn't find, its not clear begin with Limits : {} or ResourceMgsr: { Limits: ...}} or Swarm: { Limits: { ...}}}

in debug the docs suggest to use ipfs swarm resources to get the limits but returns Error: missing ResourceMgr: make sure the daemon is running with Swarm.ResourceMgr.Enabled attempts to enable it hit the json Swarm.ResourceMgr.Limits has been removed in 0.19 as its inside Swarm.ResourceMgr.Enabled

Confidance is important as when i perform as you describe, i still get the connect limit exceeded error, so i dont know if its a config issue or some deeper issue with kubo

🥂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug A bug in existing code (including security flaws) P1 High: Likely tackled by core team if no one steps up
Projects
No open projects
Archived in project
Development

No branches or pull requests