Skip to content

fix(strelaypoolsrv): snapshot relays before saving (fixes #10799) - #10800

Closed
tianrking wants to merge 1 commit into
syncthing:mainfrom
tianrking:agent/snapshot-known-relays
Closed

tianrking wants to merge 1 commit into
syncthing:mainfrom
tianrking:agent/snapshot-known-relays

Conversation

@tianrking

Copy link
Copy Markdown

Purpose

Fixes #10799. handleRelayTest released mut before saveRelays iterated over knownRelays, allowing request processors and eviction callbacks to mutate the shared backing array concurrently. The change copies the relay slice while holding the lock, then writes the immutable snapshot after releasing it.

Testing

  • go test ./cmd/infra/strelaypoolsrv
  • go vet ./cmd/infra/strelaypoolsrv
  • go test -race ./cmd/infra/strelaypoolsrv (not runnable locally: the Windows environment has no CGO C compiler)

Documentation

Not user visible; no documentation change required.

@github-actions github-actions Bot added the bug A problem with current functionality, as opposed to missing functionality (enhancement) label Jul 16, 2026
@calmh calmh closed this in #10801 Jul 16, 2026
pull Bot pushed a commit to vdaular-dev/syncthing that referenced this pull request Jul 16, 2026
Fixes a couple of races on relay handling in the pool server.

Fixes syncthing#10799.
Closes syncthing#10800.

Signed-off-by: Jakob Borg <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug A problem with current functionality, as opposed to missing functionality (enhancement)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Data race in strelaypoolsrv: unsynchronized read of knownRelays while it is being mutated

2 participants