fixeria submitted this change.
enb_registry: fix pattern match in handle_info 'DOWN' handler
PIDs maps pid() => enb_handle() (an integer), so maps:find/2 returns
{ok, SomeHandle}. The old pattern {ok, Pid} tried to match an integer
against the already-bound pid() variable, which never succeeds.
This handler is only called on abnormal termination (process crash),
so the broken match caused the registry entry to never be cleaned up
in that case. Fix by using a fresh {ok, Handle} binding and removing
the now-redundant follow-up maps:get/2 call.
Change-Id: I4cb044e8071c4ae2fc48c507f8733af6c617ec46
---
M src/enb_registry.erl
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/src/enb_registry.erl b/src/enb_registry.erl
index 54eca5d..d2487a0 100644
--- a/src/enb_registry.erl
+++ b/src/enb_registry.erl
@@ -257,8 +257,7 @@
pids = PIDs} = S) ->
?LOG_INFO("eNB process (pid=~p) terminated with reason ~p", [Pid, Reason]),
case maps:find(Pid, PIDs) of
- {ok, Pid} ->
- Handle = maps:get(Pid, PIDs),
+ {ok, Handle} ->
enb_metrics_reset(maps:get(Handle, ENBs)),
?LOG_INFO("eNB (handle=~p, pid=~p) has been unregistered", [Handle, Pid]),
{noreply, S#state{enbs = maps:remove(Handle, ENBs),
To view, visit change 42296. To unsubscribe, or for help writing mail filters, visit settings.