I tried on Linux/amd64 (debian testing, kernel 4.14.0-2-amd64) and it's broken too:
* go 1.9.3 + syscall.SetNonblock : hangs in syscall.Read()
* go 1.9.3 + unix.SetNonblock : hangs in syscall.Read()
* go 1.9.2 + syscall.SetNonblock : hangs in syscall.Read()
* go 1.9.2 + unix.SetNonblock : hangs in syscall.Read()
the relevant strace(1) fragment is:
-----------------------------------
pipe2([3, 4], O_CLOEXEC) = 0
epoll_create1(EPOLL_CLOEXEC) = 5
epoll_ctl(5, EPOLL_CTL_ADD, 3, {EPOLLIN|EPOLLOUT|EPOLLRDHUP|EPOLLET, {u32=2231488256, u64=140400417427200}}) = 0
fcntl(3, F_GETFL) = 0 (flags O_RDONLY)
fcntl(3, F_SETFL, O_RDONLY|O_NONBLOCK) = 0
epoll_ctl(5, EPOLL_CTL_ADD, 4, {EPOLLIN|EPOLLOUT|EPOLLRDHUP|EPOLLET, {u32=2231488064, u64=140400417427008}}) = 0
fcntl(4, F_GETFL) = 0x1 (flags O_WRONLY)
fcntl(4, F_SETFL, O_WRONLY|O_NONBLOCK) = 0
fcntl(3, F_GETFL) = 0x800 (flags O_RDONLY|O_NONBLOCK)
fcntl(3, F_SETFL, O_RDONLY) = 0
fcntl(3, F_GETFL) = 0 (flags O_RDONLY)
fcntl(3, F_SETFL, O_RDONLY|O_NONBLOCK) = 0
write(1, "Read START\n", 11Read START
) = 11
fcntl(3, F_GETFL) = 0x800 (flags O_RDONLY|O_NONBLOCK)
fcntl(3, F_SETFL, O_RDONLY) = 0
read(3,
<hangs here>
-----------------------------------
I hope this helps.
David, did you already report the bug on
https://github.com/golang/go/issues ?
I can add the details above on the bug report too.
Regards,
Max