Skip to content
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

unicode/utf8: invalid memory address or nil pointer dereference #50346

Closed
yaa110 opened this issue Dec 25, 2021 · 3 comments
Closed

unicode/utf8: invalid memory address or nil pointer dereference #50346

yaa110 opened this issue Dec 25, 2021 · 3 comments
Labels
FrozenDueToAge WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.

Comments

@yaa110
Copy link

yaa110 commented Dec 25, 2021

What version of Go are you using (go version)?

$ go version
go version go1.17.5 linux/amd64

Does this issue reproduce with the latest release?

yes

What operating system and processor architecture are you using (go env)?

go env Output
$ go env
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/yaa110/.cache/go-build"
GOENV="/home/yaa110/.config/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/home/yaa110/go/pkg/mod"
GONOPROXY="git.cafebazaar.ir"
GONOSUMDB="git.cafebazaar.ir"
GOOS="linux"
GOPATH="/home/yaa110/go"
GOPRIVATE="git.cafebazaar.ir"
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GOVCS=""
GOVERSION="go1.17.5"
GCCGO="gccgo"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/home/yaa110/Projects/cdn-exporter/go.mod"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build3135926648=/tmp/go-build -gno-record-gcc-switches"

What did you do?

It happens periodically when a long-running service is run.

What did you expect to see?

No panic due to segfault

What did you see instead?

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x4f483e]
goroutine 219 [running]:
unicode/utf8.ValidString({0x0, 0xc001d9de78})
	/usr/local/go/src/unicode/utf8/utf8.go:514 +0x5e
github.com/prometheus/client_golang/prometheus.validateLabelValues({0xc002a980f0, 0x5, 0x55}, 0x9)
	/app/vendor/github.com/prometheus/client_golang/prometheus/labels.go:77 +0x185
github.com/prometheus/client_golang/prometheus.(*MetricVec).hashLabelValues(0xc0003c2150, {0xc002a980f0, 0xc001d9df20, 0x476eb4})
	/app/vendor/github.com/prometheus/client_golang/prometheus/vec.go:226 +0x47
github.com/prometheus/client_golang/prometheus.(*MetricVec).GetMetricWithLabelValues(0xc0003c2150, {0xc002a980f0, 0x5, 0x5})
	/app/vendor/github.com/prometheus/client_golang/prometheus/vec.go:192 +0x2d
github.com/prometheus/client_golang/prometheus.(*CounterVec).GetMetricWithLabelValues(...)
	/app/vendor/github.com/prometheus/client_golang/prometheus/counter.go:214
github.com/prometheus/client_golang/prometheus.(*CounterVec).WithLabelValues(0xc88080, {0xc002a980f0, 0x8, 0x1})
	/app/vendor/github.com/prometheus/client_golang/prometheus/counter.go:246 +0x25
@yaa110 yaa110 changed the title affected/package: unicode/utf8 unicode/utf8: invalid memory address or nil pointer dereference Dec 25, 2021
@mvdan
Copy link
Member

mvdan commented Dec 25, 2021

This sounds like some sort of memory corruption or data race, or perhaps some use of unsafe.

I would suggest you to ask in the forums first; see https://golang.org/wiki/Questions. This issue as-is doesn't point to a bug in Go itself, and there is no way to reproduce the crash or further investigate it.

@mvdan mvdan added the WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. label Dec 25, 2021
@yaa110
Copy link
Author

yaa110 commented Dec 25, 2021

@mvdan I checked the code again and it is due to a race condition with high probability. Thanks

@yaa110 yaa110 closed this as completed Dec 25, 2021
@golang golang locked and limited conversation to collaborators Dec 25, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Projects
None yet
Development

No branches or pull requests

4 participants
@yaa110 @mvdan @gopherbot and others