summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorD Corbacho <diana@rabbitmq.com>2017-11-23 12:06:09 +0000
committerGitHub <noreply@github.com>2017-11-23 12:06:09 +0000
commit85fcede2b42713eb682b5e7968636f909b264aa4 (patch)
tree1a3ba80f928e5b473b2ade8938e519d48f445730 /src
parentd704c5501b423244bf63e458f1192518915150bb (diff)
parent5977c1a0ba6bded40b4a20a5317c4f62489743cf (diff)
downloadrabbitmq-server-git-85fcede2b42713eb682b5e7968636f909b264aa4.tar.gz
Merge pull request #1431 from rabbitmq/rabbitmq-server-gm-avoid-infinite-loop
Avoid infinite loop when dropping gm queue entries.
Diffstat (limited to 'src')
-rw-r--r--src/gm.erl7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/gm.erl b/src/gm.erl
index cf3e217010..d6005fe554 100644
--- a/src/gm.erl
+++ b/src/gm.erl
@@ -1354,9 +1354,12 @@ find_common(A, B, Common) ->
find_common(A1, B1, queue:in(Val, Common));
{{empty, _A}, _} ->
{Common, B};
- {_, {_, B1}} ->
+ %% Drop value from B.
+ %% Match value to avoid infinite loop, since {empty, B} = queue:out(B).
+ {_, {{value, _}, B1}} ->
find_common(A, B1, Common);
- {{_, A1}, _} ->
+ %% Drop value from A. Empty A should be matched by second close.
+ {{{value, _}, A1}, _} ->
find_common(A1, B, Common)
end.