Files
magpie/docs
yetone 3af592f587 gateway: the overflow memory is read under its lock, so two requests of one conversation don't crash the gateway (#3453)
Review follow-up to ggbdpq's 075aaef62. behindOverflow took the
conversation's inner map under overflowLearned's lock, let go, and then
read it, while noteOverflow and forgetOverflow write that same map under
the lock. Two requests of one conversation at once (a turn beside its
title ask, a client's retry) read and wrote one Go map together, which
is a fatal "concurrent map read and map write", the whole gateway gone.
The loop now runs under the lock.

TestOverflowMemoryReadWhileNoted notes and forgets on one goroutine while
another orders members by the memory. Before this commit, on mote:
go test -tags nogui -race -count=1 -run TestOverflowMemoryReadWhileNoted
./internal/gateway/ -> "--- FAIL: TestOverflowMemoryReadWhileNoted ...
race detected during execution of test". With it, -race -count=20 of
that test, TestOverflowRefusedOnceIsAskedLast and
TestRelayInputCapGoesToTheNextMember: ok.

Also: behindOverflow's comment said resting members keep their order;
the code moves a refused member behind every other one, resting or not,
so the sentence is dropped. gateway-routing.md now describes the memory
beside withRoom's overflow paragraph.
2026-11-01 16:43:21 +08:00
..