Repository navigation
fix(fifo): skip runner probing when the control FIFO has no reader - #37
Merged
Merged
Conversation
[Medium impact] The changes affect instrument startup for applications that use the shared hooks library. The PR appears safe to merge, with a non-blocking request for timeout-and-cleanup test coverage.
|
FIFOs left in /tmp by an exited runner made instrument_hooks_init() block for ~4 s before falling back to no instrument. Pipe.openPipe opens the FIFOs O_RDWR, which succeeds without a peer, so stale files looked like a live runner and both FIFO instruments waited for two 1 s ack timeouts. RunnerFifo.init now probes the control FIFO with a non-blocking O_WRONLY open, which fails with ENXIO when no process reads it, and returns error.NoRunner. A live runner holds the FIFO open, so it is unaffected. validate_protocol_version also propagates AckTimeout instead of continuing into GetIntegrationMode, and FifoInstrument closes the FIFOs on that error. dist/core.c is regenerated. Swallowing AckTimeout (1460da1) was only meant to avoid exit(1) without a runner; Instrument.init already falls back to the no-op instrument. Fixes #36
GCC 15 defaults to C23, where zig.h expands zig_noreturn to [[noreturn]]. Zig's C backend emits `static zig_noreturn void f(...)`, and a C23 attribute after `static` is a syntax error, so dist/core.c no longer compiled without an explicit -std. The Bazel example (no -std flag) started failing once ubuntu-latest moved to GCC 15. release.py now rewrites `static|zig_extern zig_noreturn` to put zig_noreturn first, which is valid for every expansion in zig.h (_Noreturn, __attribute__((noreturn)), __declspec(noreturn)).
not-matthias
force-pushed
the
cod-4460-fix-fifo-issues-reported-by-firefox
branch
from
November 26, 2026 10:59
d317a2f to
b8a85ec
Compare
lvaroqui
reviewed
Nov 26, 2026
| # Zig's C backend mangles struct names (e.g. instrument_hooks_InstrumentHooks__547), | ||
| # and there's no way to control this from Zig source. Replace with the stable | ||
| # name from core.h so that core.c can be included alongside core.h without | ||
| # type conflicts. |
Contributor
There was a problem hiding this comment.
nit: this comment should probably move just above the replacement it describes
lvaroqui
approved these changes
Nov 26, 2026
not-matthias
deleted the
cod-4460-fix-fifo-issues-reported-by-firefox
branch
November 26, 2026 15:09
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.
TLDR: Leftover
/tmp/runner.{ctl,ack}.fifofiles with no runner madeinstrument_hooks_init()block ~4 s before falling back to no instrument; init now detects the missing reader and falls back immediately (POSIX only).Pipe.hasReader: non-blockingO_WRONLYopen of the control FIFO, which fails withENXIOwhen nobody reads it.RunnerFifo.initreturnserror.NoRunnerin that case. A live runner holds the FIFO open, so it is unaffected.validate_protocol_versionnow returnsAckTimeoutinstead of continuing intoGetIntegrationMode, which would time out too. Swallowing it (1460da1) was only meant to avoidexit(1);Instrument.initalready falls back to the no-op instrument. Every runner that knowsGetIntegrationModealso knowsSetVersion, so continuing never helped.FifoInstrument.initcloses the FIFOs when the version check fails, draining late acks before the next probe.dist/core.cregenerated withjust release. Most of its diff is symbol renumbering, which also appears when regeneratingmainunchanged with Zig 0.14.1.instrument_hooks_init()from a C program linkingdist/core.c:mkfifo)Fixes #36