Skip to content

Commit 6a8b2df

Browse files
committed
Merge remote-tracking branch 'couchbase/trinity' into phoenix
* couchbase/trinity: MB-67857[BP]: Enhance fake_chronicle_kv with seqno support for MB-67857[BP]: Reformat fake_chronicle_kv.erl MB-67857[BP]: Notify ns_config_events in fake_ns_config MB-67857[BP]: Format fake_ns_config MB-67857: Only catch menelaus_cbauth_worker noproc errors MB-67857: Don't ignore errors from ensure_config_seen_by_nodes MB-67908: Avoid leaking cbauth Info in crashes Change-Id: I11438b1dd1bcaa4d5d0887f66ae4d889c61db97b
2 parents 48830cf + 518d9db commit 6a8b2df

File tree

3 files changed

+20
-7
lines changed

3 files changed

+20
-7
lines changed

apps/ns_server/src/cb_creds_rotation.erl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -276,8 +276,8 @@ rotate_password(Type, ProtectionSleep) ->
276276
fun () ->
277277
ns_config:sync_announcements(),
278278
chronicle_compat_events:sync(),
279-
ns_config_rep:ensure_config_seen_by_nodes(
280-
ns_node_disco:nodes_actual_other(), infinity),
279+
ok = ns_config_rep:ensure_config_seen_by_nodes(
280+
ns_node_disco:nodes_actual_other(), infinity),
281281
misc:parallel_map(menelaus_cbauth:sync(_),
282282
ns_node_disco:nodes_actual(), infinity)
283283
end,

apps/ns_server/src/menelaus_cbauth.erl

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,19 @@ sync() ->
7878
sync(Node) ->
7979
InternalConnections =
8080
gen_server:call({?MODULE, Node}, get_internal_connections, infinity),
81-
misc:parallel_map(?cut(catch(menelaus_cbauth_worker:sync(_))),
82-
InternalConnections, infinity).
81+
%% If the above call succeeds, but a worker exits before we make the below
82+
%% sync call, then we would incorrectly crash the caller of this function.
83+
%% However, if we simply ignore all exceptions, then other cases like
84+
%% timeouts would incorrectly be ignored. As such, we need to catch any
85+
%% noproc errors, but allow all other exeptions to be propogated to the
86+
%% caller
87+
misc:parallel_map(
88+
fun (Pid) ->
89+
try menelaus_cbauth_worker:sync(Pid)
90+
catch exit:{noproc, _} ->
91+
?log_error("Process ~p no longer exists", [Pid])
92+
end
93+
end, InternalConnections, infinity).
8394

8495
stats() ->
8596
InternalConnections = gen_server:call(?MODULE, get_internal_connections),

apps/ns_server/src/menelaus_cbauth_worker.erl

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ start_monitor(Label, Version, Pid, Params) ->
4545
[Label, Version, Pid, Params], []).
4646

4747
notify(Pid, Info) ->
48-
Pid ! {notify, Info}.
48+
Pid ! {notify, ?HIDE(Info)}.
4949

5050
collect_stats(Pid) ->
5151
gen_server:call(Pid, collect_stats).
@@ -82,8 +82,10 @@ handle_info(heartbeat, State = #state{label = Label, connection = Pid,
8282
ok ->
8383
{noreply, State}
8484
end;
85-
handle_info({notify, Info}, State = #state{label = Label, connection = Pid,
86-
version = Version}) ->
85+
handle_info({notify, InfoHidden}, State = #state{label = Label,
86+
connection = Pid,
87+
version = Version}) ->
88+
Info = ?UNHIDE(InfoHidden),
8789
Method = case Version of
8890
internal ->
8991
"AuthCacheSvc.UpdateDB";

0 commit comments

Comments
 (0)