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.44k stars 338 forks source link

Badly formatted log #4632

Open ldeffenb opened 3 months ago

ldeffenb commented 3 months ago

Context

2.0.0

Summary

While uploading with deferred, pinned uploads using the /bytes API, I see the following log:

"time"="2024-04-03 15:06:18.444457" "level"="error" "logger"="node/pusher" "msg"="pusher: failed reporting chunk" "error"="reporter.Report: failed to read uploadItem UploadItem/N\xa1\x8e\x1b\x0f傘\x86i'\x93%5M\xfd\x866\x9d˽\xf6\x1f\xb97D\xf1\xf4\xa6U\x18_/\xcfZ\xb2\xdb?\x83n\xb8\u05cd\xcf\xc3\xf5\xe2\x1a\xb5\x10\xc1^\xe6'\xe5\x9d{\xea5{\n\x127]A: storage: not found"

Looks like the chunk ID is not properly formatted?

Expected behavior

I would expect the chunk ID to be readable, regardless of why this log is occurring.

Actual behavior

See log above.

Steps to reproduce

Not sure what causes the underlying failure, but I'm just uploading lots of files with the /bytes API with pinning and deferred upload options set.

Possible solution

Fix the source of the err for the log at: https://github.com/ethersphere/bee/blob/501f8a4ef9caddd2d080829270a77cdd67cf1573/pkg/pusher/pusher.go#L286

I think the actual error is formatted at: https://github.com/ethersphere/bee/blob/501f8a4ef9caddd2d080829270a77cdd67cf1573/pkg/storer/internal/upload/uploadstore.go#L631

but ui is an uploadItem structure that apparently doesn't have a good toString() implementation?

ldeffenb commented 1 month ago

One possible fix would be: return fmt.Errorf("failed to read uploadItem %s: %w", ui.Address, err) By referencing just the address component, it is properly formatted. But that still ignores the BatchID of the uploadItem structure key.