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: "panic holding locks" when adding a timer #25619

Closed
happyEgg opened this issue May 29, 2018 · 4 comments

Comments

Projects
None yet
6 participants
@happyEgg
Copy link

commented May 29, 2018

Please answer these questions before submitting your issue. Thanks!

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

1.10.2

Does this issue reproduce with the latest release?

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

GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/admin/Library/Caches/go-build"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/admin/workspace/golang"
GORACE=""
GOROOT="/usr/local/go"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
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 -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/4j/wpx8_n613m9dc636mh072qfh0000gn/T/go-build402023923=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

I use gomobile to compile an android Library,it panic when i use time.Reset(xx)。
The phone is xiaomi

05-29 12:58:58.527 E/Go (13646): panic: (runtime.errorString) (0xd0b95010,0xd0c9b538)
05-29 12:58:58.527 E/Go (13646): fatal error: panic holding locks
05-29 12:58:58.536 E/Go (13646):
05-29 12:58:58.536 E/Go (13646): goroutine 27 [running]:
05-29 12:58:58.537 E/Go (13646): runtime.throw(0xd0af0148, 0x13)
05-29 12:58:58.537 E/Go (13646): /usr/local/go/src/runtime/panic.go:616 +0x64 fp=0x90730e48 sp=0x90730e3c pc=0xd09269a0
05-29 12:58:58.537 E/Go (13646): panic(0xd0b95010, 0xd0c9b538)
05-29 12:58:58.537 E/Go (13646): /usr/local/go/src/runtime/panic.go:462 +0x4e8 fp=0x90730e9c sp=0x90730e48 pc=0xd092661c
05-29 12:58:58.537 E/Go (13646): runtime.panicindex()
05-29 12:58:58.537 E/Go (13646): /usr/local/go/src/runtime/panic.go:28 +0x64 fp=0x90730ea8 sp=0x90730e9c pc=0xd0925030
05-29 12:58:58.537 E/Go (13646): runtime.siftupTimer(0x90632400, 0xf5, 0x100, 0x132)
05-29 12:58:58.537 E/Go (13646): /usr/local/go/src/runtime/time.go:331 +0x17c fp=0x90730ec8 sp=0x90730ea8 pc=0xd0946854
05-29 12:58:58.537 E/Go (13646): runtime.(*timersBucket).addtimerLocked(0xd0cccba8, 0x907240c4)
05-29 12:58:58.537 E/Go (13646): /usr/local/go/src/runtime/time.go:146 +0xcc fp=0x90730efc sp=0x90730ec8 pc=0xd0945c1c
05-29 12:58:58.537 E/Go (13646): runtime.addtimer(0x907240c4)
05-29 12:58:58.538 E/Go (13646): /usr/local/go/src/runtime/time.go:131 +0x58 fp=0x90730f0c sp=0x90730efc pc=0xd0945b2c
05-29 12:58:58.538 E/Go (13646): time.startTimer(0x907240c4)
05-29 12:58:58.538 E/Go (13646): /usr/local/go/src/runtime/time.go:111 +0x1c fp=0x90730f14 sp=0x90730f0c pc=0xd0945a20
05-29 12:58:58.539 E/Go (13646): time.(*Timer).Reset(0x907240c0, 0x7e11d600, 0x3, 0x0)
05-29 12:58:58.539 E/Go (13646): /usr/local/go/src/time/sleep.go:130 +0x80 fp=0x90730f38 sp=0x90730f14 pc=0xd0968cd4
05-29 12:58:58.539 E/Go (13646): bt/controller.(*Peer).TimerAnyAuthenticatedPacketTraversal(0x907282c0)
05-29 12:58:58.539 E/Go (13646):

@happyEgg happyEgg changed the title panic holding locks fatal error: panic holding locks May 29, 2018

@mvdan mvdan changed the title fatal error: panic holding locks x/mobile: fatal error: panic holding locks May 29, 2018

@gopherbot gopherbot added this to the Unreleased milestone May 29, 2018

@gopherbot gopherbot added the mobile label May 29, 2018

@ianlancetaylor ianlancetaylor changed the title x/mobile: fatal error: panic holding locks runtime: fatal error: "panic holding locks" when holding a timer May 29, 2018

@ianlancetaylor ianlancetaylor modified the milestones: Unreleased, Go1.11 May 29, 2018

@ianlancetaylor ianlancetaylor changed the title runtime: fatal error: "panic holding locks" when holding a timer runtime: "panic holding locks" when adding a timer May 29, 2018

@odeke-em

This comment has been minimized.

Copy link
Member

commented Jun 1, 2018

/cc @eliasnaur too

@eliasnaur

This comment has been minimized.

Copy link
Contributor

commented Jun 1, 2018

Related: #24790 where a crash involves addTimerLocked as well. CC @aclements.

@happyEgg: is the crash reproducible? If so, how?

@eliasnaur

This comment has been minimized.

Copy link
Contributor

commented Jun 1, 2018

I can reproduce this with https://play.golang.org/p/vd1Wc0cvhhY. Check that you're not accessing time.Timer instances from multiple goroutines.

@happyEgg

This comment has been minimized.

Copy link
Author

commented Jun 4, 2018

Yes, time.Timer instances from multiple goroutines. It's ok when i add sync.Mutex

@happyEgg happyEgg closed this Jun 4, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.