Skip to content

ipn, portlist: pause portlist poller when Tailscale state is Stopped #866

Open

Description

@bradfitz

We currently always run the portlist poller, even if Tailscale is stopped.

This is a bit of a waste of effort.

(fortunately we don't do it on iOS, but we do on Android, as Android is slightly more likely to be running a server than iOS)

We should wire up the ipn/magicsock/etc idle inactivity state to the portlist, to pause it when things are idle.

Activity

  1. added
    OS-android
    on Oct 28, 2020
  2. added
    L5 All users
    and removed
    L2 Few
    on Feb 12, 2023
  3. twcclegg commented on Nov 29, 2026

    @twcclegg

    This still reproduces on main, LocalBackend keeps the last netmap while Stopped, CollectServices stays true, so the portlist extension keeps enumerating ports every PollInterval while Tailscale is stopped. A test sees ~20 polls in 200ms after SetState(ipn.Stopped) with a shortened interval.

    Proposed fix: register a BackendStateChange hook in feature/portlist (same pattern as feature/captiveportal) and pause the poller, stopping its ticker, whenever the state isn't Starting or Running, then wake it to poll immediately on return. The wake channel becomes 1-buffered so a wake can't be lost while the loop is between checking the state and blocking.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    L5 All usersOS-androidP1 NuisanceT3 Performance/Debuggingbattery

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions