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

runtime: bad sweepgen in refill #64492

Closed
yang-f opened this issue Dec 1, 2023 · 9 comments
Closed

runtime: bad sweepgen in refill #64492

yang-f opened this issue Dec 1, 2023 · 9 comments
Labels
compiler/runtime Issues related to the Go compiler and/or runtime. NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.

Comments

@yang-f
Copy link

yang-f commented Dec 1, 2023

Go version

1.21.3 amd64

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

GO111MODULE=''
GOARCH='amd64'
GOBIN=''
GOCACHE='/home/if/.cache/go-build'
GOENV='/home/if/.config/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='amd64'
GOHOSTOS='linux'
GOINSECURE=''
GOMODCACHE='/home/if/go/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='linux'
GOPATH='/home/if/go'
GOPRIVATE=''
GOPROXY='direct'
GOROOT='/home/if/workspace/go'
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/home/if/workspace/go/pkg/tool/linux_amd64'
GOVCS=''
GOVERSION='go1.21.3'
GCCGO='gccgo'
GOAMD64='v1'
AR='ar'
CC='gcc'
CXX='g++'
CGO_ENABLED='1'
GOMOD='/dev/null'
GOWORK=''
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
PKG_CONFIG='pkg-config'

What did you do?

our service in production, just alloc a new object in func, and we use cgo in our go program.

func xxx() *TypeOfV {
    v := TypeOfV{}
    ...
    return &TypeOfV
}

What did you expect to see?

no panic

What did you see instead?

panic like this:
截屏2023-12-01 10 54 20

and the mspan content is:
截屏2023-12-01 15 25 16

s.sweepgen and mheap_.sweepgen all is 691856, and the state of mspan is mSpanDead means the mspan just been sweept,and alloccount == nelems == 102

@gopherbot gopherbot added the compiler/runtime Issues related to the Go compiler and/or runtime. label Dec 1, 2023
@yang-f
Copy link
Author

yang-f commented Dec 1, 2023

releated issue:

@mauri870 mauri870 added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Dec 1, 2023
@mauri870
Copy link
Member

mauri870 commented Dec 1, 2023

cc @golang/runtime

@mauri870
Copy link
Member

mauri870 commented Dec 1, 2023

@yang-f can you better describe what is your use case with CGO, to try and narrow down the issue?

@mauri870 mauri870 added the WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. label Dec 1, 2023
@yang-f
Copy link
Author

yang-f commented Dec 1, 2023

@yang-f can you better describe what is your use case with CGO, to try and narrow down the issue?

I'm not sure whether the panic has anything related to cgo. After all, there is no cgo-related stack in the stack, but I see that many similar issues are caused by cgo, so I specially proposed it. fdb and rocksdb are used in our service, and these dependencies use cgo to load fdb.so/rocksdb.so

@yang-f
Copy link
Author

yang-f commented Dec 5, 2023

ping @mauri870

@mauri870
Copy link
Member

mauri870 commented Dec 5, 2023

Without a repro will be very hard to identify the issue

cc @cherrymui

@mknyszek
Copy link
Contributor

mknyszek commented Dec 5, 2023

@yang-f In the future, please post text and not images. It makes it much harder to interact with (e.g. searching for snippets in the codebase, etc.) and less accessible.

I agree with @mauri870 that without a reproducer it's going to be hard to identify what the issue is. You mentioned the architecture is amd64 -- what is the OS? (You linked to an image of a linux-riscv64 failure, but there are usually some platform-specific issues on non-first-class ports, so I don't think we can make any conclusion based on that necessarily.)

I can take some shots in the dark, but again, it's hard to say without more details and/or a reproducer.

@yang-f
Copy link
Author

yang-f commented Dec 6, 2023

@yang-f In the future, please post text and not images. It makes it much harder to interact with (e.g. searching for snippets in the codebase, etc.) and less accessible.

I agree with @mauri870 that without a reproducer it's going to be hard to identify what the issue is. You mentioned the architecture is amd64 -- what is the OS? (You linked to an image of a linux-riscv64 failure, but there are usually some platform-specific issues on non-first-class ports, so I don't think we can make any conclusion based on that necessarily.)

I can take some shots in the dark, but again, it's hard to say without more details and/or a reproducer.

@mknyszek, this is not the actual stack, only copy from related issue has same stack, the stack of our panic is like this:

fatal error: bad sweepgen in refill

runtime stack:
runtime.throw({0x1022a048c?, 0x7ff7bfefe960?})
	/usr/local/Cellar/go/1.20.5/libexec/src/runtime/panic.go:1047 +0x5d fp=0x7ff7bfefe608 sp=0x7ff7bfefe5d8 pc=0x10223cdfd
runtime.(*mcache).refill(0x1002475b8, 0x0?)
	/usr/local/Cellar/go/1.20.5/libexec/src/runtime/mcache.go:157 +0x216 fp=0x7ff7bfefe648 sp=0x7ff7bfefe608 pc=0x10221fdb6
runtime.(*mcache).nextFree(0x1002475b8, 0xe)
	/usr/local/Cellar/go/1.20.5/libexec/src/runtime/malloc.go:855 +0x85 fp=0x7ff7bfefe690 sp=0x7ff7bfefe648 pc=0x102217f45
runtime.mallocgc(0x48, 0x1022d2120, 0x1)
	/usr/local/Cellar/go/1.20.5/libexec/src/runtime/malloc.go:1042 +0x455 fp=0x7ff7bfefe6f8 sp=0x7ff7bfefe690 pc=0x102218535
runtime.newobject(0x2f752?)
...

the upper stack is like below, just allocate a new object in a function, the os is centos7/amd64, i can not give a smallest piece of code to recurrence it because the frequency of its occurrence in our environment is very low:

func xxx() *TypeOfV {
    v := TypeOfV{}
    ...
    return &TypeOfV
}

@seankhliao seankhliao added WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. and removed WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. labels Dec 8, 2023
@gopherbot
Copy link
Contributor

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.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler/runtime Issues related to the Go compiler and/or runtime. NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Projects
None yet
Development

No branches or pull requests

5 participants