Skip to content

panic: runtime.errorString("integer divide by zero") #65867

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
ytc1012 opened this issue Feb 22, 2024 · 6 comments
Closed

panic: runtime.errorString("integer divide by zero") #65867

ytc1012 opened this issue Feb 22, 2024 · 6 comments
Labels
compiler/runtime Issues related to the Go compiler and/or runtime. FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Milestone

Comments

@ytc1012
Copy link

ytc1012 commented Feb 22, 2024

Go version

go version go1.21.6 windows/amd64

Output of go env in your module/workspace:

set GO111MODULE=auto
set GOARCH=amd64
set GOBIN=
set GOCACHE=C:\Users\1\AppData\Local\go-build
set GOENV=C:\Users\1\AppData\Roaming\go\env
set GOEXE=.exe
set GOEXPERIMENT=
set GOFLAGS=
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOINSECURE=
set GOMODCACHE=D:\go-path\pkg\mod
set GONOPROXY=
set GONOSUMDB=
set GOOS=windows
set GOPATH=D:\go-path;D:\server-catch-fish;D:\go_work
set GOPRIVATE=
set GOPROXY=https://goproxy.cn,direct
set GOROOT=C:/Program Files/Go
set GOSUMDB=sum.golang.org
set GOTMPDIR=
set GOTOOLCHAIN=auto
set GOTOOLDIR=C:\Program Files\Go\pkg\tool\windows_amd64
set GOVCS=
set GOWORK=
set CGO_CFLAGS=-O2 -g
set CGO_CPPFLAGS=
set CGO_CXXFLAGS=-O2 -g
set CGO_FFLAGS=-O2 -g
set CGO_LDFLAGS=-O2 -g
set PKG_CONFIG=pkg-config
set GOGCCFLAGS=-m64 -fno-caret-diagnostics -Qunused-arguments -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=C:\Users\1\AppData\Local\Temp\go-build3204000475
=/tmp/go-build -gno-record-gcc-switches

What did you do?

game server

What did you see happen?

panic: runtime.errorString("integer divide by zero")
fatal error: panic on system stack

runtime stack:
runtime.throw({0xd747f2?, 0x12b8f80?})
	C:/Program Files/Go/src/runtime/panic.go:1077 +0x5c fp=0xc0002c5d28 sp=0xc0002c5cf8 pc=0x4372bc
panic({0xc05b80?, 0x12b8f80?})
	C:/Program Files/Go/src/runtime/panic.go:840 +0x6ea fp=0xc0002c5dd8 sp=0xc0002c5d28 pc=0x4371ca
runtime.panicdivide()
	C:/Program Files/Go/src/runtime/panic.go:240 +0x3e fp=0xc0002c5df8 sp=0xc0002c5dd8 pc=0x43585e
runtime.globrunqget(0x12fb180?, 0x54a00?)
	C:/Program Files/Go/src/runtime/proc.go:5999 +0x115 fp=0xc0002c5e38 sp=0xc0002c5df8 pc=0x446255
runtime.findRunnable()
	C:/Program Files/Go/src/runtime/proc.go:2938 +0x125 fp=0xc0002c5f48 sp=0xc0002c5e38 pc=0x43ed65
runtime.schedule()
	C:/Program Files/Go/src/runtime/proc.go:3582 +0xb1 fp=0xc0002c5f80 sp=0xc0002c5f48 pc=0x4405d1
runtime.goexit0(0xc008977d40)
	C:/Program Files/Go/src/runtime/proc.go:3921 +0x266 fp=0xc0002c5fc0 sp=0xc0002c5f80 pc=0x4414e6
traceback: unexpected SPWRITE function runtime.mcall
runtime.mcall()
	C:/Program Files/Go/src/runtime/asm_amd64.s:458 +0x4e fp=0xc0002c5fd8 sp=0xc0002c5fc0 pc=0x46ab4e

What did you expect to see?

game server

@randall77
Copy link
Contributor

n := sched.runqsize/gomaxprocs + 1

Looks like gomaxprocs got set to 0. I don't think you can do that using any API. Probably memory corruption somehow.

@seankhliao seankhliao added the WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. label Feb 22, 2024
@ytc1012
Copy link
Author

ytc1012 commented Feb 24, 2024

goroutine 1 [IO wait]:
runtime.gopark(0x4aa310?, 0xc001b09a90?, 0xe0?, 0x9a?, 0x4c401d?)
	C:/Program Files/Go/src/runtime/proc.go:398 +0xce fp=0xc001b09a70 sp=0xc001b09a50 pc=0x43a1ae
runtime.netpollblock(0x46abb2?, 0x404c86?, 0x0?)
	C:/Program Files/Go/src/runtime/netpoll.go:564 +0xf7 fp=0xc001b09aa8 sp=0xc001b09a70 pc=0x432bb7
internal/poll.runtime_pollWait(0x7f4581d2b4d8, 0x72)
	C:/Program Files/Go/src/runtime/netpoll.go:343 +0x85 fp=0xc001b09ac8 sp=0xc001b09aa8 pc=0x4673c5
internal/poll.(*pollDesc).wait(0xc0017eea00?, 0x414f48?, 0x0)
	C:/Program Files/Go/src/internal/poll/fd_poll_runtime.go:84 +0x27 fp=0xc001b09af0 sp=0xc001b09ac8 pc=0x4c00c7
internal/poll.(*pollDesc).waitRead(...)
	C:/Program Files/Go/src/internal/poll/fd_poll_runtime.go:89
internal/poll.(*FD).Accept(0xc0017eea00)
	C:/Program Files/Go/src/internal/poll/fd_unix.go:611 +0x2ac fp=0xc001b09b98 sp=0xc001b09af0 pc=0x4c2e8c
net.(*netFD).accept(0xc0017eea00)
	C:/Program Files/Go/src/net/fd_unix.go:172 +0x29 fp=0xc001b09c50 sp=0xc001b09b98 pc=0x5af569
net.(*TCPListener).accept(0xc00030b2e0)
	C:/Program Files/Go/src/net/tcpsock_posix.go:152 +0x1e fp=0xc001b09c78 sp=0xc001b09c50 pc=0x5c1efe
net.(*TCPListener).Accept(0xc00030b2e0)
	C:/Program Files/Go/src/net/tcpsock.go:315 +0x30 fp=0xc001b09ca8 sp=0xc001b09c78 pc=0x5c1210
frame.(*SocketAcceptor).Start(0xc00007aa80, {0xc0000422b8?, 0x11?})
	D:/server-catch-fish/src/frame/acceptor.go:59 +0xe2 fp=0xc001b09d58 sp=0xc001b09ca8 pc=0x7507c2
game.(*GameAttemperEngineSink).Serve(0xc0001ec000?)
	D:/server-catch-fish/src/game/game_attemper_engine_sink.go:223 +0x2b fp=0xc001b09d80 sp=0xc001b09d58 pc=0xb28eab
main.main()
	D:/server-catch-fish/src/main/game_server.go:64 +0x72f fp=0xc001b09f40 sp=0xc001b09d80 pc=0xb3956f
runtime.main()
	C:/Program Files/Go/src/runtime/proc.go:267 +0x2bb fp=0xc001b09fe0 sp=0xc001b09f40 pc=0x439d3b
runtime.goexit()
	C:/Program Files/Go/src/runtime/asm_amd64.s:1650 +0x1 fp=0xc001b09fe8 sp=0xc001b09fe0 pc=0x46c9c1

goroutine 2 [force gc (idle), 13589 minutes]:
runtime.gopark(0x0?, 0x0?, 0x0?, 0x0?, 0x0?)
	C:/Program Files/Go/src/runtime/proc.go:398 +0xce fp=0xc000062fa8 sp=0xc000062f88 pc=0x43a1ae
runtime.goparkunlock(...)
	C:/Program Files/Go/src/runtime/proc.go:404
runtime.forcegchelper()
	C:/Program Files/Go/src/runtime/proc.go:322 +0xb3 fp=0xc000062fe0 sp=0xc000062fa8 pc=0x43a013
runtime.goexit()
	C:/Program Files/Go/src/runtime/asm_amd64.s:1650 +0x1 fp=0xc000062fe8 sp=0xc000062fe0 pc=0x46c9c1
created by runtime.init.6 in goroutine 1
	C:/Program Files/Go/src/runtime/proc.go:310 +0x1a

goroutine 3 [GC sweep wait]:
runtime.gopark(0x12ca101?, 0x0?, 0x0?, 0x0?, 0x0?)
	C:/Program Files/Go/src/runtime/proc.go:398 +0xce fp=0xc000063778 sp=0xc000063758 pc=0x43a1ae
runtime.goparkunlock(...)
	C:/Program Files/Go/src/runtime/proc.go:404
runtime.bgsweep(0x0?)
	C:/Program Files/Go/src/runtime/mgcsweep.go:321 +0xdf fp=0xc0000637c8 sp=0xc000063778 pc=0x4249bf
runtime.gcenable.func1()
	C:/Program Files/Go/src/runtime/mgc.go:200 +0x25 fp=0xc0000637e0 sp=0xc0000637c8 pc=0x419b25
runtime.goexit()
	C:/Program Files/Go/src/runtime/asm_amd64.s:1650 +0x1 fp=0xc0000637e8 sp=0xc0000637e0 pc=0x46c9c1
created by runtime.gcenable in goroutine 1
	C:/Program Files/Go/src/runtime/mgc.go:200 +0x66

goroutine 4 [GC scavenge wait]:
runtime.gopark(0x12ca7c0?, 0x12ca7c0?, 0x0?, 0x0?, 0x0?)
	C:/Program Files/Go/src/runtime/proc.go:398 +0xce fp=0xc000063f70 sp=0xc000063f50 pc=0x43a1ae
runtime.goparkunlock(...)
	C:/Program Files/Go/src/runtime/proc.go:404
runtime.(*scavengerState).park(0x12ca7c0)
	C:/Program Files/Go/src/runtime/mgcscavenge.go:425 +0x49 fp=0xc000063fa0 sp=0xc000063f70 pc=0x422249
runtime.bgscavenge(0x0?)
	C:/Program Files/Go/src/runtime/mgcscavenge.go:658 +0x59 fp=0xc000063fc8 sp=0xc000063fa0 pc=0x4227f9
runtime.gcenable.func2()
	C:/Program Files/Go/src/runtime/mgc.go:201 +0x25 fp=0xc000063fe0 sp=0xc000063fc8 pc=0x419ac5
runtime.goexit()
	C:/Program Files/Go/src/runtime/asm_amd64.s:1650 +0x1 fp=0xc000063fe8 sp=0xc000063fe0 pc=0x46c9c1
created by runtime.gcenable in goroutine 1
	C:/Program Files/Go/src/runtime/mgc.go:201 +0xa5

@panjf2000
Copy link
Member

Hi @ytc1012, could you share more info about what your server was doing when this happened?

Also, is this reproducible? Does this reproduce at some specific point?

@panjf2000 panjf2000 added NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. compiler/runtime Issues related to the Go compiler and/or runtime. labels Feb 24, 2024
@panjf2000 panjf2000 added this to the Backlog milestone Feb 24, 2024
@panjf2000
Copy link
Member

CC @golang/runtime

@ytc1012
Copy link
Author

ytc1012 commented Feb 24, 2024

@panjf2000
Thank you for your reply. This is our company's game service, which appeared once yesterday and the day before yesterday, but at different times. Below are some of our code, The problem arises at 'conn, err := ln.Accept()'

ln, err := net.Listen("tcp", address)
if err != nil {
	return err
}

self.sockMap = make(map[uint64]*Session)
self.listener = ln
self.running = true

for self.running {
	conn, err := ln.Accept()
	if err != nil {
		self.log.Errorln("accept", err)
		continue
	}
}

@seankhliao seankhliao added WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. and removed WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. labels Feb 24, 2024
@gopherbot
Copy link
Contributor

Timed out in state WaitingForInfo. Closing.

(I am just a bot, though. Please speak up if this is a mistake or you have the requested information.)

@gopherbot gopherbot closed this as not planned Won't fix, can't repro, duplicate, stale Mar 24, 2024
@golang golang locked and limited conversation to collaborators Mar 24, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
compiler/runtime Issues related to the Go compiler and/or runtime. FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Projects
Development

No branches or pull requests

5 participants