Skip to content

runtime/pprof: StopCPUProfile causes SIGKILL on Linux kernel 6.12 #76690

@benjajaja

Description

@benjajaja

Does this issue reproduce with the latest release?

Yes, go1.24.5 is the latest release.

What did you do?

package main

import (
	"fmt"
	"io"
	"runtime/pprof"
	"time"
)

func main() {
	fmt.Println("Starting CPU profile...")
	pprof.StartCPUProfile(io.Discard)
	time.Sleep(3 * time.Second)
	fmt.Println("Stopping profile...")
	pprof.StopCPUProfile()
	fmt.Println("Done")
}

Run multiple times - fails intermittently:

$ go build -o test && for i in {1..5}; do ./test; echo "exit: $?"; done

What did you expect to see?

Starting CPU profile...
Stopping profile...
Done
exit: 0

What did you see instead?

Intermittently, the process is killed with SIGKILL (exit 137) during StopCPUProfile():

Starting CPU profile...
Stopping profile...
Killed
exit: 137

Strace shows timer_delete() succeeds, then SIGKILL arrives from outside the process:

[pid 967876] timer_delete(1) = 0
[pid 967876] setitimer(ITIMER_PROF, {0, 0}, NULL) = 0
[pid 967877] +++ killed by SIGKILL +++
[pid 967876] +++ killed by SIGKILL +++
+++ killed by SIGKILL +++

Additional notes:

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugReportIssues describing a possible bug in the Go implementation.NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.OS-Linuxcompiler/runtimeIssues related to the Go compiler and/or runtime.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions