[S] Change in ...osmo-s1gw[master]: enb_proxy: fix stale SCTP events misprocessed during MME pool selection
fixeria has uploaded this change for review. ( https://gerrit.osmocom.org/c/erlang/osmo-s1gw/+/42356?usp=email ) Change subject: enb_proxy: fix stale SCTP events misprocessed during MME pool selection ...................................................................... enb_proxy: fix stale SCTP events misprocessed during MME pool selection When closing a connection to one MME and opening a new one to the next, a SHUTDOWN_COMP event from the old (now-closed) socket can still be pending in the process mailbox. The sctp_assoc_change handlers in the 'connecting' and 'wait_s1setup_rsp' states were matching '_Socket', ignoring the socket identity. A stale SHUTDOWN_COMP would therefore fall into the '_ -> repeat_state_and_data' branch, triggering a spurious re-entry of 'connecting', which immediately closed the newly established connection to the next MME and skipped to yet another pool entry. Fix this by matching the Socket against the current S#state.sock in both handlers. Events arriving on a previously closed socket no longer match these clauses and are silently dropped by the catch-all handle_event/4. This was found thanks to the MME pooling TCs in ttcn3-s1gw-test. Change-Id: I4211dd343607f045cf4dd33fa568ed580c79dd9f Related: SYS#7052 --- M src/enb_proxy.erl 1 file changed, 8 insertions(+), 4 deletions(-) git pull ssh://gerrit.osmocom.org:29418/erlang/osmo-s1gw refs/changes/56/42356/1 diff --git a/src/enb_proxy.erl b/src/enb_proxy.erl index 5ab79d1..3ce205f 100644 --- a/src/enb_proxy.erl +++ b/src/enb_proxy.erl @@ -235,9 +235,11 @@ keep_state_and_data; %% Handle an #sctp_assoc_change event (connection state) -connecting(info, {sctp, _Socket, MmeAddr, MmePort, +%% Match on Socket to avoid processing stale events from a previously closed socket +connecting(info, {sctp, Socket, MmeAddr, MmePort, {[], #sctp_assoc_change{state = ConnState, - assoc_id = Aid}}}, S) -> + assoc_id = Aid}}}, + #state{sock = Socket} = S) -> MmeName = hd(S#state.tried_mmes), case ConnState of comm_up -> @@ -315,9 +317,11 @@ %% Handle an #sctp_assoc_change event (MME connection state) %% We may loose connection while waiting for the S1 SETUP RESPONSE -wait_s1setup_rsp(info, {sctp, _Socket, MmeAddr, MmePort, +%% Match on Socket to avoid processing stale events from a previously closed socket +wait_s1setup_rsp(info, {sctp, Socket, MmeAddr, MmePort, {[], #sctp_assoc_change{state = ConnState, - assoc_id = Aid}}}, S) -> + assoc_id = Aid}}}, + #state{sock = Socket} = S) -> case ConnState of comm_up -> ?LOG_NOTICE("MME connection (id=~p, ~p:~p) is already established?!?", -- To view, visit https://gerrit.osmocom.org/c/erlang/osmo-s1gw/+/42356?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: I4211dd343607f045cf4dd33fa568ed580c79dd9f Gerrit-Change-Number: 42356 Gerrit-PatchSet: 1 Gerrit-Owner: fixeria <vyanitskiy@sysmocom.de>
participants (1)
-
fixeria