Skip to content

fix(logger): make SetDefaultLogger safe to call concurrently - #375

Open
fridokus wants to merge 1 commit into
emiago:mainfrom
fridokus:atomic-default-logger
Open

fridokus wants to merge 1 commit into
emiago:mainfrom
fridokus:atomic-default-logger

Conversation

@fridokus

@fridokus fridokus commented Oct 5, 2026

Copy link
Copy Markdown

SetDefaultLogger writes a plain variable that connection goroutines read through DefaultLogger(), so calling it while the stack is running is a data race. This stores it in an atomic.Pointer.

The new test fails under go test -race ./sip without the change.

SetDefaultLogger wrote a plain variable that connection goroutines read via
DefaultLogger, a data race if it is called once the stack is running. Store
it in an atomic.Pointer.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant