mirror of
https://github.com/golang/go
synced 2024-09-30 22:18:32 -06:00
runtime: adjust netpoll panic messages
Change-Id: I34547b057605bb9e1e2227c41867589348560244 Reviewed-on: https://go-review.googlesource.com/41513 Run-TryBot: Mikio Hara <mikioh.mikioh@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
This commit is contained in:
parent
5d306dcdac
commit
91c9b0d568
@ -105,10 +105,10 @@ func poll_runtime_pollOpen(fd uintptr) (*pollDesc, int) {
|
|||||||
pd := pollcache.alloc()
|
pd := pollcache.alloc()
|
||||||
lock(&pd.lock)
|
lock(&pd.lock)
|
||||||
if pd.wg != 0 && pd.wg != pdReady {
|
if pd.wg != 0 && pd.wg != pdReady {
|
||||||
throw("netpollOpen: blocked write on free descriptor")
|
throw("runtime: blocked write on free polldesc")
|
||||||
}
|
}
|
||||||
if pd.rg != 0 && pd.rg != pdReady {
|
if pd.rg != 0 && pd.rg != pdReady {
|
||||||
throw("netpollOpen: blocked read on free descriptor")
|
throw("runtime: blocked read on free polldesc")
|
||||||
}
|
}
|
||||||
pd.fd = fd
|
pd.fd = fd
|
||||||
pd.closing = false
|
pd.closing = false
|
||||||
@ -127,13 +127,13 @@ func poll_runtime_pollOpen(fd uintptr) (*pollDesc, int) {
|
|||||||
//go:linkname poll_runtime_pollClose internal/poll.runtime_pollClose
|
//go:linkname poll_runtime_pollClose internal/poll.runtime_pollClose
|
||||||
func poll_runtime_pollClose(pd *pollDesc) {
|
func poll_runtime_pollClose(pd *pollDesc) {
|
||||||
if !pd.closing {
|
if !pd.closing {
|
||||||
throw("netpollClose: close w/o unblock")
|
throw("runtime: close polldesc w/o unblock")
|
||||||
}
|
}
|
||||||
if pd.wg != 0 && pd.wg != pdReady {
|
if pd.wg != 0 && pd.wg != pdReady {
|
||||||
throw("netpollClose: blocked write on closing descriptor")
|
throw("runtime: blocked write on closing polldesc")
|
||||||
}
|
}
|
||||||
if pd.rg != 0 && pd.rg != pdReady {
|
if pd.rg != 0 && pd.rg != pdReady {
|
||||||
throw("netpollClose: blocked read on closing descriptor")
|
throw("runtime: blocked read on closing polldesc")
|
||||||
}
|
}
|
||||||
netpollclose(pd.fd)
|
netpollclose(pd.fd)
|
||||||
pollcache.free(pd)
|
pollcache.free(pd)
|
||||||
@ -264,7 +264,7 @@ func poll_runtime_pollSetDeadline(pd *pollDesc, d int64, mode int) {
|
|||||||
func poll_runtime_pollUnblock(pd *pollDesc) {
|
func poll_runtime_pollUnblock(pd *pollDesc) {
|
||||||
lock(&pd.lock)
|
lock(&pd.lock)
|
||||||
if pd.closing {
|
if pd.closing {
|
||||||
throw("netpollUnblock: already closing")
|
throw("runtime: unblock on closing polldesc")
|
||||||
}
|
}
|
||||||
pd.closing = true
|
pd.closing = true
|
||||||
pd.seq++
|
pd.seq++
|
||||||
@ -352,7 +352,7 @@ func netpollblock(pd *pollDesc, mode int32, waitio bool) bool {
|
|||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
if old != 0 {
|
if old != 0 {
|
||||||
throw("netpollblock: double wait")
|
throw("runtime: double wait")
|
||||||
}
|
}
|
||||||
if atomic.Casuintptr(gpp, 0, pdWait) {
|
if atomic.Casuintptr(gpp, 0, pdWait) {
|
||||||
break
|
break
|
||||||
@ -368,7 +368,7 @@ func netpollblock(pd *pollDesc, mode int32, waitio bool) bool {
|
|||||||
// be careful to not lose concurrent READY notification
|
// be careful to not lose concurrent READY notification
|
||||||
old := atomic.Xchguintptr(gpp, 0)
|
old := atomic.Xchguintptr(gpp, 0)
|
||||||
if old > pdWait {
|
if old > pdWait {
|
||||||
throw("netpollblock: corrupted state")
|
throw("runtime: corrupted polldesc")
|
||||||
}
|
}
|
||||||
return old == pdReady
|
return old == pdReady
|
||||||
}
|
}
|
||||||
@ -414,7 +414,7 @@ func netpolldeadlineimpl(pd *pollDesc, seq uintptr, read, write bool) {
|
|||||||
var rg *g
|
var rg *g
|
||||||
if read {
|
if read {
|
||||||
if pd.rd <= 0 || pd.rt.f == nil {
|
if pd.rd <= 0 || pd.rt.f == nil {
|
||||||
throw("netpolldeadlineimpl: inconsistent read deadline")
|
throw("runtime: inconsistent read deadline")
|
||||||
}
|
}
|
||||||
pd.rd = -1
|
pd.rd = -1
|
||||||
atomicstorep(unsafe.Pointer(&pd.rt.f), nil) // full memory barrier between store to rd and load of rg in netpollunblock
|
atomicstorep(unsafe.Pointer(&pd.rt.f), nil) // full memory barrier between store to rd and load of rg in netpollunblock
|
||||||
@ -423,7 +423,7 @@ func netpolldeadlineimpl(pd *pollDesc, seq uintptr, read, write bool) {
|
|||||||
var wg *g
|
var wg *g
|
||||||
if write {
|
if write {
|
||||||
if pd.wd <= 0 || pd.wt.f == nil && !read {
|
if pd.wd <= 0 || pd.wt.f == nil && !read {
|
||||||
throw("netpolldeadlineimpl: inconsistent write deadline")
|
throw("runtime: inconsistent write deadline")
|
||||||
}
|
}
|
||||||
pd.wd = -1
|
pd.wd = -1
|
||||||
atomicstorep(unsafe.Pointer(&pd.wt.f), nil) // full memory barrier between store to wd and load of wg in netpollunblock
|
atomicstorep(unsafe.Pointer(&pd.wt.f), nil) // full memory barrier between store to wd and load of wg in netpollunblock
|
||||||
|
@ -32,8 +32,8 @@ func netpollinit() {
|
|||||||
closeonexec(epfd)
|
closeonexec(epfd)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
println("netpollinit: failed to create epoll descriptor", -epfd)
|
println("runtime: epollcreate failed with", -epfd)
|
||||||
throw("netpollinit: failed to create descriptor")
|
throw("runtime: netpollinit failed")
|
||||||
}
|
}
|
||||||
|
|
||||||
func netpolldescriptor() uintptr {
|
func netpolldescriptor() uintptr {
|
||||||
@ -53,7 +53,7 @@ func netpollclose(fd uintptr) int32 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func netpollarm(pd *pollDesc, mode int) {
|
func netpollarm(pd *pollDesc, mode int) {
|
||||||
throw("unused")
|
throw("runtime: unused")
|
||||||
}
|
}
|
||||||
|
|
||||||
// polls for ready network connections
|
// polls for ready network connections
|
||||||
@ -72,7 +72,7 @@ retry:
|
|||||||
if n < 0 {
|
if n < 0 {
|
||||||
if n != -_EINTR {
|
if n != -_EINTR {
|
||||||
println("runtime: epollwait on fd", epfd, "failed with", -n)
|
println("runtime: epollwait on fd", epfd, "failed with", -n)
|
||||||
throw("epollwait failed")
|
throw("runtime: netpoll failed")
|
||||||
}
|
}
|
||||||
goto retry
|
goto retry
|
||||||
}
|
}
|
||||||
|
@ -23,8 +23,8 @@ var (
|
|||||||
func netpollinit() {
|
func netpollinit() {
|
||||||
kq = kqueue()
|
kq = kqueue()
|
||||||
if kq < 0 {
|
if kq < 0 {
|
||||||
println("netpollinit: kqueue failed with", -kq)
|
println("runtime: kqueue failed with", -kq)
|
||||||
throw("netpollinit: kqueue failed")
|
throw("runtime: netpollinit failed")
|
||||||
}
|
}
|
||||||
closeonexec(kq)
|
closeonexec(kq)
|
||||||
}
|
}
|
||||||
@ -60,7 +60,7 @@ func netpollclose(fd uintptr) int32 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func netpollarm(pd *pollDesc, mode int) {
|
func netpollarm(pd *pollDesc, mode int) {
|
||||||
throw("unused")
|
throw("runtime: unused")
|
||||||
}
|
}
|
||||||
|
|
||||||
// Polls for ready network connections.
|
// Polls for ready network connections.
|
||||||
@ -80,7 +80,7 @@ retry:
|
|||||||
if n < 0 {
|
if n < 0 {
|
||||||
if n != -_EINTR {
|
if n != -_EINTR {
|
||||||
println("runtime: kevent on fd", kq, "failed with", -n)
|
println("runtime: kevent on fd", kq, "failed with", -n)
|
||||||
throw("kevent failed")
|
throw("runtime: netpoll failed")
|
||||||
}
|
}
|
||||||
goto retry
|
goto retry
|
||||||
}
|
}
|
||||||
|
@ -117,8 +117,8 @@ func netpollinit() {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
print("netpollinit: failed to create port (", errno(), ")\n")
|
print("runtime: port_create failed (errno=", errno(), ")\n")
|
||||||
throw("netpollinit: failed to create port")
|
throw("runtime: netpollinit failed")
|
||||||
}
|
}
|
||||||
|
|
||||||
func netpolldescriptor() uintptr {
|
func netpolldescriptor() uintptr {
|
||||||
@ -158,8 +158,8 @@ func netpollupdate(pd *pollDesc, set, clear uint32) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if events != 0 && port_associate(portfd, _PORT_SOURCE_FD, pd.fd, events, uintptr(unsafe.Pointer(pd))) != 0 {
|
if events != 0 && port_associate(portfd, _PORT_SOURCE_FD, pd.fd, events, uintptr(unsafe.Pointer(pd))) != 0 {
|
||||||
print("netpollupdate: failed to associate (", errno(), ")\n")
|
print("runtime: port_associate failed (errno=", errno(), ")\n")
|
||||||
throw("netpollupdate: failed to associate")
|
throw("runtime: netpollupdate failed")
|
||||||
}
|
}
|
||||||
pd.user = events
|
pd.user = events
|
||||||
}
|
}
|
||||||
@ -173,7 +173,7 @@ func netpollarm(pd *pollDesc, mode int) {
|
|||||||
case 'w':
|
case 'w':
|
||||||
netpollupdate(pd, _POLLOUT, 0)
|
netpollupdate(pd, _POLLOUT, 0)
|
||||||
default:
|
default:
|
||||||
throw("netpollarm: bad mode")
|
throw("runtime: bad mode")
|
||||||
}
|
}
|
||||||
unlock(&pd.lock)
|
unlock(&pd.lock)
|
||||||
}
|
}
|
||||||
@ -196,8 +196,8 @@ retry:
|
|||||||
var n uint32 = 1
|
var n uint32 = 1
|
||||||
if port_getn(portfd, &events[0], uint32(len(events)), &n, wait) < 0 {
|
if port_getn(portfd, &events[0], uint32(len(events)), &n, wait) < 0 {
|
||||||
if e := errno(); e != _EINTR {
|
if e := errno(); e != _EINTR {
|
||||||
print("runtime: port_getn on fd ", portfd, " failed with ", e, "\n")
|
print("runtime: port_getn on fd ", portfd, " failed (errno=", e, ")\n")
|
||||||
throw("port_getn failed")
|
throw("runtime: netpoll failed")
|
||||||
}
|
}
|
||||||
goto retry
|
goto retry
|
||||||
}
|
}
|
||||||
|
@ -36,8 +36,8 @@ var iocphandle uintptr = _INVALID_HANDLE_VALUE // completion port io handle
|
|||||||
func netpollinit() {
|
func netpollinit() {
|
||||||
iocphandle = stdcall4(_CreateIoCompletionPort, _INVALID_HANDLE_VALUE, 0, 0, _DWORD_MAX)
|
iocphandle = stdcall4(_CreateIoCompletionPort, _INVALID_HANDLE_VALUE, 0, 0, _DWORD_MAX)
|
||||||
if iocphandle == 0 {
|
if iocphandle == 0 {
|
||||||
println("netpoll: failed to create iocp handle (errno=", getlasterror(), ")")
|
println("runtime: CreateIoCompletionPort failed (errno=", getlasterror(), ")")
|
||||||
throw("netpoll: failed to create iocp handle")
|
throw("runtime: netpollinit failed")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -58,7 +58,7 @@ func netpollclose(fd uintptr) int32 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func netpollarm(pd *pollDesc, mode int) {
|
func netpollarm(pd *pollDesc, mode int) {
|
||||||
throw("unused")
|
throw("runtime: unused")
|
||||||
}
|
}
|
||||||
|
|
||||||
// Polls for completed network IO.
|
// Polls for completed network IO.
|
||||||
@ -94,8 +94,8 @@ retry:
|
|||||||
if !block && errno == _WAIT_TIMEOUT {
|
if !block && errno == _WAIT_TIMEOUT {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
println("netpoll: GetQueuedCompletionStatusEx failed (errno=", errno, ")")
|
println("runtime: GetQueuedCompletionStatusEx failed (errno=", errno, ")")
|
||||||
throw("netpoll: GetQueuedCompletionStatusEx failed")
|
throw("runtime: netpoll failed")
|
||||||
}
|
}
|
||||||
mp.blocked = false
|
mp.blocked = false
|
||||||
for i = 0; i < n; i++ {
|
for i = 0; i < n; i++ {
|
||||||
@ -121,8 +121,8 @@ retry:
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
if op == nil {
|
if op == nil {
|
||||||
println("netpoll: GetQueuedCompletionStatus failed (errno=", errno, ")")
|
println("runtime: GetQueuedCompletionStatus failed (errno=", errno, ")")
|
||||||
throw("netpoll: GetQueuedCompletionStatus failed")
|
throw("runtime: netpoll failed")
|
||||||
}
|
}
|
||||||
// dequeued failed IO packet, so report that
|
// dequeued failed IO packet, so report that
|
||||||
}
|
}
|
||||||
@ -137,12 +137,13 @@ retry:
|
|||||||
|
|
||||||
func handlecompletion(gpp *guintptr, op *net_op, errno int32, qty uint32) {
|
func handlecompletion(gpp *guintptr, op *net_op, errno int32, qty uint32) {
|
||||||
if op == nil {
|
if op == nil {
|
||||||
throw("netpoll: GetQueuedCompletionStatus returned op == nil")
|
println("runtime: GetQueuedCompletionStatus returned op == nil")
|
||||||
|
throw("runtime: netpoll failed")
|
||||||
}
|
}
|
||||||
mode := op.mode
|
mode := op.mode
|
||||||
if mode != 'r' && mode != 'w' {
|
if mode != 'r' && mode != 'w' {
|
||||||
println("netpoll: GetQueuedCompletionStatus returned invalid mode=", mode)
|
println("runtime: GetQueuedCompletionStatus returned invalid mode=", mode)
|
||||||
throw("netpoll: GetQueuedCompletionStatus returned invalid mode")
|
throw("runtime: netpoll failed")
|
||||||
}
|
}
|
||||||
op.errno = errno
|
op.errno = errno
|
||||||
op.qty = qty
|
op.qty = qty
|
||||||
|
Loading…
Reference in New Issue
Block a user