activator/client: handle device full when tunnel IDs exhausted#3266
Open
martinsander00 wants to merge 4 commits intomainfrom
Open
activator/client: handle device full when tunnel IDs exhausted#3266martinsander00 wants to merge 4 commits intomainfrom
martinsander00 wants to merge 4 commits intomainfrom
Conversation
Add max capacity to IDAllocator (tunnel IDs 500-627) so the activator gracefully rejects users when a device runs out of tunnel IDs instead of allocating beyond the valid range. Update the CLI to detect rejection status during provisioning and surface the rejection reason as an error.
packethog
reviewed
Mar 15, 2026
packethog
requested changes
Mar 16, 2026
Comment on lines
+53
to
54
| tunnel_ids: IDAllocator::with_max(500, 499 + device.max_users, vec![]), | ||
| tunnel_endpoints_in_use: HashMap::new(), |
Contributor
There was a problem hiding this comment.
This isn't going to work if it's done at start time. If a device is currently drained (i.e. max users = 0), activator restarts then the contributor changes max users to 128, the tunnel ID allocator still still be at 0.
Either leaving the implementation as is and relying on Steven's fix to deallocated tunnel IDs properly or if activate requests are always serialized, using onchain state only to allocate the next tunnel both seem like better fixes.
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 of Changes
Diff Breakdown
Majority of new lines are tests for the bounded allocator; core logic is compact.
Key files (click to expand)
activator/src/idallocator.rs— addwith_maxconstructor andOption<u16>return fromnext_available; 3 new test cases for bounded allocationclient/doublezero/src/command/connect.rs— stop polling onRejectedstatus; return rejection reasons as an error instead of silently succeedingactivator/src/process/user.rs— handleNonefrom tunnel ID allocation by rejecting the user with a descriptive onchain log messageactivator/src/states/devicestate.rs— cap tunnel IDs at 627 viaIDAllocator::with_maxactivator/src/process/iface_mgr.rs— unwrapOptionwith descriptive panic for segment routing IDsactivator/src/process/link.rs— unwrapOptionwith descriptive panic for link IDsTesting Verification
IDAllocatorunit tests pass, including 3 new tests covering bounded allocation (upper bound respected, gap filling, exhaustion)Errwith reason detail, ensuringdoublezero connectexits non-zero on device-full rejection