The occasional `ECONNRESET`

9 points by vbernat


marginalia

A bit of a tangent, but docker can cause issues like these, if you have a service that is restarting (and sometimes even if you don't). Seems in some conditions it rebuilds its virtual network devices, including messing with the firewall and routing table. This doesn't just affect the container(s), but processes outside of docker, because docker is not good software.

mort

I had no idea this was a thing. In my mental model, not calling recv() could potentially cause problems due to buffers filling up, but I would never have guessed that sending data would potentially fail just because there's one unread byte in the receive buffer. Good to know!

Are there any solutions to this short of consuming all incoming data (and therefore opening yourself up to a DoS)? Is there a flag or a flush function or something else you can use to say "transmit all data now, then close the socket without regard for the receive buffer"?