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

Channel.doRequeue race detection #193

Merged
merged 1 commit into from
May 7, 2013
Merged

Conversation

jehiah
Copy link
Member

@jehiah jehiah commented May 7, 2013

after running tip in production with race detection, we discovered a race in Channel.doRequeue where it isn't acquiring a readlock before writing into incomingMsgChan.

==================
WARNING: DATA RACE
Write by goroutine 1:
  runtime.closechan()
      /bitly/local/go/src/pkg/runtime/chan.c:1213 +0x0
  main.(*Channel).exit()
      .../github.com/bitly/nsq/nsqd/channel.go:174 +0x36c
  main.(*Channel).Close()
      .../github.com/bitly/nsq/nsqd/channel.go:153 +0x37
  main.(*Topic).exit()
      .../github.com/bitly/nsq/nsqd/topic.go:287 +0x514
  main.(*Topic).Close()
      .../github.com/bitly/nsq/nsqd/topic.go:247 +0x37
  main.(*NSQd).Exit()
      .../github.com/bitly/nsq/nsqd/nsqd.go:244 +0x266
  main.main()
      .../github.com/bitly/nsq/nsqd/main.go:142 +0x16fb
  runtime.main()
      /bitly/local/go/src/pkg/runtime/proc.c:182 +0x91

Previous read by goroutine 24:
  runtime.chansend()
      /bitly/local/go/src/pkg/runtime/chan.c:160 +0x0
  main.(*Channel).doRequeue()
      .../github.com/bitly/nsq/nsqd/channel.go:429 +0x11d
  main.func·006()
      .../github.com/bitly/nsq/nsqd/channel.go:607 +0x1b1
  main.(*Channel).pqWorker()
      .../github.com/bitly/nsq/nsqd/channel.go:631 +0x12d
  main.(*Channel).inFlightWorker()
      .../github.com/bitly/nsq/nsqd/channel.go:608 +0xab
  main.func·003()
      .../github.com/bitly/nsq/nsqd/channel.go:115 +0x47
  github.com/bitly/nsq/util.func·001()
      .../github.com/bitly/nsq/util/wait_group_wrapper.go:14 +0x4c
  gosched0()
      /bitly/local/go/src/pkg/runtime/proc.c:1218 +0x9f

cc: @mreiferson

@mreiferson
Copy link
Member

👍 race detector

mreiferson added a commit that referenced this pull request May 7, 2013
Channel.doRequeue race detection
@mreiferson mreiferson merged commit 24560a4 into nsqio:master May 7, 2013
@danielhfrank
Copy link
Contributor

race_detector++

@jehiah jehiah deleted the race_193 branch June 27, 2014 17:31
arussellsaw pushed a commit to arussellsaw/nsq that referenced this pull request Mar 5, 2018
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.

3 participants