mediocregopher/radix

Mutating channels list

Closed this issue · 1 comments

radix/pubsub.go

Line 155 in dcc2ed7

out := ss[:0]

There is an issue within PubSub Subscribe call. It seems c.subs.missing(channels) is doing source slice mutation.
Steps to reproduce:
1). Launch subscription to channels: A - B- C and msgCh F
2). Launch subscription to channels: A - B and msgCh E
3). Publish message to channel A/B
Not sure what is exactly the root cause but out := make([]string, len(ss)) fix the issue.

Current result:
[5f4cd3b4b24d3ad8bde5d45d18636094 3b844743-01a4-9f01-b9ad-286c7e130c64 all] Before "missing" call
[3b844743-01a4-9f01-b9ad-286c7e130c64 3b844743-01a4-9f01-b9ad-286c7e130c64 all] After "missing" call

Expected (with out := make([]string, len(ss))) result:
[5f4cd3b4b24d3ad8bde5d45d18636094 3b844743-01a4-9f01-b9ad-286c7e130c64 all] Before "missing" call chan
[5f4cd3b4b24d3ad8bde5d45d18636094 3b844743-01a4-9f01-b9ad-286c7e130c64 all] After "missing" call

Thanks for the bringing this up :) should be fixed in master