diff options
author | Dan Gudmundsson <[email protected]> | 2017-05-09 11:49:47 +0200 |
---|---|---|
committer | Dan Gudmundsson <[email protected]> | 2017-05-09 11:49:47 +0200 |
commit | 150c7ca0cc815fafb79535035d6c3602564dde05 (patch) | |
tree | 0dcfdcca19381bddb993359ef5bd39e6e42eecec /lib/observer | |
parent | 55dc2d3f1bc236de9b47aeeb2a38120fd16e8394 (diff) | |
download | otp-150c7ca0cc815fafb79535035d6c3602564dde05.tar.gz otp-150c7ca0cc815fafb79535035d6c3602564dde05.tar.bz2 otp-150c7ca0cc815fafb79535035d6c3602564dde05.zip |
observer: Handle crash when node goes down
Do not crash if observed node stops
Diffstat (limited to 'lib/observer')
-rw-r--r-- | lib/observer/src/observer_alloc_wx.erl | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/lib/observer/src/observer_alloc_wx.erl b/lib/observer/src/observer_alloc_wx.erl index 9506a2b380..ef425f0874 100644 --- a/lib/observer/src/observer_alloc_wx.erl +++ b/lib/observer/src/observer_alloc_wx.erl @@ -194,14 +194,17 @@ code_change(_, _, State) -> %%%%%%%%%% restart_fetcher(Node, #state{panel=Panel, wins=Wins0, time=Ti} = State) -> - SysInfo = observer_wx:try_rpc(Node, observer_backend, sys_info, []), - Info = alloc_info(SysInfo), - Max = lists:foldl(fun calc_max/2, #{}, Info), - {Wins, Samples} = add_data(Info, {0, queue:new()}, Wins0, Ti, true), - erlang:send_after(1000 div ?DISP_FREQ, self(), {refresh, 0}), - wxWindow:refresh(Panel), - precalc(State#state{active=true, appmon=Node, time=Ti#ti{tick=0}, - wins=Wins, samples=Samples, max=Max}). + case rpc:call(Node, observer_backend, sys_info, []) of + {badrpc, _} -> State; + SysInfo -> + Info = alloc_info(SysInfo), + Max = lists:foldl(fun calc_max/2, #{}, Info), + {Wins, Samples} = add_data(Info, {0, queue:new()}, Wins0, Ti, true), + erlang:send_after(1000 div ?DISP_FREQ, self(), {refresh, 0}), + wxWindow:refresh(Panel), + precalc(State#state{active=true, appmon=Node, time=Ti#ti{tick=0}, + wins=Wins, samples=Samples, max=Max}) + end. precalc(#state{samples=Data0, paint=Paint, time=Ti, wins=Wins0}=State) -> Wins = [precalc(Ti, Data0, Paint, Win) || Win <- Wins0], |