Thank you for the debugging the issue and finding a resolution. I was able to recreate the problem by following the steps you mentioned. I went ahead and created a pull request with the proposed fix and can confirm it resolves the symptoms described. I will merge the pull request after a few more tests. I test/debug on OS X so I added a define for MSG_NOSIGNAL which isn’t available in OS X (however SO_NOSIGPIPE is).
Update: I went ahead and merged this. So please update and let us know if the issue is resolved or if it persists.