Skip to content

Commit 286e1d0

Browse files
author
Daniil Fedotov
committed
Link Gatherer when rebuilding a message store index.
If index rebuilding worker fails, the failure never reported to a starting message store process. This can cause a deadlock, when a message store process waits for gatherer, and gatherer waits for a worker, which is dead.
1 parent 886f199 commit 286e1d0

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/rabbit_msg_store.erl

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1765,8 +1765,12 @@ build_index(Gatherer, Left, [],
17651765
build_index(Gatherer, Left, [File|Files], State) ->
17661766
ok = gatherer:fork(Gatherer),
17671767
ok = worker_pool:submit_async(
1768-
fun () -> build_index_worker(Gatherer, State,
1769-
Left, File, Files)
1768+
fun () ->
1769+
link(Gatherer),
1770+
ok = build_index_worker(Gatherer, State,
1771+
Left, File, Files),
1772+
unlink(Gatherer),
1773+
ok
17701774
end),
17711775
build_index(Gatherer, File, Files, State).
17721776

0 commit comments

Comments
 (0)