Commit Graph

219 Commits

Author SHA1 Message Date
Henrique Dias
c178c51835
fix: deadlock on retrieving WebTransport addresses (#9857)
Co-authored-by: Marco Polo <git@marcopolo.io>
2023-05-08 16:11:03 +02:00
Gus Eggert
4ca36c41b6
fix: use default HTTP routers when FullRT DHT client is used (#9841) 2023-05-01 15:29:34 -04:00
Gus Eggert
0e55ca9377 feat: add experimental optimistic provide
This adds the ability to enable "optimistic provide" to the default
DHT client, which enables faster provides and reprovides.

For more information about optimistic provide, see:

https://protocollabs.notion.site/Optimistic-Provide-2c79745820fa45649d48de038516b814

Note that this feature only works when using non-custom router
types. This does not include the ability to enable optimistic provide
on custom routers for now, to minimize the footprint of this
experimental feature. We intend on continuing to test this and improve
the UX, which may or may not involve adding configuration for it to
custom routers. We also plan on refactoring/redesigning custom routers
more broadly so I don't want this to add more effort for maintainers
and confusion for users.
2023-04-06 16:49:46 -04:00
Hector Sanjuan
027c5b1a09
feat: allow injecting custom path resolvers (#9750)
In order to make it possible to easily-overwrite the path Resolvers (i.e. via
plugins), this creates resolvers as part of the Node rather than creating them
ad-hoc.
2023-04-04 18:11:32 +00:00
Gus Eggert
a09c8df24d
fix: remove timeout on default DHT operations (#9783)
* fix: remove timeout on default DHT operations

This removes the timeout by default for DHT operations. In particular
this causes issues with ProvideMany requests which can take an
indeterminate amount of time, but really these should just respect
context timeouts by default. Users can still specify timeouts here if
they want, but by default they will be set to "0" which means "no
timeout".

This is unlikely to break existing users of custom routing, because
there was previously no utility in configuring a router with timeout=0
because that would cause the router to immediately fail, so it is
unlikely (and incorrect) if anybody was using timeout=0.

* fix: remove 5m timeout on ProvideManyRouter

For context see
5fda291b66

---------

Co-authored-by: Marcin Rataj <lidel@lidel.org>
2023-03-30 16:08:43 -04:00
Adin Schmahmann
353dd49be2
refactor: switch gateway code to new API from go-libipfs (#9681)
Co-authored-by: Marcin Rataj <lidel@lidel.org>
Co-authored-by: Henrique Dias <hacdias@gmail.com>
2023-03-30 13:20:37 +00:00
Jorropo
3ab1086f71 chore: migrate go-libipfs to boxo
Resolves #9677, #9676, #9675, #9736
2023-03-28 22:05:25 -04:00
Jorropo
a3b417779c fix: future proof with > rcmgr.DefaultLimit for new enum rcmgr values 2023-03-16 13:41:24 +01:00
Jorropo
e870dcdc0e fix: preserve Unlimited StreamsInbound in connmgr reconciliation
Fixes #9695
2023-03-16 13:41:24 +01:00
Gus Eggert
0d94bac30c feat: add "autoclient" routing type
This routing type is the same as "auto" but it creates the DHT in
"client" mode and hence does not start a DHT server.
2023-03-09 08:18:14 -05:00
Jorropo
7986196414 feat: Reduce RM code footprint
Co-Authored-By: Antonio Navarro Perez <antnavper@gmail.com>
2023-03-06 12:46:58 +01:00
Marten Seemann
a3366c522a
chore: update go-libp2p to v0.26 (#9656)
Co-authored-by: Henrique Dias <hacdias@gmail.com>
2023-02-24 10:34:10 +01:00
Jorropo
0ff406170d fix: update rcmgr for go-libp2p v0.25 2023-02-14 22:19:46 +01:00
Marten Seemann
a00f5cae23 chore: update go-libp2p to v0.25.1 2023-02-14 22:19:46 +01:00
Antonio Navarro Perez
633c497f63 Adjust inbound connection limits depending on memory. 2023-01-30 11:01:03 +01:00
Jorropo
b3c98bb085 chore: bump go-libipfs remove go-bitswap 2023-01-27 23:07:01 +01:00
Mohsin Zaidi
9652f24f6c
feat: Pubsub.SeenMessagesStrategy (#9543)
* feat: expire messages from the cache based on last seen time
* docs: Pubsub.SeenMessagesStrategy

Ref. https://github.com/libp2p/go-libp2p-pubsub/pull/513

Co-authored-by: Marcin Rataj <lidel@lidel.org>
2023-01-27 00:24:35 +01:00
Steve Loeppky
9327ee64ce
fix: clarity: no user supplied rcmgr limits of 0 (#9563)
Co-authored-by: Antonio Navarro Perez <antnavper@gmail.com>
Co-authored-by: Marcin Rataj <lidel@lidel.org>
2023-01-22 20:04:18 +01:00
Jorropo
8328bab28d fix: ensure connmgr is smaller then autoscalled ressource limits
Fixes #9545
2023-01-20 19:25:38 +01:00
Jorropo
b84cd11566
fix: typo in ensureConnMgrMakeSenseVsResourcesMgr 2023-01-20 15:29:54 +01:00
Jorropo
73ebad1892 fix: refuse to start if connmgr is smaller than ressource limits and not using none connmgr
Fixes: #9548
2023-01-19 01:40:48 +01:00
Antonio Navarro Perez
3bc9b675a0
fix: stats dht command when Routing.Type=auto (#9538)
Fixes default auto mode, but Routing.Type=custom needs more work.
Continued in https://github.com/ipfs/kubo/issues/9482
2023-01-13 00:38:38 +01:00
Antonio Navarro Perez
8cdc86d8c4 fix: disable provide over HTTP with Routing.Type=auto (#9511)
Closes https://github.com/ipfs/kubo/issues/9504
2023-01-04 13:56:15 +01:00
Jorropo
e927dc8e59 fix: correct libp2p transports TODO comments 2022-12-12 22:26:48 +01:00
Jorropo
16d189b8b8 feat: turn on WebTransport by default
Fixes #9292
2022-12-12 21:56:55 +01:00
Jorropo
f08b439d48 update go-libp2p to v0.24.0 2022-12-12 03:47:17 +01:00
Marcin Rataj
70e604ff99
feat: Routing.Type=auto (DHT+IPNI) (#9475)
This changes the default routing to use both DHT and IPNI
at the same time. Closes #9454 Closes #9422

Full context:
https://github.com/ipfs/kubo/issues/9454
https://github.com/ipfs/kubo/issues/9422

Co-authored-by: Steve Loeppky <biglep@protocol.ai>
Co-authored-by: Gus Eggert <gus@gus.dev>
Co-authored-by: Steve Loeppky <biglep@protocol.ai>
2022-12-08 23:20:24 +01:00
Mikel Cortes
72bad5c060
feat: increase default Reprovider.Interval (#9326)
* increase republish interval based on RFM17
* refactor(config): switch to implicit default

Co-authored-by: Marcin Rataj <lidel@lidel.org>
2022-12-08 21:28:40 +01:00
Steve Loeppky
01e0bfa359
docs: libp2p resource management (#9468)
Co-authored-by: Antonio Navarro Perez <antnavper@gmail.com>
Co-authored-by: Marcin Rataj <lidel@lidel.org>
2022-12-08 16:18:04 +01:00
Antonio Navarro Perez
9662c8e3f9 Fix sharness test
Signed-off-by: Antonio Navarro Perez <antnavper@gmail.com>
2022-12-07 18:30:21 +01:00
Antonio Navarro Perez
be9539db03 Added a message when RM is disabled.
Signed-off-by: Antonio Navarro Perez <antnavper@gmail.com>
2022-12-07 18:30:21 +01:00
Antonio Navarro Perez
a54cf2a95a Requested changes.
Signed-off-by: Antonio Navarro Perez <antnavper@gmail.com>
2022-12-07 18:30:21 +01:00
Antonio Navarro Perez
67886f7bd3 Fix: RM: Improve init RM message and fix final memory value.
Signed-off-by: Antonio Navarro Perez <antnavper@gmail.com>
2022-12-07 18:30:21 +01:00
Antonio Navarro Perez
d16e63a23e Fix: Resource Manager: Filter stats correctly by %
Signed-off-by: Antonio Navarro Perez <antnavper@gmail.com>
2022-12-07 18:05:15 +01:00
Antonio Navarro Perez
7a8639ee33 Apply suggestions from code review
Co-authored-by: Steve Loeppky <biglep@protocol.ai>
2022-12-07 16:47:37 +01:00
Antonio Navarro Perez
22a03bda6d Increase MaxMemory param to use half of total memory.
Previously it was using 1/8 of the total memory.

Signed-off-by: Antonio Navarro Perez <antnavper@gmail.com>
2022-12-07 16:47:37 +01:00
Antonio Navarro Perez
df828c0a47 feature: delegated-routing: Add HTTP delegated routing.
Signed-off-by: Antonio Navarro Perez <antnavper@gmail.com>
2022-12-07 16:34:59 +01:00
Antonio Navarro Perez
4587d1c1cb Fix: Change RM log output to WARN level
Signed-off-by: Antonio Navarro Perez <antnavper@gmail.com>
2022-12-07 16:30:43 +01:00
Antonio Navarro Perez
96bbd53033 Fix: RM: Set no-limit value to 1e9 (1000000000).
Added a comment next to the value to make possible to people to grep
over the code and find where that value is set.

Signed-off-by: Antonio Navarro Perez <antnavper@gmail.com>
2022-12-07 15:56:41 +01:00
Marcin Rataj
5047c02d9a fix: apply agent-version-suffix to libp2p identify
Closes #9456
2022-12-06 12:52:54 +01:00
Marcin Rataj
09765951ea fix(rcmgr): improve error phrasing
limits were not exceeded, manager protects us from that
https://github.com/ipfs/kubo/issues/9432#issuecomment-1334160936
2022-12-02 11:13:42 +01:00
Mohsin Zaidi
51f60ea05a
feat(config): Pubsub.SeenMessagesTTL (#9372)
Co-authored-by: Marcin Rataj <lidel@lidel.org>
2022-11-29 00:05:44 +01:00
Steve Loeppky
83034d840c Doc improvements and changelog for resource manager (#9413)
Co-authored-by: Antonio Navarro Perez <antnavper@gmail.com>
2022-11-16 13:09:12 +01:00
Lucas Molas
65365192f7 refactor(config): remove Swarm.ConnMgr defaults
This moves defaults to Kubo code, cleaning up config.
If value is in config, we assume it is an explicit choice made by user.
Makes migrations easier.
2022-11-15 21:34:38 +01:00
Antonio Navarro Perez
dfa631e841 Apply go fmt
Signed-off-by: Antonio Navarro Perez <antnavper@gmail.com>
2022-11-15 18:43:44 +01:00
Antonio Navarro Perez
4bff042036 Update core/node/libp2p/rcmgr_defaults.go
Co-authored-by: Steve Loeppky <biglep@protocol.ai>
2022-11-15 18:43:44 +01:00
Antonio Navarro Perez
377d4e9938 Remove limitation by HighWater param.
Signed-off-by: Antonio Navarro Perez <antnavper@gmail.com>
2022-11-15 18:43:44 +01:00
Antonio Navarro Perez
fb42b53f58 Fix RM errors when acceleratedDHT is active
Signed-off-by: Antonio Navarro Perez <antnavper@gmail.com>
2022-11-15 18:43:44 +01:00
Antonio Navarro Perez
254d81a9d5
feat: Improve ResourceManager UX (#9338)
This PR adds several new functionalities to make easier the usage of ResourceManager:

- Now resource manager logs when resources are exceeded are on ERROR instead of warning.
- The resources exceeded error now shows what kind of limit was reached and the scope.
- When there was no limit exceeded, we print a message for the user saying that limits are not exceeded anymore.
- Added `swarm limit all` command to show all set limits with the same format as `swarm stats all`
- Added `min-used-limit-perc` option to `swarm stats all` to only show stats that are above a specific percentage
- Simplify a lot default values.
- **Enable ResourceManager by default.**

Output example:
```
2022-11-09T10:51:40.565+0100    ERROR   resourcemanager libp2p/rcmgr_logging.go:59      Consider inspecting logs and raising the resource manager limits. Documentation: https://github.com/ipfs/kubo/blob/master/docs/config.md#swarmresourcemgr
2022-11-09T10:51:50.565+0100    ERROR   resourcemanager libp2p/rcmgr_logging.go:55      Resource limits were exceeded 483095 times with error "transient: cannot reserve inbound stream: resource limit exceeded".
2022-11-09T10:51:50.565+0100    ERROR   resourcemanager libp2p/rcmgr_logging.go:59      Consider inspecting logs and raising the resource manager limits. Documentation: https://github.com/ipfs/kubo/blob/master/docs/config.md#swarmresourcemgr
2022-11-09T10:52:00.565+0100    ERROR   resourcemanager libp2p/rcmgr_logging.go:55      Resource limits were exceeded 455294 times with error "transient: cannot reserve inbound stream: resource limit exceeded".
2022-11-09T10:52:00.565+0100    ERROR   resourcemanager libp2p/rcmgr_logging.go:59      Consider inspecting logs and raising the resource manager limits. Documentation: https://github.com/ipfs/kubo/blob/master/docs/config.md#swarmresourcemgr
2022-11-09T10:52:10.565+0100    ERROR   resourcemanager libp2p/rcmgr_logging.go:55      Resource limits were exceeded 471384 times with error "transient: cannot reserve inbound stream: resource limit exceeded".
2022-11-09T10:52:10.565+0100    ERROR   resourcemanager libp2p/rcmgr_logging.go:59      Consider inspecting logs and raising the resource manager limits. Documentation: https://github.com/ipfs/kubo/blob/master/docs/config.md#swarmresourcemgr
2022-11-09T10:52:20.565+0100    ERROR   resourcemanager libp2p/rcmgr_logging.go:55      Resource limits were exceeded 8 times with error "peer:12D3KooWKqcaBtcmZKLKCCoDPBuA6AXGJMNrLQUPPMsA5Q6D1eG6: cannot reserve inbound stream: resource limit exceeded".
2022-11-09T10:52:20.565+0100    ERROR   resourcemanager libp2p/rcmgr_logging.go:55      Resource limits were exceeded 192 times with error "peer:12D3KooWPjetWPGQUih9LZTGHdyAM9fKaXtUxDyBhA93E3JAWCXj: cannot reserve inbound stream: resource limit exceeded".
2022-11-09T10:52:20.565+0100    ERROR   resourcemanager libp2p/rcmgr_logging.go:55      Resource limits were exceeded 469746 times with error "transient: cannot reserve inbound stream: resource limit exceeded".
2022-11-09T10:52:20.565+0100    ERROR   resourcemanager libp2p/rcmgr_logging.go:59      Consider inspecting logs and raising the resource manager limits. Documentation: https://github.com/ipfs/kubo/blob/master/docs/config.md#swarmresourcemgr
2022-11-09T10:52:30.565+0100    ERROR   resourcemanager libp2p/rcmgr_logging.go:55      Resource limits were exceeded 484137 times with error "transient: cannot reserve inbound stream: resource limit exceeded".
2022-11-09T10:52:30.565+0100    ERROR   resourcemanager libp2p/rcmgr_logging.go:55      Resource limits were exceeded 29 times with error "peer:12D3KooWPjetWPGQUih9LZTGHdyAM9fKaXtUxDyBhA93E3JAWCXj: cannot reserve inbound stream: resource limit exceeded".
2022-11-09T10:52:30.565+0100    ERROR   resourcemanager libp2p/rcmgr_logging.go:59      Consider inspecting logs and raising the resource manager limits. Documentation: https://github.com/ipfs/kubo/blob/master/docs/config.md#swarmresourcemgr
2022-11-09T10:52:40.565+0100    ERROR   resourcemanager libp2p/rcmgr_logging.go:55      Resource limits were exceeded 468843 times with error "transient: cannot reserve inbound stream: resource limit exceeded".
2022-11-09T10:52:40.566+0100    ERROR   resourcemanager libp2p/rcmgr_logging.go:59      Consider inspecting logs and raising the resource manager limits. Documentation: https://github.com/ipfs/kubo/blob/master/docs/config.md#swarmresourcemgr
2022-11-09T10:52:50.566+0100    ERROR   resourcemanager libp2p/rcmgr_logging.go:55      Resource limits were exceeded 366638 times with error "transient: cannot reserve inbound stream: resource limit exceeded".
2022-11-09T10:52:50.566+0100    ERROR   resourcemanager libp2p/rcmgr_logging.go:59      Consider inspecting logs and raising the resource manager limits. Documentation: https://github.com/ipfs/kubo/blob/master/docs/config.md#swarmresourcemgr
2022-11-09T10:53:00.566+0100    ERROR   resourcemanager libp2p/rcmgr_logging.go:55      Resource limits were exceeded 405526 times with error "transient: cannot reserve inbound stream: resource limit exceeded".
2022-11-09T10:53:00.566+0100    ERROR   resourcemanager libp2p/rcmgr_logging.go:55      Resource limits were exceeded 107 times with error "peer:12D3KooWQZQCwevTDGhkE9iGYk5sBzWRDUSX68oyrcfM9tXyrs2Q: cannot reserve inbound stream: resource limit exceeded".
2022-11-09T10:53:00.566+0100    ERROR   resourcemanager libp2p/rcmgr_logging.go:59      Consider inspecting logs and raising the resource manager limits. Documentation: https://github.com/ipfs/kubo/blob/master/docs/config.md#swarmresourcemgr
2022-11-09T10:53:10.566+0100    ERROR   resourcemanager libp2p/rcmgr_logging.go:55      Resource limits were exceeded 336923 times with error "transient: cannot reserve inbound stream: resource limit exceeded".
2022-11-09T10:53:10.566+0100    ERROR   resourcemanager libp2p/rcmgr_logging.go:59      Consider inspecting logs and raising the resource manager limits. Documentation: https://github.com/ipfs/kubo/blob/master/docs/config.md#swarmresourcemgr
2022-11-09T10:53:20.565+0100    ERROR   resourcemanager libp2p/rcmgr_logging.go:55      Resource limits were exceeded 71 times with error "transient: cannot reserve inbound stream: resource limit exceeded".
2022-11-09T10:53:20.565+0100    ERROR   resourcemanager libp2p/rcmgr_logging.go:59      Consider inspecting logs and raising the resource manager limits. Documentation: https://github.com/ipfs/kubo/blob/master/docs/config.md#swarmresourcemgr
2022-11-09T10:53:30.565+0100    ERROR   resourcemanager libp2p/rcmgr_logging.go:64      Resrouce limits are no longer being exceeded.

```
## Validation tests

- Accelerated DHT client runs with no errors when ResourceManager is active. No problems were observed.
- Running an attack with 200 connections and 1M streams using yamux protocol. Node was usable during the attack. With ResourceManager deactivated, the node was killed by the OS because of the amount of memory consumed.
	- Actions done when the attack was active:
		- Add files 
		- Force a reprovide
		- Use the gateway to resolve an IPNS address.

It closes #9001 
It closes #9351
It closes #9322
2022-11-10 12:25:57 +01:00
Ian Davis
066a0b9cab
feat: remove provider delay interval in bitswap (#9053)
* feat: remove provider delay interval in bitswap

* Use a non-zero provider search delay

* Add ProviderSearchDelay to Internal.Bitswap config

* Revert bitswap provider delay to 1s
2022-10-13 06:43:29 +02:00