diff options
author | Simon MacMullen <simon@rabbitmq.com> | 2014-08-11 12:15:47 +0100 |
---|---|---|
committer | Simon MacMullen <simon@rabbitmq.com> | 2014-08-11 12:15:47 +0100 |
commit | fabe3df8c2eba2b852e34ca0b4a163550e7d6c9b (patch) | |
tree | 2cd0bfd1f0c78c835887a0937fcdd63b52c5fbd1 | |
parent | 31ac68f90d4e1e39a74235d624dedad236c57270 (diff) | |
parent | 07c79d18a027b43f30fa2370332765e484039ed7 (diff) | |
download | rabbitmq-server-fabe3df8c2eba2b852e34ca0b4a163550e7d6c9b.tar.gz |
Merge bug26313 (again)
-rw-r--r-- | docs/rabbitmq.config.example | 8 | ||||
-rw-r--r-- | packaging/debs/Debian/changelog_comments/additional_changelog_comments_3.3.5 | 9 | ||||
-rw-r--r-- | packaging/debs/Debian/changelog_comments/additional_changelog_comments_x.x.x | 11 | ||||
-rw-r--r-- | src/priority_queue.erl | 2 | ||||
-rw-r--r-- | src/rabbit_diagnostics.erl | 79 |
5 files changed, 108 insertions, 1 deletions
diff --git a/docs/rabbitmq.config.example b/docs/rabbitmq.config.example index b0e13b1b..a128bfbc 100644 --- a/docs/rabbitmq.config.example +++ b/docs/rabbitmq.config.example @@ -44,6 +44,14 @@ %% ============== %% + %% The default "guest" user is only permitted to access the server + %% via a loopback interface (e.g. localhost). + %% {loopback_users, [<<"guest">>]}, + %% + %% Uncomment the following line if you want to allow access to the + %% guest user from anywhere on the network. + %% {loopback_users, []}, + %% Configuring SSL. %% See http://www.rabbitmq.com/ssl.html for full documentation. %% diff --git a/packaging/debs/Debian/changelog_comments/additional_changelog_comments_3.3.5 b/packaging/debs/Debian/changelog_comments/additional_changelog_comments_3.3.5 new file mode 100644 index 00000000..b9a9551c --- /dev/null +++ b/packaging/debs/Debian/changelog_comments/additional_changelog_comments_3.3.5 @@ -0,0 +1,9 @@ +# This file contains additional comments for the debian/changelog to be +# appended within the current version's changelog entry. +# Each line will be a separate comment. Do not begin with an *, dch will +# add that. +# For comments longer than one line do not put a line break and dch will +# neatly format it. +# Shell comments are ignored. +# +Changed Uploaders from Emile Joubert to Blair Hester diff --git a/packaging/debs/Debian/changelog_comments/additional_changelog_comments_x.x.x b/packaging/debs/Debian/changelog_comments/additional_changelog_comments_x.x.x new file mode 100644 index 00000000..bbab7596 --- /dev/null +++ b/packaging/debs/Debian/changelog_comments/additional_changelog_comments_x.x.x @@ -0,0 +1,11 @@ +# This file contains additional comments for the debian/changelog to be +# appended within the current version's changelog entry. +# Each line will be a separate comment. Do not begin with an *, dch will +# add that. +# For comments longer than one line do not put a line break and dch will +# neatly format it. +# Shell comments are ignored. +# +# Examples: +#Remove parts made of undercooked chicken +#This is a long line which is the beginning of a long two line comment which I am sure is going to be needed if the script cannot handle it diff --git a/src/priority_queue.erl b/src/priority_queue.erl index 9a578aa9..a3573bbd 100644 --- a/src/priority_queue.erl +++ b/src/priority_queue.erl @@ -139,7 +139,7 @@ out({queue, [V], [], 1}) -> {{value, V}, {queue, [], [], 0}}; out({queue, [Y|In], [], Len}) -> [V|Out] = lists:reverse(In, []), - {{value, V}, {queue, [Y], Out}, Len - 1}; + {{value, V}, {queue, [Y], Out, Len - 1}}; out({queue, In, [V], Len}) when is_list(In) -> {{value,V}, r2f(In, Len - 1)}; out({queue, In,[V|Out], Len}) when is_list(In) -> diff --git a/src/rabbit_diagnostics.erl b/src/rabbit_diagnostics.erl new file mode 100644 index 00000000..4eafada3 --- /dev/null +++ b/src/rabbit_diagnostics.erl @@ -0,0 +1,79 @@ +%% The contents of this file are subject to the Mozilla Public License +%% Version 1.1 (the "License"); you may not use this file except in +%% compliance with the License. You may obtain a copy of the License +%% at http://www.mozilla.org/MPL/ +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and +%% limitations under the License. +%% +%% The Original Code is RabbitMQ. +%% +%% The Initial Developer of the Original Code is GoPivotal, Inc. +%% Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved. +%% + +-module(rabbit_diagnostics). + +-define(PROCESS_INFO, + [current_stacktrace, initial_call, dictionary, message_queue_len, + links, monitors, monitored_by, heap_size]). + +-export([maybe_stuck/0, maybe_stuck/1]). + +maybe_stuck() -> maybe_stuck(5000). + +maybe_stuck(Timeout) -> + Pids = processes(), + io:format("There are ~p processes.~n", [length(Pids)]), + maybe_stuck(Pids, Timeout). + +maybe_stuck(Pids, Timeout) when Timeout =< 0 -> + io:format("Found ~p suspicious processes.~n", [length(Pids)]), + [io:format("~p~n", [info(Pid)]) || Pid <- Pids], + ok; +maybe_stuck(Pids, Timeout) -> + Pids2 = [P || P <- Pids, looks_stuck(P)], + io:format("Investigated ~p processes this round, ~pms to go.~n", + [length(Pids2), Timeout]), + timer:sleep(500), + maybe_stuck(Pids2, Timeout - 500). + +looks_stuck(Pid) -> + case process_info(Pid, status) of + {status, waiting} -> + %% It's tempting to just check for message_queue_len > 0 + %% here rather than mess around with stack traces and + %% heuristics. But really, sometimes freshly stuck + %% processes can have 0 messages... + case erlang:process_info(Pid, current_stacktrace) of + {current_stacktrace, [H|_]} -> + maybe_stuck_stacktrace(H); + _ -> + false + end; + _ -> + false + end. + +maybe_stuck_stacktrace({gen_server2, process_next_msg, _}) -> false; +maybe_stuck_stacktrace({gen_event, fetch_msg, _}) -> false; +maybe_stuck_stacktrace({prim_inet, accept0, _}) -> false; +maybe_stuck_stacktrace({prim_inet, recv0, _}) -> false; +maybe_stuck_stacktrace({rabbit_heartbeat, heartbeater, _}) -> false; +maybe_stuck_stacktrace({rabbit_net, recv, _}) -> false; +maybe_stuck_stacktrace({mochiweb_http, request, _}) -> false; +maybe_stuck_stacktrace({group, _, _}) -> false; +maybe_stuck_stacktrace({shell, _, _}) -> false; +maybe_stuck_stacktrace({io, _, _}) -> false; +maybe_stuck_stacktrace({M, F, A, _}) -> + maybe_stuck_stacktrace({M, F, A}); +maybe_stuck_stacktrace({_M, F, _A}) -> + case string:str(atom_to_list(F), "loop") of + 0 -> true; + _ -> false + end. + +info(Pid) -> + [{pid, Pid} | process_info(Pid, ?PROCESS_INFO)]. |