Skip to content

runtime: bad span state crash #8399

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
dvyukov opened this issue Jul 21, 2014 · 2 comments
Closed

runtime: bad span state crash #8399

dvyukov opened this issue Jul 21, 2014 · 2 comments
Milestone

Comments

@dvyukov
Copy link
Member

dvyukov commented Jul 21, 2014

go version devel +82cbf874e066 Mon Jul 21 16:29:38 2014 +1000 linux/amd64

$ cd src/pkg/runtime
$ go test -c
run the following command repeatedly
$ GOGC=1 ./runtime.test -test.short -test.cpu=1,4,16
eventually it crashes as:

MSpan_Sweep: state=0 sweepgen=7420 mheap.sweepgen=7420
fatal error: MSpan_Sweep: bad span state

runtime stack:
runtime.throw(0x7c2967)
    src/pkg/runtime/panic.c:523 +0x77 fp=0xc20818fe08 sp=0xc20818fdf0
runtime.MSpan_Sweep(0x7fb7bca81678)
    src/pkg/runtime/mgc0.c:1773 +0x789 fp=0xc20818fee0 sp=0xc20818fe08
runtime.sweepone()
    src/pkg/runtime/mgc0.c:1994 +0x12e fp=0xc20818ff10 sp=0xc20818fee0
MHeap_Reclaim(0x7d9320, 0x7)
    src/pkg/runtime/mheap.c:158 +0xea fp=0xc20818ff40 sp=0xc20818ff10
mheap_alloc(0x7d9320, 0x7, 0x33)
    src/pkg/runtime/mheap.c:182 +0x7e fp=0xc20818ff60 sp=0xc20818ff40
mheap_alloc_m(0xc2081e8900)
    src/pkg/runtime/mheap.c:223 +0xaa fp=0xc20818ff90 sp=0xc20818ff60
runtime.mcall(0x4333e5)
    src/pkg/runtime/asm_amd64.s:183 +0x52 fp=0xc20818ffa0 sp=0xc20818ff90

goroutine 45154 [running]:
runtime.MHeap_Alloc(0x7d9320, 0x7, 0x10000000033)
    src/pkg/runtime/mheap.c:245 +0x127 fp=0xc2084efc10 sp=0xc2084efbe8
MCentral_Grow(0x7e5910)
    src/pkg/runtime/mcentral.c:267 +0x89 fp=0xc2084efc70 sp=0xc2084efc10
runtime.MCentral_CacheSpan(0x7e5910)
    src/pkg/runtime/mcentral.c:84 +0x14b fp=0xc2084efca0 sp=0xc2084efc70
runtime.MCache_Refill(0x7fb7bca89ff0, 0x33)
    src/pkg/runtime/mcache.c:97 +0x120 fp=0xc2084efcd0 sp=0xc2084efca0
runtime.mallocgc(0x2100, 0x64d301, 0x0)
    src/pkg/runtime/malloc.goc:152 +0x33f fp=0xc2084efd38 sp=0xc2084efcd0
cnew(0x64d300, 0x108, 0x1)
    src/pkg/runtime/malloc.goc:836 +0xc1 fp=0xc2084efd58 sp=0xc2084efd38
runtime.cnewarray(0x64d300, 0x108)
    src/pkg/runtime/malloc.goc:849 +0x3a fp=0xc2084efd78 sp=0xc2084efd58
makeslice1(0x5a6900, 0x108, 0x108, 0xc2084efdd8)
    src/pkg/runtime/slice.goc:55 +0x4d fp=0xc2084efd90 sp=0xc2084efd78
runtime.makeslice(0x5a6900, 0x108, 0x108, 0x0, 0x108, 0x108)
    src/pkg/runtime/slice.goc:36 +0xb3 fp=0xc2084efdc0 sp=0xc2084efd90
reflect.Value.MapKeys(0x5ce080, 0xc208534030, 0x0, 0x150, 0x0, 0x0, 0x0)
    src/pkg/reflect/value.go:1242 +0x137 fp=0xc2084efe80 sp=0xc2084efdc0
runtime_test.func·047()
    src/pkg/runtime/map_test.go:270 +0xc4 fp=0xc2084effa8 sp=0xc2084efe80
runtime.goexit()
    src/pkg/runtime/proc.c:1465 fp=0xc2084effb0 sp=0xc2084effa8
created by runtime_test.testConcurrentReadsAfterGrowth
    src/pkg/runtime/map_test.go:274 +0x26d

I suspect it has something to do with the recent stack/malloc change.
@gopherbot
Copy link
Contributor

Comment 1:

CL https://golang.org/cl/118050043 mentions this issue.

@randall77
Copy link
Contributor

Comment 2:

This issue was closed by revision 3590d9c.

Status changed to Fixed.

@rsc rsc added this to the Go1.4 milestone Apr 14, 2015
@rsc rsc removed the release-go1.4 label Apr 14, 2015
@golang golang locked and limited conversation to collaborators Jun 25, 2016
wheatman pushed a commit to wheatman/go-akaros that referenced this issue Jun 25, 2018
Sweepone may be running while a new span is allocating.  It
must not see the state updated while the sweepgen is unset.

Fixes golang#8399

LGTM=dvyukov
R=golang-codereviews, dvyukov
CC=golang-codereviews
https://golang.org/cl/118050043
wheatman pushed a commit to wheatman/go-akaros that referenced this issue Jul 9, 2018
Sweepone may be running while a new span is allocating.  It
must not see the state updated while the sweepgen is unset.

Fixes golang#8399

LGTM=dvyukov
R=golang-codereviews, dvyukov
CC=golang-codereviews
https://golang.org/cl/118050043
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants