summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteve Powell <steve@rabbitmq.com>2011-11-15 16:23:20 +0000
committerSteve Powell <steve@rabbitmq.com>2011-11-15 16:23:20 +0000
commitfb6508c553a1b064a6003f92cf3f1d9f607d07b8 (patch)
tree4ea652fb71f9a31d8d6f433e43d9482fe4be7a87
parent829f8e66199af9d010a826e9e625ec967097528d (diff)
parente0be9188019f126f007742c6f213143eb0b47f8a (diff)
downloadrabbitmq-server-fb6508c553a1b064a6003f92cf3f1d9f607d07b8.tar.gz
Merge default into bug24559
-rw-r--r--src/rabbit_guid.erl13
-rw-r--r--src/rabbit_reader.erl2
2 files changed, 9 insertions, 6 deletions
diff --git a/src/rabbit_guid.erl b/src/rabbit_guid.erl
index cf3fea1a..d92f58a2 100644
--- a/src/rabbit_guid.erl
+++ b/src/rabbit_guid.erl
@@ -76,14 +76,17 @@ guid() ->
%% now() to move ahead of the system time), and b) it is really
%% slow since it takes a global lock and makes a system call.
%%
- %% A persisted serial number, in combination with self/0 (which
- %% includes the node name) uniquely identifies a process in space
+ %% A persisted serial number, the node, and a unique reference
+ %% (per node-incarnation) uniquely identifies a process in space
%% and time. We combine that with a process-local counter to give
%% us a GUID.
+ %%
+ %% We used to use self/0 here instead of the node and unique
+ %% reference. But PIDs wrap.
G = case get(guid) of
- undefined -> {{gen_server:call(?SERVER, serial, infinity), self()},
- 0};
- {S, I} -> {S, I+1}
+ undefined -> Serial = gen_server:call(?SERVER, serial, infinity),
+ {{Serial, node(), make_ref()}, 0};
+ {S, I} -> {S, I+1}
end,
put(guid, G),
erlang:md5(term_to_binary(G)).
diff --git a/src/rabbit_reader.erl b/src/rabbit_reader.erl
index b359f7d4..694abd9e 100644
--- a/src/rabbit_reader.erl
+++ b/src/rabbit_reader.erl
@@ -281,7 +281,7 @@ handle_other({conserve_memory, Conserve}, Deb, State) ->
handle_other({channel_closing, ChPid}, Deb, State) ->
ok = rabbit_channel:ready_for_close(ChPid),
channel_cleanup(ChPid),
- mainloop(Deb, State);
+ mainloop(Deb, maybe_close(State));
handle_other({'EXIT', Parent, Reason}, _Deb, State = #v1{parent = Parent}) ->
terminate(io_lib:format("broker forced connection closure "
"with reason '~w'", [Reason]), State),