Skip to content

Commit

Permalink
runtime: ignore ETIMEDOUT for kevent conservatively
Browse files Browse the repository at this point in the history
Fixes #59679

Change-Id: I1334b793825a2a57d239e3c98373bf4c93cc622a
Reviewed-on: https://go-review.googlesource.com/c/go/+/522215
Reviewed-by: David Chase <[email protected]>
TryBot-Result: Gopher Robot <[email protected]>
Auto-Submit: Michael Pratt <[email protected]>
Run-TryBot: Andy Pan <[email protected]>
Reviewed-by: Michael Pratt <[email protected]>
  • Loading branch information
panjf2000 authored and gopherbot committed Oct 23, 2023
1 parent bc2124d commit 1f3f851
Show file tree
Hide file tree
Showing 11 changed files with 46 additions and 33 deletions.
9 changes: 5 additions & 4 deletions src/runtime/defs_dragonfly.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,11 @@ package runtime
import "C"

const (
EINTR = C.EINTR
EFAULT = C.EFAULT
EBUSY = C.EBUSY
EAGAIN = C.EAGAIN
EINTR = C.EINTR
EFAULT = C.EFAULT
EBUSY = C.EBUSY
EAGAIN = C.EAGAIN
ETIMEDOUT = C.ETIMEDOUT

O_WRONLY = C.O_WRONLY
O_NONBLOCK = C.O_NONBLOCK
Expand Down
9 changes: 5 additions & 4 deletions src/runtime/defs_dragonfly_amd64.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@ package runtime
import "unsafe"

const (
_EINTR = 0x4
_EFAULT = 0xe
_EBUSY = 0x10
_EAGAIN = 0x23
_EINTR = 0x4
_EFAULT = 0xe
_EBUSY = 0x10
_EAGAIN = 0x23
_ETIMEDOUT = 0x3c

_O_WRONLY = 0x1
_O_NONBLOCK = 0x4
Expand Down
7 changes: 4 additions & 3 deletions src/runtime/defs_openbsd.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,10 @@ package runtime
import "C"

const (
EINTR = C.EINTR
EFAULT = C.EFAULT
EAGAIN = C.EAGAIN
EINTR = C.EINTR
EFAULT = C.EFAULT
EAGAIN = C.EAGAIN
ETIMEDOUT = C.ETIMEDOUT

O_NONBLOCK = C.O_NONBLOCK
O_CLOEXEC = C.O_CLOEXEC
Expand Down
7 changes: 4 additions & 3 deletions src/runtime/defs_openbsd_386.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@ package runtime
import "unsafe"

const (
_EINTR = 0x4
_EFAULT = 0xe
_EAGAIN = 0x23
_EINTR = 0x4
_EFAULT = 0xe
_EAGAIN = 0x23
_ETIMEDOUT = 0x3c

_O_WRONLY = 0x1
_O_NONBLOCK = 0x4
Expand Down
7 changes: 4 additions & 3 deletions src/runtime/defs_openbsd_amd64.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@ package runtime
import "unsafe"

const (
_EINTR = 0x4
_EFAULT = 0xe
_EAGAIN = 0x23
_EINTR = 0x4
_EFAULT = 0xe
_EAGAIN = 0x23
_ETIMEDOUT = 0x3c

_O_WRONLY = 0x1
_O_NONBLOCK = 0x4
Expand Down
7 changes: 4 additions & 3 deletions src/runtime/defs_openbsd_arm.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@ package runtime
import "unsafe"

const (
_EINTR = 0x4
_EFAULT = 0xe
_EAGAIN = 0x23
_EINTR = 0x4
_EFAULT = 0xe
_EAGAIN = 0x23
_ETIMEDOUT = 0x3c

_O_WRONLY = 0x1
_O_NONBLOCK = 0x4
Expand Down
7 changes: 4 additions & 3 deletions src/runtime/defs_openbsd_arm64.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@ package runtime
import "unsafe"

const (
_EINTR = 0x4
_EFAULT = 0xe
_EAGAIN = 0x23
_EINTR = 0x4
_EFAULT = 0xe
_EAGAIN = 0x23
_ETIMEDOUT = 0x3c

_O_WRONLY = 0x1
_O_NONBLOCK = 0x4
Expand Down
7 changes: 4 additions & 3 deletions src/runtime/defs_openbsd_mips64.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@ package runtime
import "unsafe"

const (
_EINTR = 0x4
_EFAULT = 0xe
_EAGAIN = 0x23
_EINTR = 0x4
_EFAULT = 0xe
_EAGAIN = 0x23
_ETIMEDOUT = 0x3c

_O_WRONLY = 0x1
_O_NONBLOCK = 0x4
Expand Down
7 changes: 4 additions & 3 deletions src/runtime/defs_openbsd_ppc64.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@ package runtime
import "unsafe"

const (
_EINTR = 0x4
_EFAULT = 0xe
_EAGAIN = 0x23
_EINTR = 0x4
_EFAULT = 0xe
_EAGAIN = 0x23
_ETIMEDOUT = 0x3c

_O_WRONLY = 0x1
_O_NONBLOCK = 0x4
Expand Down
7 changes: 4 additions & 3 deletions src/runtime/defs_openbsd_riscv64.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@ package runtime
import "unsafe"

const (
_EINTR = 0x4
_EFAULT = 0xe
_EAGAIN = 0x23
_EINTR = 0x4
_EFAULT = 0xe
_EAGAIN = 0x23
_ETIMEDOUT = 0x3c

_O_WRONLY = 0x1
_O_NONBLOCK = 0x4
Expand Down
5 changes: 4 additions & 1 deletion src/runtime/netpoll_kqueue.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,10 @@ func netpoll(delay int64) (gList, int32) {
retry:
n := kevent(kq, nil, 0, &events[0], int32(len(events)), tp)
if n < 0 {
if n != -_EINTR {
// Ignore the ETIMEDOUT error for now, but try to dive deep and
// figure out what really happened with n == ETIMEOUT,
// see https://go.dev/issue/59679 for details.
if n != -_EINTR && n != -_ETIMEDOUT {
println("runtime: kevent on fd", kq, "failed with", -n)
throw("runtime: netpoll failed")
}
Expand Down

0 comments on commit 1f3f851

Please sign in to comment.