Skip to content

host: guard discoverd config setup in SetDefaultEnv to fix data race - #10

Merged
phaus merged 1 commit into
mainfrom
fix/setdefaultenv-race
Sep 4, 2026
Merged

host: guard discoverd config setup in SetDefaultEnv to fix data race#10
phaus merged 1 commit into
mainfrom
fix/setdefaultenv-race

Conversation

@phaus

@phaus phaus commented Sep 4, 2026

Copy link
Copy Markdown
Member

SetDefaultEnv wrote discoverdClient and closed discoverdConfigured outside of the envMtx lock. If SetDefaultEnv were called concurrently with the DISCOVERD key, this could race on discoverdClient and, more critically, panic on a double close of the channel.

Serialize the DISCOVERD handling under envMtx and track whether the channel has already been closed so it is only closed once.

SetDefaultEnv wrote discoverdClient and closed discoverdConfigured
outside of the envMtx lock. If SetDefaultEnv were called concurrently
with the DISCOVERD key, this could race on discoverdClient and, more
critically, panic on a double close of the channel.

Serialize the DISCOVERD handling under envMtx and track whether the
channel has already been closed so it is only closed once.
@phaus
phaus merged commit 94f6ba5 into main Sep 4, 2026
2 checks passed
@phaus
phaus deleted the fix/setdefaultenv-race branch September 4, 2026 09:05
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