Skip to content

Make test log prefixes collision-resistant - #1764

Open
sekaiser wants to merge 1 commit into
oxidecomputer:mainfrom
sekaiser:fix-479-log-prefix
Open

sekaiser wants to merge 1 commit into
oxidecomputer:mainfrom
sekaiser:fix-479-log-prefix

Conversation

@sekaiser

@sekaiser sekaiser commented Nov 14, 2026 •

Copy link
Copy Markdown

Repeated test executions can reuse a process ID and restart the per-process counter, selecting a log left behind by a failed run (oxidecomputer/omicron#1936). Generate a fresh UUIDv4 per log_prefix_for_test() invocation so each prefix has its own random discriminator, independent of PID reuse and counter resets.

The filename format changes to {executable}-{test_name}.{pid}.{counter}.{uuid}.log, adding 33 characters with a 32-character hexadecimal UUID. Names are collision-resistant; generating a name creates or reserves no filesystem entry. Logger creation failures now include the test label, resolved configuration and destination, and original I/O error. Public signatures, temporary-directory selection, opening policies, and failure-artifact retention remain unchanged.

Reviewed Omicron at b65d3b429172b2b10ce1c4304f64de4405750560: trust-quorum, oximeter/db, and ClickHouse utilities consume prefixes opaquely. Directory-only callers retain their independently chosen paths. Reviewed concrete names, including suffixes and maximum-width PID/counter fields, remain below 255 bytes after the addition. No Omicron changes or truncation are needed.

Fixes #479

Add a fresh UUIDv4 discriminator to each generated test log prefix. Include the test label, resolved logging configuration, and underlying error when logger creation fails, with a focused regression test for the contextual panic. Preserve existing file-opening policies and cleanup behavior.

Fixes oxidecomputer#479
@sekaiser
sekaiser marked this pull request as ready for review November 14, 2026 09:29
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.

LogContext paths could be more unique

1 participant