You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
RegisterDecoder races with concurrent stream decoding #886
ssestream.RegisterDecoder mutates the package-level decoder registry while ssestream.NewDecoder reads the same map without synchronization. Because both functions are public and no init-only restriction is documented, registering a decoder while requests are opening streams can race and can terminate the process with fatal error: concurrent map writes.
Reproduction
On current main at 66688d6990b364431e7698d9466180bd9db3dc93, run concurrent RegisterDecoder calls alongside NewDecoder calls under the race detector:
go test -race reports reads in NewDecoder racing with writes in RegisterDecoder; the reproduction can also terminate with fatal error: concurrent map writes.
Expected behavior
The public decoder registry should be safe to read while another goroutine registers a decoder. A small read/write lock around registry access is sufficient; decoder execution itself should remain outside the lock.
Activity