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

On Thursday, January 25, 2018 at 11:03:47 AM UTC+1, Steven Hartland wrote:
>
> I checked this on FreeBSD and it still works, so seems like it could be a 
> macOS specific issue.
>
> You should raise a bug here:
> https://github.com/golang/go/issues
>
> It would be good to try and identify the go version which it first broke 
> in too, as that will be helpful in identifying the change which cause the 
> regression.
>
>     Regards
>     Steve
>
> On 25/01/2018 04:06, Dave Keck wrote:
>
> Hey all, this program exits (as expected) when run with macOS 10.12.6 + Go 
> 1.8.6, but it deadlocks when run with Go 1.9.3:
>
>     https://play.golang.org/p/Dw_ND9gkgPm
>
> The same behavior is observed when using unix.SetNonblock instead of 
> syscall.SetNonblock.
>
> It appears that the SetNonblock() functions don't have an effect in Go 
> 1.9.3. Is this a known issue?
>
> Thanks!
> David
> -- 
> You received this message because you are subscribed to the Google Groups 
> "golang-nuts" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to golang-nuts...@googlegroups.com <javascript:>.
> For more options, visit https://groups.google.com/d/optout.
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to