ethersphere / bee

Bee is a Swarm client implemented in Go. It’s the basic building block for the Swarm network: a private; decentralized; and self-sustaining network for permissionless publishing and access to your (application) data.
https://www.ethswarm.org
BSD 3-Clause "New" or "Revised" License
1.46k stars 338 forks source link

libp2p blocking fails at syncing #4833

Open nugaon opened 1 month ago

nugaon commented 1 month ago

⚠️ Support requests in an issue-format will be closed immediately. For support, go to Swarm's Discord.

Context

I'm testing out GSOC functionality which uses fdp-play for environment (5 nodes network).

Related logs

"time"="2024-09-20 14:29:32.265097" "level"="debug" "logger"="node/libp2p" "msg"="blocklist: could not blocklist peer" "peer_id"="Qmexzx5TQexfw1zeNsr3zPX8wPEqTfAVSAzxZN29urfEdD" "error"="cannot blocklist peer when network not available"
"time"="2024-09-20 14:29:32.265113" "level"="error" "logger"="node/libp2p" "msg"="unable to blocklist peer" "peer_id"="Qmexzx5TQexfw1zeNsr3zPX8wPEqTfAVSAzxZN29urfEdD"
"time"="2024-09-20 14:29:32.265122" "level"="debug" "logger"="node/libp2p" "msg"="handle protocol failed" "protocol"="pushsync" "version"="1.3.0" "stream"="pushsync" "peer"="
676790fcae312292ffc17b7f7c84d5b9acc51ef0ea3f27d0ff3bada3362abc5d" "error"="unexpected request while in light mode"
"time"="2024-09-20 14:29:32.265239" "level"="debug" "logger"="node/libp2p" "msg"="blocklist: could not blocklist peer" "peer_id"="QmdRzETjLwPReW134dbG9hfCure8RELWTESyfQpeG3iCm7" "error"="cannot blocklist peer when network not available"

also at pull sync

"time"="2024-09-20 14:54:48.866819" "level"="debug" "logger"="node/libp2p" "msg"="blocklist: could not blocklist peer" "peer_id"="QmdRzETjLwPReW134dbG9hfCure8RELWTESyfQpeG3iCm7" "error"="cannot blocklist peer when network not available"
"time"="2024-09-20 14:54:48.866854" "level"="error" "logger"="node/libp2p" "msg"="unable to blocklist peer" "peer_id"="QmdRzETjLwPReW134dbG9hfCure8RELWTESyfQpeG3iCm7"
"time"="2024-09-20 14:54:48.866876" "level"="debug" "logger"="node/libp2p" "msg"="handle protocol failed" "protocol"="pullsync" "version"="1.4.0" "stream"="cursors" "peer"="48013b5c5142e482759f08ef60057b4bbb7cb2e77790b44e3f06b235493347d4" "error"="unexpected request while in light mode"

Summary

Even though swarm-cli status gives back Mode: full - as expected based on the Bee configuration as well -, libp2p assumes it as a light node.

It tries to blocklist peers but it cannot and refers to some network availability issue.

Eventually, the chunks push seems successful since the API request returns with 201.

Expected behavior

Bee does blocklist when it wants to.

Actual behavior

It fails blocklisting.

Steps to reproduce

Run FDP Play and push chunks.

Possible solution

acha-bill commented 19 hours ago

The linked PR fixes the blocklist issue but the "unexpected request while in light mode" error is expected.

The queen node is bootnode mode. bee printconfig from the docker container returns

# cause the node to always accept incoming connections
bootnode-mode: "true"

When in bootnode mode (or light mode), bee will replace the p2p stream handlers with an always erroring handler. (error above) https://github.com/ethersphere/bee/blob/0e42d83eecfbeaa764ee8004ea402b78b8293147/pkg/node/node.go#L974-L984 You can also see this from the logs

"level"="info" "logger"="node" "msg"="starting in light mode"