After a reboot, the Inbox doesn't reclaim its own tailscale serve mappings ("Another tailscale serve mapping already uses port …")

Open
#3,591 1 comment 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
65/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
typescript

Research direction

Find chooseTailnetDoorPort and the code that checks existing tailscale serve mappings against the Inbox's records. Read how ownership is determined when the target port has no listener after restart, then follow the Inbox startup path for both its own port and the 8443 door. Done when matching recorded mappings are reclaimed or re-pointed on start and unrelated mappings are still refused.

Written by the indexing model from the issue text.

Description

After a reboot, the Inbox doesn't reclaim its own tailscale serve mappings ("Another tailscale serve mapping already uses port …")

Environment: plannotator 0.28.67 on two Macs (macOS), Tailscale for Mac, the same tailnet and account. Both Inboxes are published on the tailnet ("inboxTailscale": true) and linked to each other (plannotator inbox link), "online, both ways" before the reboot.

What happens

Tailscale keeps background serve mappings across a reboot. After one Mac was rebooted, its Inbox no longer treated the mappings it had made itself as its own:

  1. The Inbox's own port. plannotator inbox printed:

    Not published over your tailnet: Another tailscale serve mapping already uses port 57113, the Inbox's port. The Inbox never replaces it: remove it with "tailscale serve --https=57113 off" if nothing needs it.

    tailscale serve status showed https://<mac>.<tailnet>.ts.net:57113 → proxy http://127.0.0.1:57245, and nothing listened on 57245 (lsof -nP -iTCP:57245 -sTCP:LISTEN empty). It was the Inbox's own mapping from before the reboot.

  2. The link door (8443). https://<mac>.<tailnet>.ts.net:8443 → proxy http://127.0.0.1:57298, the same target the door used before. After tailscale serve --https=57113 off and plannotator inbox restart, the Inbox published on 57113 but still did not listen on 57298, and plannotator inbox link --list flagged this computer: "Another tailscale serve mapping now uses port 8443, where linked machines reach this Inbox. The Inbox never replaces it…".

  3. Only after tailscale serve --https=8443 off and a second plannotator inbox restart did it listen on 57298 again. It re-created the 8443 mapping with the same target, and the link came back "online, both ways".

So a reboot takes two rounds of tailscale serve … off plus plannotator inbox restart by hand.

The other Mac had not been rebooted, but its Inbox had been restarted since the mapping was made. It had the first case too: its port 58793 mapped to 127.0.0.1:57747, where nothing listened, and tailnet_url was null until the mapping was removed and the Inbox restarted.

Expected

A mapping on the Inbox's own port or its door port that points at a loopback port nothing listens on, and that this Inbox made (it matches its records), is reclaimed or re-pointed at start, instead of being refused as someone else's. In chooseTailnetDoorPort, a record whose target is unchanged should count as own even when nothing is listening yet after a restart.

Workaround
tailscale serve status                 # find the Inbox's port and 8443 mapped to a dead 127.0.0.1 port
tailscale serve --https=<port> off     # the Inbox's port, then 8443 if link --list still complains
plannotator inbox restart
Dominant language
TypeScript
Stars
8.7k
Forks
649
Avg merge
16h 1m
Merged PRs (30d)
756

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from backnotprop/plannotator

All issues in backnotprop/plannotator

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.