[Bug] Sequential IP allocator increments when API register request fails #1061

Closed
opened 2025-12-29 02:28:02 +01:00 by adam · 3 comments
Owner

Originally created by @djholt on GitHub (Jul 12, 2025).

Originally assigned to: @nblock on GitHub.

Is this a support request?

  • This is not a support request

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

Sequential IP allocator increments and persists when key registration fails via API request.

Expected Behavior

If request fails for one of several reasons (e.g. invalid user, invalid key), IP allocator should not permanently increment since a node was never created.

Steps To Reproduce

  1. Attempt key registration with an invalid user value (one or more times).
  2. Attempt valid key registration. Note that assigned IP was incremented unnecessarily for each failed attempt above.

Environment

- OS: Debian
- Headscale version: 0.26.1
- Tailscale version: n/a

Runtime environment

  • Headscale is behind a (reverse) proxy
  • Headscale runs in a container

Debug information

Let me know if further details are needed!

Originally created by @djholt on GitHub (Jul 12, 2025). Originally assigned to: @nblock on GitHub. ### Is this a support request? - [x] This is not a support request ### Is there an existing issue for this? - [x] I have searched the existing issues ### Current Behavior Sequential IP allocator increments and persists when key registration fails via API request. ### Expected Behavior If request fails for one of several reasons (e.g. invalid user, invalid key), IP allocator should not permanently increment since a node was never created. ### Steps To Reproduce 1. Attempt key registration with an invalid user value (one or more times). 2. Attempt valid key registration. Note that assigned IP was incremented unnecessarily for each failed attempt above. ### Environment ```markdown - OS: Debian - Headscale version: 0.26.1 - Tailscale version: n/a ``` ### Runtime environment - [x] Headscale is behind a (reverse) proxy - [ ] Headscale runs in a container ### Debug information Let me know if further details are needed!
adam added the bugdocumentation labels 2025-12-29 02:28:02 +01:00
adam closed this issue 2025-12-29 02:28:02 +01:00
Author
Owner

@kradalby commented on GitHub (Jul 13, 2025):

It will persisted until restart. It is "by design" as a simplification to not have to require the database in this path

@kradalby commented on GitHub (Jul 13, 2025): It will persisted until restart. It is "by design" as a simplification to not have to require the database in this path
Author
Owner

@kradalby commented on GitHub (Sep 9, 2025):

We should mark the "sequential" part of the config example/docs as "semi" or "best effort" sequential.

@kradalby commented on GitHub (Sep 9, 2025): We should mark the "sequential" part of the config example/docs as "semi" or "best effort" sequential.
Author
Owner

@nblock commented on GitHub (Oct 15, 2025):

This issue is fixed on main. Tested with 3fbde7a1b6.

One thing that remains is that Headscale will fill up holes in the IP address range. This happens when a node is deleted and later a new node joins.

@nblock commented on GitHub (Oct 15, 2025): This issue is fixed on main. Tested with 3fbde7a1b6636ff802f0ceff3d1546ef8a5d0dec. One thing that remains is that Headscale will fill up holes in the IP address range. This happens when a node is deleted and later a new node joins.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/headscale#1061