From b6d115a583c42cb086de408471dc943ff6704cfb Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Fri, 10 Jul 2015 15:28:01 -0700 Subject: 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 Reviewed-by: Dmitry Vyukov --- src/runtime/netpoll_kqueue.go | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'src/runtime/netpoll_kqueue.go') 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 } -- cgit v1.3-5-g45d5