Parallelize fork network setup#266
Merged
Merged
Conversation
0e63fd2 to
4d71b40
Compare
f52d030 to
e44d81e
Compare
e44d81e to
fa56b15
Compare
Monitoring Plan: Async Network Rate Limiting and Allocation RefactorWhat this PR does: Reduces VM launch latency by making network bandwidth configuration non-blocking — TAP devices are created synchronously but TC rate-limit rules are applied in the background, allowing the VMM to proceed immediately. Intended effect:
Risks:
Status updates will be posted automatically on this PR as monitoring progresses. |
…-parallel-v2 # Conflicts: # lib/network/allocate.go # lib/network/bridge_linux.go # lib/network/tracing.go
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 41c530e. Configure here.
rgarcia
approved these changes
Jun 1, 2026
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.

Summary
Tests
Note
Medium Risk
Changes concurrency, pending allocation visibility, and async tc vs release ordering on shared bridge state; mistakes could cause duplicate identities, stale HTB classes, or briefly unshaped traffic after fork.
Overview
Fork/restore network setup is split into a fast blocking path and deferred shaping, so concurrent forks no longer serialize on bridge
tcwork.CreateAllocationandRecreateAllocationnow reserve name/IP/MAC/TAP under a short mutex (with pending allocations visible toNameExists/GetAllocationbefore metadata is written), create and bridge the TAP synchronously, and enqueue download/upload limits on a background goroutine guarded bytcMu. TAP creation no longer applies rate limits inline; LinuxcreateTAPDeviceonly brings up the interface. Release takestcMuwhen deleting TAPs so asynctccannot race HTB cleanup, and delete prefers the persisted class ID. Default bridge details are cached after init to avoid repeated netlink queries. Detached OTel spans cover async rate-limit work so restore/request traces show only blocking network steps. Docs and unit tests cover pending state, class ID on delete, and detached tracing.Reviewed by Cursor Bugbot for commit 5a26c31. Bugbot is set up for automated code reviews on this repo. Configure here.