Hi experts, golang version: go-1.17 I ran go program(gobgpd) for about two month until it suddenly crash in go runtime with following error: ``` runtime: gp: gp=0xc0006836c0, goid=0, gp->atomicstatus=0 runtime: g: g=0xc0002f41a0, goid=0, g->atomicstatus=0 fatal error: invalid g status runtime: gp: gp=0xc000683860, goid=0, gp->atomicstatus=0 runtime: g: g=0xc000a7c1a0, goid=0, g->atomicstatus=0 fatal error: invalid g status runtime: unknown pc 0x6 stack: frame={sp:0xc000922b30, fp:0x0} stack=[0xc000922000,0xc000923000) 0x000000c000922a30: 0x0000000000000000 0x0000000000203000 0x000000c000922a40: 0x0000000000000000 0x000000c000922bb0 0x000000c000922a50: 0x0000000000419351 <runtime.heapBitsSetType+0x00000000000006f1> 0x000000c0004c2300 0x000000c000922a60: 0x0000000000000027 0x00000000006e0060 <crypto/tls.(*Conn).writeRecordLocked.func1 ```
It doesn't seem to be a usual go program stack. I searched the go runtime code, it seems to crash inside runtime/preempt.go:suspendG. Basically the switch falls in the impossible default case. Please anyone see this kind of error ever before? How could it happen. Thanks a lot! ``` func suspendG(gp *g) suspendGState { if mp := getg().m; mp.curg != nil && readgstatus(mp.curg) == _Grunning { // Since we're on the system stack of this M, the user // G is stuck at an unsafe point. If another goroutine // were to try to preempt m.curg, it could deadlock. throw("suspendG from non-preemptible goroutine") } // See https://golang.org/cl/21503 for justification of the yield delay. const yieldDelay = 10 * 1000 var nextYield int64 // Drive the goroutine to a preemption point. stopped := false var asyncM *m var asyncGen uint32 var nextPreemptM int64 for i := 0; ; i++ { switch s := readgstatus(gp); s { default: if s&_Gscan != 0 { // Someone else is suspending it. Wait // for them to finish. // // TODO: It would be nicer if we could // coalesce suspends. break } dumpgstatus(gp) throw("invalid g status") case _Gdead: // Nothing to suspend. // // preemptStop may need to be cleared, but // doing that here could race with goroutine // reuse. Instead, goexit0 clears it. return suspendGState{dead: true} case _Gcopystack: // The stack is being copied. We need to wait // until this is done. case _Gpreempted: // We (or someone else) suspended the G. Claim // ownership of it by transitioning it to // _Gwaiting. if !casGFromPreempted(gp, _Gpreempted, _Gwaiting) { break } // We stopped the G, so we have to ready it later. stopped = true s = _Gwaiting fallthrough case _Grunnable, _Gsyscall, _Gwaiting: ``` Best Regards, Dapeng -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/f232116e-afd6-4748-a8f1-2ccb35c43a67n%40googlegroups.com.