Skip to content
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

add LockOSThread to kill thread #59

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

ningmingxiao
Copy link
Contributor

@ningmingxiao ningmingxiao commented Dec 12, 2024

@thaJeztah
try to fix this issue golang/go#14592

Signed-off-by: ningmingxiao <ning.mingxiao@zte.com.cn>
@ningmingxiao ningmingxiao changed the title add LockOSThread to kill therad add LockOSThread to kill thread Dec 12, 2024
@thaJeztah
Copy link
Member

@ningmingxiao
Copy link
Contributor Author

containerd/containerd#11128 these pr will reduce the occurrence of bugs.

@@ -135,6 +135,7 @@ func openFifo(ctx context.Context, fn string, flag int, perm os.FileMode) (*fifo
go func() {
if wg != nil {
defer wg.Done()
runtime.LockOSThread()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well. Go runtime will create new thread if all existing threads are in kernel mode. The openAt syscall on fifo won't last too long in practise because kubelet always starts container after created containerd/containerd#11128.

I would like to wait for Go runtime to handle idle threads instead of using LockOSThread here, because it may cause unexpected issue. For example, in process X, sub-thread A invokes exec process Y with Pdeathsig: SIGKILL. If the sub-thread A is killed by LockOSThread, the process Y will be killed as well. It's hard to tell who sends signal to process Y in production. So, I am not a fan to use LockOSThread.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants