headscale/hscontrol/mapper
Kristoffer Dalby 50e8b21471 mapper/batcher: fix pointer retention, done-channel init, and connected-map races
M7: Nil out trailing *connectionEntry pointers in the backing array
after slice removal in removeConnectionAtIndexLocked and send().
Without this, the GC cannot collect removed entries until the slice
is reallocated.

M1: Initialize the done channel in NewBatcher instead of Start().
Previously, calling Close() or queueWork before Start() would select
on a nil channel, blocking forever. Moving the make() to the
constructor ensures the channel is always usable.

M2: Move b.connected.Delete and b.totalNodes decrement inside the
Compute callback in cleanupOfflineNodes. Previously these ran after
the Compute returned, allowing a concurrent AddNode to reconnect
between the delete and the bookkeeping update, which would wipe the
fresh connected state.

M3: Call markDisconnectedIfNoConns on AddNode error paths. Previously,
when initial map generation or send timed out, the connection was
removed but b.connected retained its old nil (= connected) value,
making IsConnected return true for a node with zero connections.

Updates #2545
2026-03-14 02:52:28 -07:00
..
batcher.go mapper/batcher: fix pointer retention, done-channel init, and connected-map races 2026-03-14 02:52:28 -07:00
batcher_bench_test.go mapper: remove Batcher interface, rename to Batcher struct 2026-03-14 02:52:28 -07:00
batcher_concurrency_test.go mapper: remove Batcher interface, rename to Batcher struct 2026-03-14 02:52:28 -07:00
batcher_scale_bench_test.go mapper/batcher: add scale benchmarks 2026-03-14 02:52:28 -07:00
batcher_test.go mapper: remove Batcher interface, rename to Batcher struct 2026-03-14 02:52:28 -07:00
batcher_unit_test.go mapper/batcher: add regression tests for timer leak and Close lifecycle 2026-03-14 02:52:28 -07:00
builder.go all: fix golangci-lint issues (#3064) 2026-02-06 21:45:32 +01:00
builder_test.go all: fix golangci-lint issues (#3064) 2026-02-06 21:45:32 +01:00
mapper.go mapper: remove Batcher interface, rename to Batcher struct 2026-03-14 02:52:28 -07:00
mapper_test.go all: upgrade to Go 1.26rc2 and modernize codebase 2026-02-08 12:35:23 +01:00
tail_test.go all: upgrade to Go 1.26rc2 and modernize codebase 2026-02-08 12:35:23 +01:00