Make generated ids unique across processes - #10
Merged
Conversation
new_id derived uniqueness from a millisecond timestamp plus a process-global atomic counter. A process-backed runner spawns a fresh fabric-cli per call, so the counter resets to 1 every time and two concurrent runs in the same millisecond produced identical ids (runtime_id, invocation_id, and the artifact roots derived from them). Include the process id, which the OS keeps distinct across concurrently running processes, so ids stay unique on the process-backed path. Single fix point: new_id feeds request/environment/runtime/invocation/event ids. smoke_sdk_concurrency failed ~25% of runs before; 0/20 after. Signed-off-by: Ajay Thorve <athorve@nvidia.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Enterprise Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThe ChangesProcess ID in ID Generation
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~2 minutes 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
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.
Problem
runtime_id(andinvocation_id, plus the artifact roots derived from them) can collide between two concurrent runs on the process-backed path.smoke_sdk_concurrencyfails intermittently — ~3/12 runs in a local baseline.Root cause
new_idbuilds ids from a millisecond timestamp + a process-globalAtomicU64counter:The counter only differentiates ids within one process. A process-backed runner (
FabricClient(command=("cargo","run",…))) spawns a freshfabric-cliper call, so the counter resets to1every time. Two concurrent runs in the same millisecond both produce…-<millis>-1→ collision.Fix
Include
std::process::id(), which the OS keeps distinct across concurrently running processes, so ids stay unique across processes too.new_idis the single source for request/environment/runtime/invocation/event ids, so one change covers all. No new dependency.Verification
smoke_sdk_concurrency: 3/12 fail before → 0/20 after.cargo test --workspacegreen;smoke_cli/smoke_sdk/smoke_native_sdkpass (ids feed artifact dir names).-).Follow-up
Once this and the CI PR (#8) both land,
smoke_sdk_concurrencycan be re-added toci_python.yml(it's excluded there only because of this flake).Summary by CodeRabbit