bee icon indicating copy to clipboard operation
bee copied to clipboard

Cannot disable pushsync multiplexer

Open ldeffenb opened this issue 9 months ago • 0 comments

Context

2.1.0-rc2 (and earlier versions)

Summary

I tried disabling the pushsync multiplexer by setting maxMultiplexForwards to zero, but that completely disabled push syncing.

Expected behavior

maxMultiplexForwards should be able to be set to zero to disable the pushsync multiplexer.

Actual behavior

Setting the value to zero completely disables push syncing because the retryC channel has zero buffer space. Violates the "Principle of least astonishment" (https://en.wikipedia.org/wiki/Principle_of_least_astonishment).

Steps to reproduce

Set maxMultiplexForwards to zero and watch how push syncs never happen because the initial retry() invocation doesn't have any room to queue into retryC and therefore the pushsync retry loop never activates. https://github.com/ethersphere/bee/blob/92de2855d39c94cc1b7d78955c81463e1edcc72f/pkg/pushsync/pushsync.go#L52

Possible solution

Update the following line to ensure that at least one entry exists in the channel. https://github.com/ethersphere/bee/blob/92de2855d39c94cc1b7d78955c81463e1edcc72f/pkg/pushsync/pushsync.go#L342 should read: retryC := make(chan struct{}, max(1,parallelForwards))

ldeffenb avatar May 17 '24 20:05 ldeffenb