bee icon indicating copy to clipboard operation
bee copied to clipboard

fix: check if reserve is configured

Open acha-bill opened this issue 1 year ago • 1 comments

Checklist

  • [x] I have read the coding guide.
  • [ ] My change requires a documentation update, and I have done it.
  • [ ] I have added tests to cover my changes.
  • [ ] I have filled out the description and linked the related issues.

Description

Check if reserve is configured before attempting to put chunk

Related Issue (Optional)

#4829

acha-bill avatar Sep 25 '24 17:09 acha-bill

this is not a real solution, i think. we need to first understand why the reserve is nil. Chances are this is a light node and it was unable to find a peer to push the chunk to so it tried storing it. In that case, we need to plug that hole, where a light node should not try to store a chunk in the above scenario. but this is one theory. we need to ask the issue creator the config options he was running with before hastily jumping onto a solution.

istae avatar Oct 08 '24 22:10 istae

I also got this from this failed beekeeper test

[pod/bootnode-0-0/bee] "time"="2024-10-21 06:07:39.750144" "level"="debug" "logger"="node/pusher" "v"=1 "msg"="chunk stays here, i'm the closest node" "chunk_address"="d43711cd5b3436c09ef09cb4e554eba026719af857220febc41f1db9fa311602"
[pod/bootnode-0-0/bee] panic: runtime error: invalid memory address or nil pointer dereference
[pod/bootnode-0-0/bee] [signal SIGSEGV: segmentation violation code=0x1 addr=0x50 pc=0xf33756]
[pod/bootnode-0-0/bee] 
[pod/bootnode-0-0/bee] goroutine 2528 [running]:
[pod/bootnode-0-0/bee] github.com/ethersphere/bee/v2/pkg/storer/internal/reserve.(*Reserve).Put(0x0, {0x1a55ca0, 0xc0043c9470}, {0x1a64ba0, 0xc004684870})
[pod/bootnode-0-0/bee] 	github.com/ethersphere/bee/v2/pkg/storer/internal/reserve/reserve.go:104 +0x76
[pod/bootnode-0-0/bee] github.com/ethersphere/bee/v2/pkg/storer.(*DB).ReservePutter.func1({0x1a55ca0?, 0xc0043c9470?}, {0x1a64ba0, 0xc004684870})
[pod/bootnode-0-0/bee] 	github.com/ethersphere/bee/v2/pkg/storer/reserve.go:300 +0x53
[pod/bootnode-0-0/bee] github.com/ethersphere/bee/v2/pkg/storage.PutterFunc.Put(0x4ed33c?, {0x1a55ca0?, 0xc0043c9470?}, {0x1a64ba0?, 0xc004684870?})
[pod/bootnode-0-0/bee] 	github.com/ethersphere/bee/v2/pkg/storage/chunkstore.go:56 +0x37
[pod/bootnode-0-0/bee] github.com/ethersphere/bee/v2/pkg/storer.putterWithMetrics.Put({{0x1a486c0, 0xc003b07470}, {{0xc0008c74d0}, {0xc0008c7560}, {0x1a641a8, 0xc0008ec340}, {0x1a641a8, 0xc0008ec3c0}, {0x1a5bf18, 0xc0008f8240}, ...}, ...}, ...)
[pod/bootnode-0-0/bee] 	github.com/ethersphere/bee/v2/pkg/storer/metrics.go:181 +0xb4
[pod/bootnode-0-0/bee] github.com/ethersphere/bee/v2/pkg/pusher.(*Service).pushDirect(0xc0008e84e0, {0x1a55ca0, 0xc0043c9470}, {0x1a64008, 0xc00137c730}, 0xc0043c9440)
[pod/bootnode-0-0/bee] 	github.com/ethersphere/bee/v2/pkg/pusher/pusher.go:321 +0x372
[pod/bootnode-0-0/bee] github.com/ethersphere/bee/v2/pkg/pusher.(*Service).chunksWorker.func2(0xc0043c9440)
[pod/bootnode-0-0/bee] 	github.com/ethersphere/bee/v2/pkg/pusher/pusher.go:161 +0x1f4
[pod/bootnode-0-0/bee] created by github.com/ethersphere/bee/v2/pkg/pusher.(*Service).chunksWorker in goroutine 300
[pod/bootnode-0-0/bee] 	github.com/ethersphere/bee/v2/pkg/pusher/pusher.go:230 +0x619

Config

  • full node mode: true
  • bootnode-mode: true

The reverse is not configured because https://github.com/ethersphere/bee/blob/0e42d83eecfbeaa764ee8004ea402b78b8293147/pkg/node/node.go#L730

But the pushsync only uses o.fullNodeMode https://github.com/ethersphere/bee/blob/0e42d83eecfbeaa764ee8004ea402b78b8293147/pkg/node/node.go#L953

https://github.com/ethersphere/bee/blob/0e42d83eecfbeaa764ee8004ea402b78b8293147/pkg/pushsync/pushsync.go#L401-L406

So initializing pushsync consistently with o.FullNodeMode && !o.BootnodeMode should fix it

acha-bill avatar Oct 21 '24 11:10 acha-bill

does that mean that an upload was attempted from a bootnode?

istae avatar Oct 21 '24 13:10 istae

does that mean that an upload was attempted from a bootnode?

yes. See https://github.com/ethersphere/bee/actions/runs/11434065514/job/31807011143

msg="soc: submitting soc chunk xx to node bootnode-0"

Please can you confirm that the reserve is not used in earlier places?

I don't see any other place. The stack trace indicates that the receiver is nil.

(*Reserve).Put(0x0,....)

acha-bill avatar Oct 21 '24 13:10 acha-bill