runtime: LockOSThread: didn't exit the main thread without Unlock #34031
Labels
FrozenDueToAge
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
release-blocker
Milestone
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes.
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
I try to use
runtime.LockOSThread
tosyscall.Unshare(syscall.CLONE_NEWNS)
without unlock. The goroutine should be killed after goroutine exit, but it didn't. The runtime will schedule goroutine on the non-safe thread which has different network namespace with pid 1. Is it possible to schedule goroutine to the main thread?I use the following code to reproduce the issue:
What did you expect to see?
the lock threads should be killed and the remaining threads should have the same network namespace to pid 1.
What did you see instead?
The main thread has diff network namespace.
goexit0
will call thegogo
to callmexit
if I understand correctly. I check the code https://github.com/golang/go/blob/release-branch.go1.12/src/runtime/proc.go#L1247-L1266 and it seems that the main thread will not be killed but locked.As
mexit
function comment said, the main thread will not be scheduled to run any goroutine. But is it possible to run other goroutine in this case?I can't prove the main thread blocked in
mexit
has been scheduled to run other goroutine by script right now. But I did see that connection refuse issue happen when there are lot of the concurrent network namespace create requests.Daemon B is still running but the Daemon A has connection refuse issue after concurrent requests. And we found that main thread of Daemon A has different network namespace. So I guess runtime still might schedule the goroutine to the main thread.
Hope those information can help.
The text was updated successfully, but these errors were encountered: