[DNM] do not retry the txhashset msg send (do not retry any msg with an attachment) #3152
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Related #3145.
The existing
retry_send
logic retries any msg send iftry_break!
returnsNone
.try_break!
does some funky stuff internally squashing some exceptions but letting others propagate.WouldBlock
andTimedOut
are both squashed, returningNone
.So any msg send that times out will be retried.
This is fine for most (small) self-contained msgs but is definitely not fine for msgs that contain an attachment. For attachments we write repeatedly in a tight loop and any iteration of this loop could experience a timeout.
In situations like this we want to fail fast and not attempt to retry the msg send.
The receiver may have received a partial txhashset zip file and the only thing we can do here is to close the connection to signal to the recipient that we cannot reliably send the remaining bytes of the zip file.
Do not merge yet - needs discussing.
#3145 should be merged first.
We may want to rethink how we implement
write_message
to make sending the attachment more robust. But even if we do we still want to prevent msgs with attachments from being retried at the full msg level.