fix: avoid uisng 'pid' as log data field
Since it clashes with log metad data field
This commit is contained in:
parent
3f67d25605
commit
19e136bb66
|
@ -465,23 +465,23 @@ request_stepdown(Action, ConnMod, Pid) ->
|
||||||
catch
|
catch
|
||||||
% emqx_ws_connection: call
|
% emqx_ws_connection: call
|
||||||
_:noproc ->
|
_:noproc ->
|
||||||
ok = ?tp(debug, "session_already_gone", #{pid => Pid, action => Action}),
|
ok = ?tp(debug, "session_already_gone", #{stale_pid => Pid, action => Action}),
|
||||||
{error, noproc};
|
{error, noproc};
|
||||||
% emqx_connection: gen_server:call
|
% emqx_connection: gen_server:call
|
||||||
_:{noproc, _} ->
|
_:{noproc, _} ->
|
||||||
ok = ?tp(debug, "session_already_gone", #{pid => Pid, action => Action}),
|
ok = ?tp(debug, "session_already_gone", #{stale_pid => Pid, action => Action}),
|
||||||
{error, noproc};
|
{error, noproc};
|
||||||
_:{shutdown, _} ->
|
_:{shutdown, _} ->
|
||||||
ok = ?tp(debug, "session_already_shutdown", #{pid => Pid, action => Action}),
|
ok = ?tp(debug, "session_already_shutdown", #{stale_pid => Pid, action => Action}),
|
||||||
{error, noproc};
|
{error, noproc};
|
||||||
_:{{shutdown, _}, _} ->
|
_:{{shutdown, _}, _} ->
|
||||||
ok = ?tp(debug, "session_already_shutdown", #{pid => Pid, action => Action}),
|
ok = ?tp(debug, "session_already_shutdown", #{stale_pid => Pid, action => Action}),
|
||||||
{error, noproc};
|
{error, noproc};
|
||||||
_:{timeout, {gen_server, call, _}} ->
|
_:{timeout, {gen_server, call, _}} ->
|
||||||
?tp(
|
?tp(
|
||||||
warning,
|
warning,
|
||||||
"session_stepdown_request_timeout",
|
"session_stepdown_request_timeout",
|
||||||
#{pid => Pid, action => Action, stale_channel => stale_channel_info(Pid)}
|
#{stale_pid => Pid, action => Action, stale_channel => stale_channel_info(Pid)}
|
||||||
),
|
),
|
||||||
ok = force_kill(Pid),
|
ok = force_kill(Pid),
|
||||||
{error, timeout};
|
{error, timeout};
|
||||||
|
@ -490,7 +490,7 @@ request_stepdown(Action, ConnMod, Pid) ->
|
||||||
error,
|
error,
|
||||||
"session_stepdown_request_exception",
|
"session_stepdown_request_exception",
|
||||||
#{
|
#{
|
||||||
pid => Pid,
|
stale_pid => Pid,
|
||||||
action => Action,
|
action => Action,
|
||||||
reason => Error,
|
reason => Error,
|
||||||
stacktrace => St,
|
stacktrace => St,
|
||||||
|
@ -671,7 +671,7 @@ handle_cast(Msg, State) ->
|
||||||
{noreply, State}.
|
{noreply, State}.
|
||||||
|
|
||||||
handle_info({'DOWN', _MRef, process, Pid, _Reason}, State = #{chan_pmon := PMon}) ->
|
handle_info({'DOWN', _MRef, process, Pid, _Reason}, State = #{chan_pmon := PMon}) ->
|
||||||
?tp(emqx_cm_process_down, #{pid => Pid, reason => _Reason}),
|
?tp(emqx_cm_process_down, #{stale_pid => Pid, reason => _Reason}),
|
||||||
ChanPids = [Pid | emqx_misc:drain_down(?BATCH_SIZE)],
|
ChanPids = [Pid | emqx_misc:drain_down(?BATCH_SIZE)],
|
||||||
{Items, PMon1} = emqx_pmon:erase_all(ChanPids, PMon),
|
{Items, PMon1} = emqx_pmon:erase_all(ChanPids, PMon),
|
||||||
lists:foreach(fun mark_channel_disconnected/1, ChanPids),
|
lists:foreach(fun mark_channel_disconnected/1, ChanPids),
|
||||||
|
|
|
@ -587,24 +587,24 @@ request_stepdown(Action, ConnMod, Pid) ->
|
||||||
catch
|
catch
|
||||||
% emqx_ws_connection: call
|
% emqx_ws_connection: call
|
||||||
_:noproc ->
|
_:noproc ->
|
||||||
ok = ?tp(debug, "session_already_gone", #{pid => Pid, action => Action}),
|
ok = ?tp(debug, "session_already_gone", #{stale_pid => Pid, action => Action}),
|
||||||
{error, noproc};
|
{error, noproc};
|
||||||
% emqx_connection: gen_server:call
|
% emqx_connection: gen_server:call
|
||||||
_:{noproc, _} ->
|
_:{noproc, _} ->
|
||||||
ok = ?tp(debug, "session_already_gone", #{pid => Pid, action => Action}),
|
ok = ?tp(debug, "session_already_gone", #{stale_pid => Pid, action => Action}),
|
||||||
{error, noproc};
|
{error, noproc};
|
||||||
_:Reason = {shutdown, _} ->
|
_:Reason = {shutdown, _} ->
|
||||||
ok = ?tp(debug, "session_already_shutdown", #{pid => Pid, action => Action}),
|
ok = ?tp(debug, "session_already_shutdown", #{stale_pid => Pid, action => Action}),
|
||||||
{error, Reason};
|
{error, Reason};
|
||||||
_:Reason = {{shutdown, _}, _} ->
|
_:Reason = {{shutdown, _}, _} ->
|
||||||
ok = ?tp(debug, "session_already_shutdown", #{pid => Pid, action => Action}),
|
ok = ?tp(debug, "session_already_shutdown", #{stale_pid => Pid, action => Action}),
|
||||||
{error, Reason};
|
{error, Reason};
|
||||||
_:{timeout, {gen_server, call, _}} ->
|
_:{timeout, {gen_server, call, _}} ->
|
||||||
?tp(
|
?tp(
|
||||||
warning,
|
warning,
|
||||||
"session_stepdown_request_timeout",
|
"session_stepdown_request_timeout",
|
||||||
#{
|
#{
|
||||||
pid => Pid,
|
stale_pid => Pid,
|
||||||
action => Action,
|
action => Action,
|
||||||
stale_channel => stale_channel_info(Pid)
|
stale_channel => stale_channel_info(Pid)
|
||||||
}
|
}
|
||||||
|
@ -616,7 +616,7 @@ request_stepdown(Action, ConnMod, Pid) ->
|
||||||
error,
|
error,
|
||||||
"session_stepdown_request_exception",
|
"session_stepdown_request_exception",
|
||||||
#{
|
#{
|
||||||
pid => Pid,
|
stale_pid => Pid,
|
||||||
action => Action,
|
action => Action,
|
||||||
reason => Error,
|
reason => Error,
|
||||||
stacktrace => St,
|
stacktrace => St,
|
||||||
|
|
|
@ -0,0 +1,2 @@
|
||||||
|
Fixed a log data field name clash.
|
||||||
|
Piror to this fix, some debug logs may report a wrong Erlang PID which may affect troubleshooting session takeover issues.
|
|
@ -0,0 +1,2 @@
|
||||||
|
修复log数据字段名称冲突。
|
||||||
|
在这个修复之前,一些调试日志可能会报告一个错误的Erlang PID,这可能会影响会话接管问题的故障调查。
|
|
@ -1,6 +1,6 @@
|
||||||
{application, emqx_license, [
|
{application, emqx_license, [
|
||||||
{description, "EMQX License"},
|
{description, "EMQX License"},
|
||||||
{vsn, "5.0.7"},
|
{vsn, "5.0.8"},
|
||||||
{modules, []},
|
{modules, []},
|
||||||
{registered, [emqx_license_sup]},
|
{registered, [emqx_license_sup]},
|
||||||
{applications, [kernel, stdlib, emqx_ctl]},
|
{applications, [kernel, stdlib, emqx_ctl]},
|
||||||
|
|
|
@ -74,13 +74,13 @@ ensure_timer(#{interval := Interval} = State) ->
|
||||||
check_pid(#{name := Name, pid := OldPid, callback := Callback} = State) ->
|
check_pid(#{name := Name, pid := OldPid, callback := Callback} = State) ->
|
||||||
case whereis(Name) of
|
case whereis(Name) of
|
||||||
undefined ->
|
undefined ->
|
||||||
?tp(debug, emqx_license_installer_noproc, #{pid => OldPid}),
|
?tp(debug, emqx_license_installer_noproc, #{old_pid => OldPid}),
|
||||||
State;
|
State;
|
||||||
OldPid ->
|
OldPid ->
|
||||||
?tp(debug, emqx_license_installer_nochange, #{pid => OldPid}),
|
?tp(debug, emqx_license_installer_nochange, #{old_pid => OldPid}),
|
||||||
State;
|
State;
|
||||||
NewPid ->
|
NewPid ->
|
||||||
_ = Callback(),
|
_ = Callback(),
|
||||||
?tp(debug, emqx_license_installer_called, #{pid => OldPid}),
|
?tp(debug, emqx_license_installer_called, #{old_pid => OldPid}),
|
||||||
State#{pid => NewPid}
|
State#{pid => NewPid}
|
||||||
end.
|
end.
|
||||||
|
|
Loading…
Reference in New Issue