Skip to content

Commit

Permalink
Work around log record length limit for timeout diag. MB-3338
Browse files Browse the repository at this point in the history
Previous implementation routinely caused truncated log records without
information we're looking for.

Change-Id: Ie882f989cf3b072aad3d4c6d423889efaee0b1a3
Reviewed-on: http://review.membase.org/4306
Tested-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
Reviewed-by: Steve Yen <steve.yen@gmail.com>
  • Loading branch information
Aliaksey Kandratsenka authored and steveyen committed Jan 21, 2011
1 parent 0fd5ed9 commit acf69b1
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions deps/menelaus/src/diag_handler.erl
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ grab_process_info(Pid) ->
reductions,
trap_exit]),
Backtrace = proplists:get_value(backtrace, PureInfo),
NewBacktrace = string:tokens(binary_to_list(Backtrace), "\n"),
NewBacktrace = [string:substr(X, 1, 90) || X <- string:tokens(binary_to_list(Backtrace), "\n")],
lists:keyreplace(backtrace, 1, PureInfo, {backtrace, NewBacktrace}).

do_diag_per_node() ->
Expand Down Expand Up @@ -215,8 +215,13 @@ disarm_timeout(Pid) ->
diagnosing_timeouts(Body) ->
try Body()
catch exit:{timeout, _} = X ->
Processes = [{Pid, grab_process_info(Pid)}
|| Pid <- erlang:processes()],
?log_error("Got timeout ~p~nProcesses snapshot is:~p~n", [X, Processes]),
Processes = lists:foldl(fun (Pid, Acc) ->
[{Pid, grab_process_info(Pid)} | Acc]
end, [], erlang:processes()),
?log_error("Got timeout ~p~nProcesses snapshot is: [~n", [X]),
lists:foreach(fun (Item) ->
error_logger:error_msg("~p,~n", [Item])
end, Processes),
?log_error("]~n~n", []),
exit(X)
end.

0 comments on commit acf69b1

Please sign in to comment.