You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Uploading a single file with /bzz or /bytes (at least) twice with the pinning option fails the second time with a 500 error. Details below.
Expected behavior
Uploading a file multiple times should successfully return the same reference each time, regardless of pinned or not. It works on subsequent uploads if pinning is not requested.
Actual behavior
The first upload succeeds and provides the reference. Subsequent attempts with pinning fail with 500.
Simply upload a single file twice with the pinning option. It fails on /bzz (in this example) as well as with /bytes with a single content. swarm-cli upload 12-2442-1805.png --bee-api-url http://192.168.10.38:1633 --bee-debug-api-url http://192.168.10.38:1635 --curl
Possible solution
This problem was introduced in the fix for #4558 The issue is that the error is returned from Close() which is properly recognized and causes Cleanup() to be invoked. But since an error came from Close(), the upload believes it has failed. My solution is to detect the duplicate pin in Close() and directly invoke Cleanup and prevent that specific error from being visible to the upload, allowing it to properly succeed. This makes sense because technically the pin Close() succeeded and it should not rely on the original invoker to come back into Cleanup().
Note that I further suspect that there's still an issue coming up with pinning of duplicate uploads of root chunks when various redundancy options are selected. In my earlier testing, uploading a small (<4KB) chunk of data with /bytes with pinning and various redundancy options properly returned the same single reference. But if the pins were examined closely (or more detailed logs around the uploading pinning activity), the dispersed replica SOC references were also included in the pin. With the current DuplicatePinCollection detection, only the first upload set of chunks would actually be pinned and subsequent differing redundancy uploads of the same chunk of data would actually not end up pinning the replica SOCs. I haven't thought of a solution for this issue yet (aside from trying to merge the pinned chunks between the original and new pin instead of deleting the new pin (or is it the original pin that gets cleaned up?)), but please don't hold off on fixing this issue until that next one can be figured out!
The text was updated successfully, but these errors were encountered:
Context
Bee 2.0.0
Summary
Uploading a single file with /bzz or /bytes (at least) twice with the pinning option fails the second time with a 500 error. Details below.
Expected behavior
Uploading a file multiple times should successfully return the same reference each time, regardless of pinned or not. It works on subsequent uploads if pinning is not requested.
Actual behavior
The first upload succeeds and provides the reference. Subsequent attempts with pinning fail with 500.
First upload:
Second upload:
Third upload without the --pin:
--verbosity 5 logs around the second failed upload:
Steps to reproduce
Simply upload a single file twice with the pinning option. It fails on /bzz (in this example) as well as with /bytes with a single content.
swarm-cli upload 12-2442-1805.png --bee-api-url http://192.168.10.38:1633 --bee-debug-api-url http://192.168.10.38:1635 --curl
Possible solution
This problem was introduced in the fix for #4558 The issue is that the error is returned from Close() which is properly recognized and causes Cleanup() to be invoked. But since an error came from Close(), the upload believes it has failed. My solution is to detect the duplicate pin in Close() and directly invoke Cleanup and prevent that specific error from being visible to the upload, allowing it to properly succeed. This makes sense because technically the pin Close() succeeded and it should not rely on the original invoker to come back into Cleanup().
I saw this coming and commented on the PR https://github.com/ethersphere/bee/pull/4558/files#r1466951665 but didn't follow through to actually test it because I didn't have a sepolia node running at the time. I accepted @notanatol 's explanation (https://github.com/ethersphere/bee/pull/4558/files#r1468895966), which was correct from the pinning point of view, but has this negative side-effect of failing the second upload.
Anyway, I worked around this issue by inserting the following code at
bee/pkg/storer/uploadstore.go
Line 114 in 501f8a4
But I also had to make the error message visible by a leading capital letter, which may not be the accepted way of doing things.
bee/pkg/storer/internal/pinning/pinning.go
Line 44 in 501f8a4
Note that I further suspect that there's still an issue coming up with pinning of duplicate uploads of root chunks when various redundancy options are selected. In my earlier testing, uploading a small (<4KB) chunk of data with /bytes with pinning and various redundancy options properly returned the same single reference. But if the pins were examined closely (or more detailed logs around the uploading pinning activity), the dispersed replica SOC references were also included in the pin. With the current DuplicatePinCollection detection, only the first upload set of chunks would actually be pinned and subsequent differing redundancy uploads of the same chunk of data would actually not end up pinning the replica SOCs. I haven't thought of a solution for this issue yet (aside from trying to merge the pinned chunks between the original and new pin instead of deleting the new pin (or is it the original pin that gets cleaned up?)), but please don't hold off on fixing this issue until that next one can be figured out!
The text was updated successfully, but these errors were encountered: