-
Notifications
You must be signed in to change notification settings - Fork 18k
net/http: fatal error: concurrent map iteration and map write transport.go #58494
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
Comments
that's just the iteration, no map write. |
I'm sharing the client, but the code where I share the client is synchronous, it shouldn't affect it |
This sort of racy map operation is one of the kinds of races that the Go race detector diagnoses. If you run your program under that, it should print a stack trace for whatever goroutine is writing to the map. Please do that, and let us know what the race detector reports. |
I'll do it, thank you |
Timed out in state WaitingForInfo. Closing. (I am just a bot, though. Please speak up if this is a mistake or you have the requested information.) |
I have a same issue too, when I am trying to benchmarking with 400 virtual user / second for 40 second |
Could you provide a full example for us to reproduce this issue? |
actually, I just found the solution of this issue for my case, that was happen because I have implement some defer function in my code. I don't know for detail, but that issue fixed after I remove that defer function. |
For more context for my case, I was making multiple requests at the same time to a single domain |
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
yes
What operating system and processor architecture are you using (
go env
)?set GO111MODULE= set GOARCH=amd64 set GOBIN= set GOCACHE=C:\Users\user\AppData\Local\go-build set GOENV=C:\Users\user\AppData\Roaming\go\env set GOEXE=.exe set GOEXPERIMENT= set GOFLAGS= set GOHOSTARCH=amd64 set GOHOSTOS=windows set GOINSECURE= set GOMODCACHE=C:\Users\user\go\pkg\mod set GONOPROXY= set GONOSUMDB= set GOOS=windows set GOPATH=C:\Users\user\go set GOPRIVATE= set GOPROXY=https://proxy.golang.org,direct set GOROOT=C:\Program Files\Go set GOSUMDB=sum.golang.org set GOTMPDIR= set GOTOOLDIR=C:\Program Files\Go\pkg\tool\windows_amd64 set GOVCS= set GOVERSION=go1.20 set GCCGO=gccgo set GOAMD64=v1 set AR=ar set CC=gcc set CXX=g++ set CGO_ENABLED=0 set GOMOD=D:\upwork\andrew\lawplus\go.mod set GOWORK= set CGO_CFLAGS=-O2 -g set CGO_CPPFLAGS= set CGO_CXXFLAGS=-O2 -g set CGO_FFLAGS=-O2 -g set CGO_LDFLAGS=-O2 -g set PKG_CONFIG=pkg-config set GOGCCFLAGS=-m64 -fno-caret-diagnostics -Qunused-arguments -Wl,--no-gc-sections -fmessage-length=0 -fdebug-prefix-map=C:\Users\user\AppData\Local\Temp\go-build3669119433=/tmp/go-build -gno-record-gcc-switches
OutputWhat did you do?
Making multiple requests at the same time.
the transport information I'm using is:
Not a reproducable error because the code is big and it happens on random times
What did you expect to see?
Code runnign well
What did you see instead?
When looking at the code where the error is being produced, I get the error is here:

so probally it's because go is trying to write/iterate to the header which is underline type is a map, and it's not using any mutex
The text was updated successfully, but these errors were encountered: