Skip to content

Commit 65d77ea

Browse files
committed
MB-48047:[BP] Prevent socket close on clusterEncryptionLevel
change When clusterEncryptionLevel changes from strict to other setting or vice versa we restart web server. On occasion the web server is restarted prior to settings API response. Backports change related to MB-47663. Reviewed-on: http://review.couchbase.org/c/ns_server/+/159808 Change-Id: I283d8419b923640a5479f92bc8196704c064db81 Reviewed-on: http://review.couchbase.org/c/ns_server/+/164952 Tested-by: Abhijeeth Nuthan <[email protected]> Reviewed-by: Timofey Barmin <[email protected]> Well-Formed: Restriction Checker
1 parent 390acaf commit 65d77ea

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/menelaus_web_settings.erl

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -319,6 +319,9 @@ handle_post(Type, Req) ->
319319
handle_post(Type, [], Req).
320320

321321
handle_post(Type, Keys, Req) ->
322+
%% NOTE: due to a potential restart we need to protect
323+
%% ourselves from 'death signal' of parent
324+
erlang:process_flag(trap_exit, true),
322325
case parse_post_data(conf(Type), Keys, mochiweb_request:recv_body(Req),
323326
fun is_allowed_setting/1) of
324327
{ok, ToSet} ->
@@ -332,7 +335,8 @@ handle_post(Type, Keys, Req) ->
332335
end;
333336
{error, Errors} ->
334337
reply_json(Req, {struct, [{errors, Errors}]}, 400)
335-
end.
338+
end,
339+
erlang:exit(normal).
336340

337341
set_keys_in_txn(Cfg, SetFn, ToSet) ->
338342
{NewCfg, AuditProps} =

0 commit comments

Comments
 (0)