Skip to content

Commit 85fcede

Browse files
authored
Merge pull request #1431 from rabbitmq/rabbitmq-server-gm-avoid-infinite-loop
Avoid infinite loop when dropping gm queue entries.
2 parents d704c55 + 5977c1a commit 85fcede

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/gm.erl

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1354,9 +1354,12 @@ find_common(A, B, Common) ->
13541354
find_common(A1, B1, queue:in(Val, Common));
13551355
{{empty, _A}, _} ->
13561356
{Common, B};
1357-
{_, {_, B1}} ->
1357+
%% Drop value from B.
1358+
%% Match value to avoid infinite loop, since {empty, B} = queue:out(B).
1359+
{_, {{value, _}, B1}} ->
13581360
find_common(A, B1, Common);
1359-
{{_, A1}, _} ->
1361+
%% Drop value from A. Empty A should be matched by second close.
1362+
{{{value, _}, A1}, _} ->
13601363
find_common(A1, B, Common)
13611364
end.
13621365

0 commit comments

Comments
 (0)