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
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions fifo.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.

}
var file *os.File
fn, err := h.Path()
Expand Down
Loading