I've created https://github.com/golang/go/issues/53210 and the answer is already in! The initial thread m0 is actually handled differently in that it doesn't get terminated but, to use the runtime terminology, "wedged". Now this explains what I'm seeing in production, because by some chance m0 got scheduled onto one of the transient goroutines that switch namespaces, but never unlock and just terminate. What I couldn't see was that the task group leader got "wedged". Following from this is that locking m0 to the initisl goroutine in an init function avoids it ever getting scheduled onto one of the transient namespace switching goroutines.
-- 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/ccbf0fc8-b2f0-4421-be1c-7cfa06b3e329n%40googlegroups.com.