]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: ignore ETIMEDOUT for kevent conservatively
authorAndy Pan <panjf2000@gmail.com>
Wed, 23 Aug 2023 15:31:08 +0000 (23:31 +0800)
committerGopher Robot <gobot@golang.org>
Mon, 23 Oct 2023 17:31:23 +0000 (17:31 +0000)
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>
src/runtime/defs_dragonfly.go
src/runtime/defs_dragonfly_amd64.go
src/runtime/defs_openbsd.go
src/runtime/defs_openbsd_386.go
src/runtime/defs_openbsd_amd64.go
src/runtime/defs_openbsd_arm.go
src/runtime/defs_openbsd_arm64.go
src/runtime/defs_openbsd_mips64.go
src/runtime/defs_openbsd_ppc64.go
src/runtime/defs_openbsd_riscv64.go
src/runtime/netpoll_kqueue.go

index 9dcfdf0fd71c29ed41496463e37d1488cd3611f8..0463f1f116aeac1f4d9530bc43377be59accf015 100644 (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
index f1a2302f284fca8beb06bdf97406781aa9afb28f..41bfb085d1ac66f985fc82aaf129f57404279997 100644 (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
index 5db8b67dd002d11591841f5ef15469909691043c..d93c087a8194b1ab9ecc74e39a941ec449900abb 100644 (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
index fde8af530ffeea333429bd68d9191194a346528f..996745f6f8ed8516e0a2d669b49dfd98b2af2657 100644 (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
index 0f29d0c2eb946c95af6c901a955dbe25f7df6456..739853bc035fe338b27c91842893d21fc128c623 100644 (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
index b56f3b4e346c2a789e46dc05cbf00c5203ded927..cdda6b4ad1a850d1050ac7e9cb8e3408e397f77c 100644 (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
index 0a9acc04944f2ab127955a20c0d218bcaec1d374..67f35b49fb4f306e3b17f6e1a68424a0f6666e14 100644 (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
index 1e469e4fecc7476fee7b985f68860cba7c6b4473..7958044d0422d87cc3fb07f9caba4f49232920a2 100644 (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
index dd23ce9f1fa436824a61328a9abc49de8ffc0a05..83f300cbaab85b19e194dba6b57b2bd2d6368113 100644 (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
index 8ec86577be2e47bc30e4e00a228afc543a0d46b1..2a044d5eb05fcf959d1bf279a631f1d7eb068023 100644 (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
index 33b9815965068d29fe4be2a862f1d46026e8a9a1..d774dce3034c1781fa657d82885642b370cb30e9 100644 (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")
                }