Closed dismantl closed 1 year ago
i'm not sure what to think of this, it feels kindof hackish. it would be better if the send tool keeps retrying. (perhaps some other tool than nc)
I agree that it is a bit hacky. socat
, as alternative to nc
, provides a flexible retry option:
http://www.dest-unreach.org/socat/doc/socat.html#OPTION_RETRY
I agree that it is a bit hacky.
socat
, as alternative tonc
, provides a flexible retry option: http://www.dest-unreach.org/socat/doc/socat.html#OPTION_RETRY
oh good to know, I'll give that a try. Feel free to close this PR if you like.
alright let me know how it goes, otherwise it was still a good PR :)
Kinda surprised no one else has run into this before me, but I recently tried running a backup job to a remote server using direct TCP transfer and kept running into a race condition where the send side of the netcat connection would execute before the listen side and the backup job would hang:
I retried a bunch of times and this would happen almost every time, with the occasional success. I retried with
--debug
and--dry-run
and saw the command pipeline that got executed:I realized that since I'm using netcat for direct TCP transfer, the pipe from the send commands to the recv commands is superfluous and I could just add a
sleep
before thezfs send | nc
commands to make sure it didn't start before the netcat listener was ready.This PR implements the
--send-delay
option, which does just this, and consistently solves the race condition for me with just a 1-second delay: