Skip to content

fix: 'fatal error: concurrent map read and map write' crash#144

Merged
sebastianrakel merged 1 commit intovoxpupuli:mainfrom
jenxie:fix-getconfig-crash
Mar 17, 2026
Merged

fix: 'fatal error: concurrent map read and map write' crash#144
sebastianrakel merged 1 commit intovoxpupuli:mainfrom
jenxie:fix-getconfig-crash

Conversation

@jenxie
Copy link
Copy Markdown
Contributor

@jenxie jenxie commented Mar 12, 2026

GetConfig() was called on every HTTP request, meaning concurrent requests would all try to initialize Viper's config at the same time, causing a 'fatal error: concurrent map read and map write' crash.

Wrapped the initialization in sync.Once so it runs exactly once at startup and the result is cached for all subsequent calls, crashes no longer occurs.

@bootc
Copy link
Copy Markdown
Contributor

bootc commented Mar 17, 2026

Tested locally and works for me, thanks.

@sebastianrakel sebastianrakel merged commit 46c277c into voxpupuli:main Mar 17, 2026
1 check passed
@jenxie jenxie deleted the fix-getconfig-crash branch March 17, 2026 16:50
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.

3 participants