diff options
author | Ian Lance Taylor <iant@golang.org> | 2015-07-10 15:28:01 -0700 |
---|---|---|
committer | Ian Lance Taylor <iant@golang.org> | 2015-09-15 17:56:56 +0000 |
commit | b6d115a583c42cb086de408471dc943ff6704cfb (patch) | |
tree | 335efd46e0452be4ac1542ad75492ad7757d4e8c /src/runtime/netpoll_kqueue.go | |
parent | 731bdc51157fd7f685fb73c298e97922318ac453 (diff) | |
download | go-b6d115a583c42cb086de408471dc943ff6704cfb.tar.gz go-b6d115a583c42cb086de408471dc943ff6704cfb.zip |
runtime: on unexpected netpoll error, throw instead of looping
The current code prints an error message and then tries to carry on.
This is not helpful for Go users: they see a message that means
nothing and that they can do nothing about. In the only known case of
this message, in issue 11498, the best guess is that the netpoll code
went into an infinite loop. Instead of doing that, crash the program.
Fixes #11498.
Change-Id: Idda3456c5b708f0df6a6b56c5bb4e796bbc39d7c
Reviewed-on: https://go-review.googlesource.com/12047
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Dmitry Vyukov <dvyukov@google.com>
Diffstat (limited to 'src/runtime/netpoll_kqueue.go')
-rw-r--r-- | src/runtime/netpoll_kqueue.go | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/runtime/netpoll_kqueue.go b/src/runtime/netpoll_kqueue.go index 01445dc231..36956bae71 100644 --- a/src/runtime/netpoll_kqueue.go +++ b/src/runtime/netpoll_kqueue.go @@ -17,8 +17,7 @@ func kevent(kq int32, ch *keventt, nch int32, ev *keventt, nev int32, ts *timesp func closeonexec(fd int32) var ( - kq int32 = -1 - netpolllasterr int32 + kq int32 = -1 ) func netpollinit() { @@ -75,9 +74,9 @@ func netpoll(block bool) *g { retry: n := kevent(kq, nil, 0, &events[0], int32(len(events)), tp) if n < 0 { - if n != -_EINTR && n != netpolllasterr { - netpolllasterr = n + if n != -_EINTR { println("runtime: kevent on fd", kq, "failed with", -n) + throw("kevent failed") } goto retry } |