If you have a macOS or Windows computer
handy and you want to improve the TCP
read-deadline handling in Go -- and you know
something about how the runtime handles TCP connections
and read-deadline-timeouts -- your help would be welcome
in getting to the bottom of this runtime bug I recently
encountered:
I have reliable reproducers for it shown there
on the ticket (also see below).
I can see that 8 or 12 bytes are being
skipped and data lost from the TCP receive buffers
on a socket read that occurs at some point after one
or more read deadline time outs. (On windows I can
see the strange count of 15 bytes being lost.)
It is clearly racy since the lost data occurs only
after several thousand good reads. I actually
don't think the "loaded" part is necessary after all;
I just think you need alot of reads in order to
encounter a bad one. Thus I have 50 TCP clients
reading at once from a TCP server. Generally
I see a bad read within a few seconds, but it
can take a minute sometimes too.
This happens on darwin and on windows, but not
on linux. Reproducer code in one file is here:
Just `go run darwin_word_shift.go` to reproduce it: if
it panics, you have seen a bad read.
Thanks and happy debugging!
Jason