-
Notifications
You must be signed in to change notification settings - Fork 295
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
WrapHandleFunc: Data race when running HTTP server in a goroutine #957
Comments
is this happening inside a container or AWS runtime environment or something, or does it happen if running the code on an ordinary workstation shell? |
I tried running your code example but did not see the race condition show up so far. Using go version go1.23.0 darwin/arm64. Will continue trying to reproduce the error. |
It happens in VSCode terminal, native OS terminal and iTerm2. I don't use Docker for this. I hope you are using |
Thanks. Yes, I'm using |
Just realised, it even happens when not using goroutine at all. Bottom part is like this: ...
// HTTP server
srv := &http.Server{Handler: rtr, Addr: ":1234"}
slog.Debug("Server started")
if err := srv.ListenAndServe(); err != nil && err != http.ErrServerClosed {
slog.Error("Server start", "error", err)
} else {
slog.Debug("Server shutdown")
}
} |
I'm still not able to reproduce your error on my end, which may simply be a matter of timing. However, when analyzing the code flow that you're reporting, I believe I see where a race condition might be possible so I'm addressing that to see if that resolves what you're seeing. |
I have merged a proposed fix to our |
Working fine now. Thank you. REF:
|
Hi,
When starting the HTTP server in a goroutine (
ListenAndServe()
), NewRelic causes data race. If you take it out, it is fine. What is the problem here and a solution please?Thanks
go version go1.23.0 darwin/amd64
The text was updated successfully, but these errors were encountered: