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: memory leaks #237

Merged
merged 2 commits into from
Aug 2, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions nsqd/channel.go
Original file line number Diff line number Diff line change
Expand Up @@ -200,8 +200,15 @@ func (c *Channel) Empty() error {
client.Empty()
}

clientMsgChan := c.clientMsgChan
for {
select {
case _, ok := <-clientMsgChan:
if !ok {
// c.clientMsgChan may be closed while in this loop
// so just remove it from the select so we can make progress
clientMsgChan = nil
}
case <-c.memoryMsgChan:
default:
goto finish
Expand Down
2 changes: 1 addition & 1 deletion nsqd/topic.go
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ func (t *Topic) messagePump() {
continue
}
case <-t.channelUpdateChan:
chans = chans[:0]
chans = make([]*Channel, 0)
t.RLock()
for _, c := range t.channelMap {
chans = append(chans, c)
Expand Down