bitly/nsq — pull request #123 by mreiferson (2013-01-09 02:43:29+00:00)
Title: unlucky timing of notify.Post can cause exit deadlock

identified an issue today where an ephemeral channel went to send a topic update (https://github.com/bitly/nsq/blob/master/nsqd/topic.go#L126) which did not execute before `lookupLoop()` exited (meaning nothing was reading from the internal notify go channels anymore).

This deadlocked the `Post()` which aquires a `RLock()`, preventing `lookupLoop()` from *completely* exiting because it tries to `Stop()` notifications (https://github.com/bitly/nsq/blob/master/nsqd/lookup.go#L145-146). `Stop()` attempts to acquire a `Lock()`, deadlocking the exit.

Will push up a fix, shortly.

cc @jehiah