Skip to content

fix: lock log sink against concurrent write and close #10668

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 14, 2023

Conversation

spikecurtis
Copy link
Contributor

fixes #10663

Copy link
Contributor Author

Current dependencies on/for this PR:

This stack of pull requests is managed by Graphite.

@spikecurtis spikecurtis force-pushed the spike/10663-race-sink-write-close branch from 31c8047 to fcd5e39 Compare November 14, 2023 12:24
Comment on lines -140 to +141
var logger slog.Logger
logger := slog.Make()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm assuming the zero value of a logger is fundamentally unsafe given exit func(int) may be nil.

Should this be a linter rule?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, it's fine. https://github.com/coder/slog/blob/f0c466fabe10641afdbcc629938df29f941b3d18/slog.go#L148

But, I still like using the constructor for consistency, and in the stacked PR I set it to something else anyway.

@spikecurtis spikecurtis merged commit dc4b1ef into main Nov 14, 2023
@spikecurtis spikecurtis deleted the spike/10663-race-sink-write-close branch November 14, 2023 12:38
@github-actions github-actions bot locked and limited conversation to collaborators Nov 14, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

flake: vscodessh logging
2 participants