fixeria has submitted this change. ( https://gerrit.osmocom.org/c/erlang/osmo-s1gw/+/37122?usp=email ) Change subject: sctp_proxy: add a safe wrapper for s1ap_proxy:handle_pdu/1 ...................................................................... sctp_proxy: add a safe wrapper for s1ap_proxy:handle_pdu/1 We want to keep the SCTP connection alive even if we hit a bug in s1ap_proxy:handle_pdu/1. Otherwise, all the PDN contexts of all the subscribers served by the respective eNB will be killed. Change-Id: Ie6a7c9ff40789695e37be11344f5ea97fbcb8cfa --- M src/sctp_proxy.erl 1 file changed, 27 insertions(+), 4 deletions(-) Approvals: Jenkins Builder: Verified osmith: Looks good to me, but someone else must approve fixeria: Looks good to me, approved pespin: Looks good to me, but someone else must approve diff --git a/src/sctp_proxy.erl b/src/sctp_proxy.erl index 9f9072b..29cc425 100644 --- a/src/sctp_proxy.erl +++ b/src/sctp_proxy.erl @@ -155,8 +155,7 @@ {[#sctp_sndrcvinfo{assoc_id = Aid}], Data}}, S) -> logger:debug("MME connection (id=~p, ~p:~p) -> eNB: ~p", [Aid, MmeAddr, MmePort, Data]), - sctp_server:send_data(maps:get(enb_aid, S), - s1ap_proxy:handle_pdu(Data)), + sctp_server:send_data(maps:get(enb_aid, S), handle_pdu(Data)), {keep_state, S}; %% Catch-all for other kinds of SCTP events @@ -193,10 +192,21 @@ %% private API %% ------------------------------------------------------------------ +%% A safe wrapper for s1ap_proxy:handle_pdu/1 +-spec handle_pdu(binary()) -> binary(). +handle_pdu(Data) when is_binary(Data) -> + try s1ap_proxy:handle_pdu(Data) of + NewData -> NewData + catch + Exception:Reason -> + logger:error("An exception occurred: ~p, ~p", [Exception, Reason]), + Data %% proxy as-is + end. + + %% Send a single message to the MME sctp_send(#{sock := Sock, mme_aid := Aid}, Data) -> - sctp_client:send_data({Sock, Aid}, - s1ap_proxy:handle_pdu(Data)). + sctp_client:send_data({Sock, Aid}, handle_pdu(Data)). %% Send pending messages to the MME -- To view, visit https://gerrit.osmocom.org/c/erlang/osmo-s1gw/+/37122?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: erlang/osmo-s1gw Gerrit-Branch: master Gerrit-Change-Id: Ie6a7c9ff40789695e37be11344f5ea97fbcb8cfa Gerrit-Change-Number: 37122 Gerrit-PatchSet: 2 Gerrit-Owner: fixeria <vyanitskiy@sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria <vyanitskiy@sysmocom.de> Gerrit-Reviewer: osmith <osmith@sysmocom.de> Gerrit-Reviewer: pespin <pespin@sysmocom.de> Gerrit-MessageType: merged