From f6bb3dc325e686375b1dee283bd91c3068b682a1 Mon Sep 17 00:00:00 2001 From: Siri Hansen Date: Wed, 26 Feb 2014 14:36:55 +0100 Subject: Change spawn/1 + monitor/2 to spawn_monitor/1 to avoid deadlock crashdump_viewer:progress_pmap did sometimes hang since is spawned a process, then monitored it and waited for a specific DOWN message. When the process' work was very fast, it would exit before the call to monitor and the DOWN message would contain reason 'noproc' instead of the expected {pmap_done,Result}. By doing spawn_monitor/1 instead, the monitor is always set before the process exits so the deadlock is avoided. --- lib/observer/src/crashdump_viewer.erl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'lib/observer/src/crashdump_viewer.erl') diff --git a/lib/observer/src/crashdump_viewer.erl b/lib/observer/src/crashdump_viewer.erl index a17efbccb0..0467e808e3 100644 --- a/lib/observer/src/crashdump_viewer.erl +++ b/lib/observer/src/crashdump_viewer.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2003-2013. All Rights Reserved. +%% Copyright Ericsson AB 2003-2014. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -2559,11 +2559,11 @@ progress_pmap(Report,File,Fun,List) -> {L1,L2} = if length(L)>=NPerProc -> lists:split(NPerProc,L); true -> {L,[]} % last chunk end, - P = spawn( + {P,_Ref} = + spawn_monitor( fun() -> progress_map(Collector,ReportInterval,File,Fun,L1) end), - erlang:monitor(process,P), {L2,[P|Ps]} end, {List,[]}, -- cgit v1.2.3 From 6a5b206e984ed28d257c6ab518b3ecbe5c6033d7 Mon Sep 17 00:00:00 2001 From: Siri Hansen Date: Mon, 17 Mar 2014 15:48:17 +0100 Subject: Fix crash in crashdump_viewer when node has multiple creations A node to which we have references to multiple instances (creations) will have an information line in the crashdump like this: Creation: 1 2 ... This would earlier crash because crashdump_viewer would try to do list_to_integer on the value after "Creation: ". This is now corrected. This correction also helps the case when the emulator is debug compiled, since the line could then be Creation: 1 (refc=1) --- lib/observer/src/crashdump_viewer.erl | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'lib/observer/src/crashdump_viewer.erl') diff --git a/lib/observer/src/crashdump_viewer.erl b/lib/observer/src/crashdump_viewer.erl index 0467e808e3..a08d27d070 100644 --- a/lib/observer/src/crashdump_viewer.erl +++ b/lib/observer/src/crashdump_viewer.erl @@ -1576,7 +1576,13 @@ get_nodeinfo(Fd,Nod) -> "Controller" -> get_nodeinfo(Fd,Nod#nod{controller=val(Fd)}); "Creation" -> - get_nodeinfo(Fd,Nod#nod{creation=list_to_integer(val(Fd))}); + %% Throwing away elements like "(refc=1)", which might be + %% printed from a debug compiled emulator. + Creations = lists:flatmap(fun(C) -> try [list_to_integer(C)] + catch error:badarg -> [] + end + end, string:tokens(val(Fd)," ")), + get_nodeinfo(Fd,Nod#nod{creation={creations,Creations}}); "Remote link" -> Procs = val(Fd), % e.g. "<0.31.0> <4322.54.0>" {Local,Remote} = split(Procs), -- cgit v1.2.3