Skip to content

import/path: getting panic: d.nx != 0 when call md5.Sum in goroutines #70917

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

Closed
maxakeheomax opened this issue Dec 19, 2024 · 2 comments
Closed

Comments

@maxakeheomax
Copy link

Go version

go1.23

Output of go env in your module/workspace:

GO111MODULE='on'
GOARCH='arm64'
GOBIN='/Users/boldyrev/go/bin'
GOCACHE='/Users/boldyrev/Library/Caches/go-build'
GOENV='/Users/boldyrev/Library/Application Support/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='arm64'
GOHOSTOS='darwin'
GOINSECURE='gitlab.com'
GOMODCACHE='/Users/boldyrev/go/pkg/mod'
GONOPROXY='none'
GONOSUMDB='stash.tutu.ru,'
GOOS='darwin'
GOPATH='/Users/boldyrev/go'
GOPRIVATE='stash.tutu.ru,'
GOPROXY='http://goproxy.tutu.ru'
GOROOT='/usr/local/go'
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/usr/local/go/pkg/tool/darwin_arm64'
GOVCS=''
GOVERSION='go1.23.2'
GODEBUG=''
GOTELEMETRY='local'
GOTELEMETRYDIR='/Users/boldyrev/Library/Application Support/go/telemetry'
GCCGO='gccgo'
GOARM64='v8.0'
AR='ar'
CC='clang'
CXX='clang++'
CGO_ENABLED='1'
GOMOD='/Users/boldyrev/Desktop/Projects.tmp/broker/br-accounts/go.mod'
GOWORK=''
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
PKG_CONFIG='pkg-config'
GOGCCFLAGS='-fPIC -arch arm64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -ffile-prefix-map=/var/folders/5t/1r88rzyj1s10t97_sx_k6l140000gp/T/go-build1432854356=/tmp/go-build -gno-record-gcc-switches -fno-common'

What did you do?

I use md5 generation for getting hashes for business segments. In production I have several goroutines for this.
https://go.dev/play/p/4V9wMX0xO-w

After small optimization:

func (h *Hasher) initHasher() {
	if h.hshr == nil {
		h.hshr = md5.New()

		return
	}

	h.hshr.Reset()
}

I start getting panics. If I return making md5.New() each time before getting .Sum(nil) — it works fine.

What did you see happen?

Im getting panics when asynchronously trying to calculate hashes.

What did you expect to see?

I expecting to see a working async hash generation using .Reset() function before calling .Sum() or explanation why it is not working :)

@seankhliao
Copy link
Member

sounds like a race condition in your code

Unlike many projects, the Go project does not use GitHub Issues for general discussion or asking questions. GitHub Issues are used for tracking bugs and proposals only.

For questions please refer to https://github.com/golang/go/wiki/Questions

@seankhliao seankhliao closed this as not planned Won't fix, can't repro, duplicate, stale Dec 19, 2024
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

No branches or pull requests

3 participants