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: fatal error: found pointer to free object #47513

Closed
WiFeng opened this issue Aug 3, 2021 · 4 comments
Closed

runtime: fatal error: found pointer to free object #47513

WiFeng opened this issue Aug 3, 2021 · 4 comments

Comments

@WiFeng
Copy link

@WiFeng WiFeng commented Aug 3, 2021

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

$ go version
go1.15.6 linux/amd64

Does this issue reproduce with the latest release?

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

go env Output
$ go env
GO111MODULE="on"
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/work/.cache/go-build"
GOENV="/home/work/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/home/work/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/work/go"
GOPRIVATE=""
GOPROXY="https://goproxy.cn"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/dev/null"
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-build647819018=/tmp/go-build -gno-record-gcc-switches"

What did you do?

I built a version of my program with a minor code change, and run after first cleaning the go.sum file. I then deployed that version of the program to my staging environment, all linux/amd64 machines.
When it crash, I restart all program and it work correctly. I can not reproduce it.

What did you expect to see?

The program to start up normally on all hosts.

What did you see instead?

On about half of the hosts, the program crashed on startup with slight variations on this message:

0xc0000c65b0 free unmarked
0xc0000c6620 free marked zombie
000000c0000c6620: 223a226469227b5b 222c223539333731
000000c0000c6630: 38223a22656d616e 8de59389e6889ce6
000000c0000c6640: 229888e6918ce6a1 7765725f7369222c
000000c0000c6650: 2231223a22647261 657079745f63222c
000000c0000c6660: 70222c2230223a22 2230223a2264695f
000000c0000c6670: 6f6c635f7369222c 2c2231223a226b63
000000c0000c6680: 223a226570797422 000000005d7d2231
0xc0000c6690 free unmarked
0xc0000c6700 free unmarked
0xc0000c6770 free unmarked
0xc0000c67e0 free unmarked
0xc0000c6850 free unmarked
0xc0000c68c0 free unmarked
0xc0000c6930 free unmarked
0xc0000c69a0 free unmarked
0xc0000c6a10 free unmarked
0xc0000c6a80 free unmarked
0xc0000c6af0 free unmarked
0xc0000c6b60 free unmarked
0xc0000c6bd0 free unmarked
0xc0000c6c40 free unmarked
0xc0000c6cb0 free unmarked
0xc0000c6d20 free unmarked
0xc0000c6d90 free unmarked
0xc0000c6e00 free unmarked
0xc0000c6e70 free unmarked
0xc0000c6ee0 free unmarked
0xc0000c6f50 alloc marked
0xc0000c6fc0 free unmarked
0xc0000c7030 free unmarked
0xc0000c70a0 free unmarked
0xc0000c7110 free unmarked
0xc0000c7180 free unmarked
0xc0000c71f0 free unmarked
0xc0000c7260 free unmarked
0xc0000c72d0 free unmarked
0xc0000c7340 free unmarked
0xc0000c73b0 free unmarked
0xc0000c7420 free unmarked
0xc0000c7490 free unmarked
0xc0000c7500 free unmarked
0xc0000c7570 free unmarked
0xc0000c75e0 free unmarked
0xc0000c7650 free unmarked
0xc0000c76c0 free unmarked
0xc0000c7730 free unmarked
0xc0000c77a0 free unmarked
0xc0000c7810 free unmarked
0xc0000c7880 free unmarked
0xc0000c78f0 free unmarked
0xc0000c7960 free unmarked
0xc0000c79d0 free unmarked
0xc0000c7a40 free unmarked
0xc0000c7ab0 free unmarked
0xc0000c7b20 free unmarked
0xc0000c7b90 free unmarked
0xc0000c7c00 free unmarked
0xc0000c7c70 free unmarked
0xc0000c7ce0 free unmarked
0xc0000c7d50 free unmarked
0xc0000c7dc0 free unmarked
0xc0000c7e30 free unmarked
0xc0000c7ea0 free unmarked
0xc0000c7f10 free unmarked
0xc0000c7f80 free unmarked
fatal error: found pointer to free object

runtime stack:
runtime.throw(0x11e2f9d, 0x1c)
/usr/local/go/src/runtime/panic.go:1116 +0x72
runtime.(*mspan).reportZombies(0x7f5cd9334b10)
/usr/local/go/src/runtime/mgcsweep.go:827 +0x376
runtime.(*mspan).sweep(0x7f5cd9334b10, 0xc000600100, 0x0)
/usr/local/go/src/runtime/mgcsweep.go:451 +0x81b
runtime.(*mcentral).uncacheSpan(0x1a77218, 0x7f5cd9334b10)
/usr/local/go/src/runtime/mcentral.go:383 +0xec
runtime.(*mcache).releaseAll(0x7f5cd932a108)
/usr/local/go/src/runtime/mcache.go:162 +0x6a
runtime.(*mcache).prepareForSweep(0x7f5cd932a108)
/usr/local/go/src/runtime/mcache.go:189 +0x46
runtime.acquirep(0xc000040000)
/usr/local/go/src/runtime/proc.go:4467 +0x3d
runtime.stopm()
/usr/local/go/src/runtime/proc.go:1926 +0xed
runtime.findrunnable(0xc000042800, 0x0)
/usr/local/go/src/runtime/proc.go:2485 +0xa7f
runtime.schedule()
/usr/local/go/src/runtime/proc.go:2683 +0x2d7
runtime.goschedImpl(0xc000102300)
/usr/local/go/src/runtime/proc.go:2866 +0xda
runtime.gosched_m(0xc000102300)
/usr/local/go/src/runtime/proc.go:2874 +0x34
runtime.mcall(0x800000)
/usr/local/go/src/runtime/asm_amd64.s:318 +0x5b

It is similar with issue #37688

@bcmills
Copy link
Member

@bcmills bcmills commented Aug 3, 2021

Looks like memory corruption. Have you tested the program under the race detector?

Loading

@WiFeng
Copy link
Author

@WiFeng WiFeng commented Aug 4, 2021

Thanks your reply. I tested it just now and found many RACE WARNING.

==================
WARNING: DATA RACE
Write at 0x00c000522550 by goroutine 66:
  github.com/xiwujie/feed/pkg/dao.(*Comment).FetchByIdsAndArticleId.func1()
      /Users/leeco/go/src/github.com/xiwujie/feed/pkg/dao/comment.go:66 +0x128

Previous write at 0x00c000522550 by goroutine 65:
  github.com/xiwujie/feed/pkg/dao.(*Comment).FetchByIdsAndArticleId.func1()
      /Users/leeco/go/src/github.com/xiwujie/feed/pkg/dao/comment.go:66 +0x128

Goroutine 66 (running) created at:
  github.com/xiwujie/feed/pkg/dao.(*Comment).FetchByIdsAndArticleId()
      /Users/leeco/go/src/github.com/xiwujie/feed/pkg/dao/comment.go:65 +0x7d8
  github.com/xiwujie/feed/pkg/dao.(*Comment).GetHotListByArticleId()
      /Users/leeco/go/src/github.com/xiwujie/feed/pkg/dao/comment.go:202 +0x109
  github.com/xiwujie/feed/pkg/task.getHotCommentByArticleId()
      /Users/leeco/go/src/github.com/xiwujie/feed/pkg/task/card.go:1355 +0x109
  github.com/xiwujie/feed/pkg/task.loadGenericCardContent()
      /Users/leeco/go/src/github.com/xiwujie/feed/pkg/task/card.go:1050 +0x13a4
  github.com/xiwujie/feed/pkg/task.LoadInitData()
      /Users/leeco/go/src/github.com/xiwujie/feed/pkg/task/task.go:49 +0x724
  github.com/WiFeng/go-sky.safelyDo()
      /Users/leeco/go/pkg/mod/github.com/!wi!feng/go-sky@v0.2.7/sky.go:132 +0x72
  github.com/WiFeng/go-sky.RegisterTask()
      /Users/leeco/go/pkg/mod/github.com/!wi!feng/go-sky@v0.2.7/sky.go:139 +0x84
  main.main()
      /Users/leeco/go/src/github.com/xiwujie/feed/cmd/server.go:22 +0xa4

Goroutine 65 (finished) created at:
  github.com/xiwujie/feed/pkg/dao.(*Comment).FetchByIdsAndArticleId()
      /Users/leeco/go/src/github.com/xiwujie/feed/pkg/dao/comment.go:65 +0x7d8
  github.com/xiwujie/feed/pkg/dao.(*Comment).GetHotListByArticleId()
      /Users/leeco/go/src/github.com/xiwujie/feed/pkg/dao/comment.go:202 +0x109
  github.com/xiwujie/feed/pkg/task.getHotCommentByArticleId()
      /Users/leeco/go/src/github.com/xiwujie/feed/pkg/task/card.go:1355 +0x109
  github.com/xiwujie/feed/pkg/task.loadGenericCardContent()
      /Users/leeco/go/src/github.com/xiwujie/feed/pkg/task/card.go:1050 +0x13a4
  github.com/xiwujie/feed/pkg/task.LoadInitData()
      /Users/leeco/go/src/github.com/xiwujie/feed/pkg/task/task.go:49 +0x724
  github.com/WiFeng/go-sky.safelyDo()
      /Users/leeco/go/pkg/mod/github.com/!wi!feng/go-sky@v0.2.7/sky.go:132 +0x72
  github.com/WiFeng/go-sky.RegisterTask()
      /Users/leeco/go/pkg/mod/github.com/!wi!feng/go-sky@v0.2.7/sky.go:139 +0x84
  main.main()
      /Users/leeco/go/src/github.com/xiwujie/feed/cmd/server.go:22 +0xa4
==================

I will try to fix it .

Loading

@andig
Copy link
Contributor

@andig andig commented Aug 4, 2021

It's probably safe to say that you could close this issue. it should not manifest itself after fixing the races.

Loading

@mdlayher
Copy link
Member

@mdlayher mdlayher commented Aug 4, 2021

Agreed, closing for now.

Loading

@mdlayher mdlayher closed this Aug 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants