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

ticker.Reset can cause SIGSEGV segmentation violation #69351

Closed
gnvk opened this issue Sep 9, 2024 · 2 comments
Closed

ticker.Reset can cause SIGSEGV segmentation violation #69351

gnvk opened this issue Sep 9, 2024 · 2 comments

Comments

@gnvk
Copy link

gnvk commented Sep 9, 2024

Go version

go version go1.23.1 darwin/arm64

Output of go env in your module/workspace:

GO111MODULE=''
GOARCH='arm64'
GOBIN=''
GOCACHE='/Users/gnvk/Library/Caches/go-build'
GOENV='/Users/gnvk/Library/Application Support/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='arm64'
GOHOSTOS='darwin'
GOINSECURE=''
GOMODCACHE='/Users/gnvk/Dev/go/pkg/mod'
GONOPROXY='github.com/alpacahq/*'
GONOSUMDB='github.com/alpacahq/*'
GOOS='darwin'
GOPATH='/Users/gnvk/Dev/go'
GOPRIVATE='github.com/alpacahq/*'
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/opt/homebrew/Cellar/go/1.23.1/libexec'
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLCHAIN='local'
GOTOOLDIR='/opt/homebrew/Cellar/go/1.23.1/libexec/pkg/tool/darwin_arm64'
GOVCS=''
GOVERSION='go1.23.1'
GODEBUG=''
GOTELEMETRY='local'
GOTELEMETRYDIR='/Users/gnvk/Library/Application Support/go/telemetry'
GCCGO='gccgo'
GOARM64='v8.0'
AR='ar'
CC='cc'
CXX='c++'
CGO_ENABLED='1'
GOMOD='/Users/gnvk/Dev/alpaca/bt/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/xv/5sz1kn411vb_g2_vmhnstl1c0000gn/T/go-build1871065581=/tmp/go-build -gno-record-gcc-switches -fno-common'

What did you do?

After a some investigation I finally managed to reproduce a strange SIGSEGV: segmentation violation error.

package main

import "time"

type timeTicker struct {
	time.Ticker
}

func main() {
	t := timeTicker{
		Ticker: *time.NewTicker(time.Second),
	}
	t.Reset(time.Second)
}

What did you see happen?

Running the above program with go 1.22 exits with 0. With go 1.23 it crashes with

fatal error: unexpected signal during runtime execution
[signal SIGSEGV: segmentation violation code=0x2 addr=0x0 pc=0x10499b8dc]

and a goroutine trace. In this reproducible example it's obvious from the stack trace that the segfault is caused by the ticker.Reset call, but this was not the case in the original!

What did you expect to see?

Exit 0.

@seankhliao
Copy link
Member

Duplicate of #69186

@seankhliao seankhliao marked this as a duplicate of #69186 Sep 9, 2024
@seankhliao seankhliao closed this as not planned Won't fix, can't repro, duplicate, stale Sep 9, 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