1
0
mirror of https://github.com/golang/go synced 2024-11-23 00:10:07 -07:00

runtime: ignore ETIMEDOUT for kevent conservatively

Fixes #59679

Change-Id: I1334b793825a2a57d239e3c98373bf4c93cc622a
Reviewed-on: https://go-review.googlesource.com/c/go/+/522215
Reviewed-by: David Chase <drchase@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Michael Pratt <mpratt@google.com>
Run-TryBot: Andy Pan <panjf2000@gmail.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
This commit is contained in:
Andy Pan 2023-08-23 23:31:08 +08:00 committed by Gopher Robot
parent bc2124dab1
commit 1f3f851a6e
11 changed files with 46 additions and 33 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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")
}