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

nsqd: fix flush race #934

Merged
merged 1 commit into from
Aug 26, 2017
Merged

nsqd: fix flush race #934

merged 1 commit into from
Aug 26, 2017

Conversation

mreiferson
Copy link
Member

@mreiferson mreiferson commented Aug 26, 2017

Upgraded to Go 1.9 and was running benchmarks and observed this panic:

$ go test -v -run None -bench ProtocolV2MultiSub*
goos: darwin
goarch: amd64
pkg: github.com/nsqio/nsq/nsqd
BenchmarkProtocolV2MultiSub1-4    	fatal error: concurrent map iteration and map write

goroutine 39 [running]:
runtime.throw(0x14f434f, 0x26)
	/usr/local/Cellar/go/1.9/libexec/src/runtime/panic.go:605 +0x95 fp=0xc4203c97e0 sp=0xc4203c97c0 pc=0x102d325
runtime.mapiternext(0xc4203c99a8)
	/usr/local/Cellar/go/1.9/libexec/src/runtime/hashmap.go:778 +0x6f1 fp=0xc4203c9878 sp=0xc4203c97e0 pc=0x100ba11
github.com/nsqio/nsq/nsqd.(*Channel).flush(0xc420148000, 0x0, 0x0)
	/Users/mreiferson/dev/src/github.com/nsqio/nsq/nsqd/channel.go:224 +0x354 fp=0xc4203c9a18 sp=0xc4203c9878 pc=0x1385f14
github.com/nsqio/nsq/nsqd.(*Channel).exit(0xc420148000, 0xc4203c9b00, 0x0, 0x0)
	/Users/mreiferson/dev/src/github.com/nsqio/nsq/nsqd/channel.go:176 +0x293 fp=0xc4203c9af0 sp=0xc4203c9a18 pc=0x1385883
github.com/nsqio/nsq/nsqd.(*Channel).Close(0xc420148000, 0xc420079650, 0xc4203c9bc8)
	/Users/mreiferson/dev/src/github.com/nsqio/nsq/nsqd/channel.go:141 +0x30 fp=0xc4203c9b20 sp=0xc4203c9af0 pc=0x13855c0
github.com/nsqio/nsq/nsqd.(*Topic).exit(0xc42008c2c0, 0xc4203c9d00, 0xc4203c9d30, 0xc4203c9d20)
	/Users/mreiferson/dev/src/github.com/nsqio/nsq/nsqd/topic.go:343 +0x32c fp=0xc4203c9c98 sp=0xc4203c9b20 pc=0x13b5a1c
github.com/nsqio/nsq/nsqd.(*Topic).Close(0xc42008c2c0, 0xc420078750, 0xc4203c9d18)
	/Users/mreiferson/dev/src/github.com/nsqio/nsq/nsqd/topic.go:305 +0x30 fp=0xc4203c9cc8 sp=0xc4203c9c98 pc=0x13b56c0
github.com/nsqio/nsq/nsqd.(*NSQD).Exit(0xc4200f8000)
	/Users/mreiferson/dev/src/github.com/nsqio/nsq/nsqd/nsqd.go:477 +0x1c2 fp=0xc4203c9d88 sp=0xc4203c9cc8 pc=0x139e802
github.com/nsqio/nsq/nsqd.benchmarkProtocolV2MultiSub(0xc42015c600, 0x1)
	/Users/mreiferson/dev/src/github.com/nsqio/nsq/nsqd/protocol_v2_test.go:1869 +0x616 fp=0xc4203c9f18 sp=0xc4203c9d88 pc=0x13ea876
github.com/nsqio/nsq/nsqd.BenchmarkProtocolV2MultiSub1(0xc42015c600)
	/Users/mreiferson/dev/src/github.com/nsqio/nsq/nsqd/protocol_v2_test.go:1872 +0x34 fp=0xc4203c9f38 sp=0xc4203c9f18 pc=0x13ea934
testing.(*B).runN(0xc42015c600, 0x2710)
	/usr/local/Cellar/go/1.9/libexec/src/testing/benchmark.go:141 +0xb2 fp=0xc4203c9f78 sp=0xc4203c9f38 pc=0x10eb832
testing.(*B).launch(0xc42015c600)
	/usr/local/Cellar/go/1.9/libexec/src/testing/benchmark.go:291 +0x84 fp=0xc4203c9fd8 sp=0xc4203c9f78 pc=0x10ebfe4
runtime.goexit()
	/usr/local/Cellar/go/1.9/libexec/src/runtime/asm_amd64.s:2337 +0x1 fp=0xc4203c9fe0 sp=0xc4203c9fd8 pc=0x105d101
created by testing.(*B).doBench
	/usr/local/Cellar/go/1.9/libexec/src/testing/benchmark.go:260 +0x70

@mreiferson mreiferson added the bug label Aug 26, 2017
@mreiferson
Copy link
Member Author

RFR

Copy link
Member

@jehiah jehiah left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍🏻

@jehiah jehiah merged commit a73c39f into nsqio:master Aug 26, 2017
@mreiferson mreiferson deleted the racey branch August 26, 2017 23:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants