fix: improve observability on self-hosted runners#23
Open
dnwe wants to merge 6 commits into
Open
Conversation
The Fatalf calls in pkg/ebpf/loader.go terminated the process before the returned error could reach the caller, which made daemonised runs silently die when stdout/stderr were detached.
ebpf.NewCollection allocates BPF maps which require unlimited RLIMIT_MEMLOCK on kernels older than 5.11. The previous ordering called rlimit.RemoveMemlock only after the collection was already loaded, so the map allocation could fail with EPERM.
qwm calls os.Exit, so the pidfile removal that followed the not-running message was unreachable. Reorder so a stale pidfile is removed first when the recorded process has gone away.
When the start command daemonises, exec.Cmd would default the child stdout and stderr to /dev/null, hiding every log line, BPF load failure, and capability error. Instead ppen a persistent log file at /var/log/kntrl.log and report its path alongside the PID so the user knows where to look.
Previously the parent reported "Process started with PID" the moment exec.Cmd.Start returned, even when the child crashed immediately afterwards loading eBPF programs. The pidfile, status command, and operator were all left believing kntrl was running. Instead pass an inherited pipe fd through KNTRL_READY_FD and have the tracer write a single byte after eBPF programs are attached. The parent blocks on the read end with a 15s timeout before recording the pid.
Emits a short report at startup covering the running user, kernel release, RLIMIT_MEMLOCK, presence of a cgroup v2 unified hierarchy, and BTF availability. These are the conditions that are most often to break eBPF on self-hosted CI runners and managed nodes.
dnwe
marked this pull request as ready for review
May 8, 2026 13:46
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Whilst trying kntrl out on self-hosted runners I found the daemon would appear to be running fine, but would fail to log any events. Digging into the code, there were a bunch of places that seemed to sends logs to /dev/null and assume the backend tracer was running as long as it briefly started.
Here’s a series of discrete commits to make this easier to debug things on self-hosted runners