Skip to content

fix(server): resolve atomic value panic during config swap - #7

Open
parastejpal987-cmyk wants to merge 1 commit into
jahmeergnlt:mainfrom
parastejpal987-cmyk:fix/traefik-atomic-panic
Open

fix(server): resolve atomic value panic during config swap#7
parastejpal987-cmyk wants to merge 1 commit into
jahmeergnlt:mainfrom
parastejpal987-cmyk:fix/traefik-atomic-panic

Conversation

@parastejpal987-cmyk

Copy link
Copy Markdown

What does this PR do?

Fixes a concurrency panic that occurs when atomic.Value attempts to store a different concrete type than what was initially stored.

Why is it necessary?

During rapid configuration reloads, the underlying type of the HTTP handler being stored in server.go could sometimes vary between different http.Handler implementations. Go's sync/atomic.Value panics if you try to store a value of a different concrete type than the first one stored.

How does it work?

Introduced a handlerWrapper struct to encapsulate the handler. By storing the wrapper instead of the raw handler, atomic.Value always receives the exact same concrete type, safely avoiding the panic while swapping configurations.

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