fixeria has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/erlang/osmo-s1gw/+/42296?usp=email )


Change subject: enb_registry: fix pattern match in handle_info 'DOWN' handler
......................................................................

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(-)



  git pull ssh://gerrit.osmocom.org:29418/erlang/osmo-s1gw 
refs/changes/96/42296/1

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 https://gerrit.osmocom.org/c/erlang/osmo-s1gw/+/42296?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings?usp=email

Gerrit-MessageType: newchange
Gerrit-Project: erlang/osmo-s1gw
Gerrit-Branch: master
Gerrit-Change-Id: I4cb044e8071c4ae2fc48c507f8733af6c617ec46
Gerrit-Change-Number: 42296
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria <[email protected]>

Reply via email to