Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Call ring_trans synchronously, not in a spawn

Calling `add_supported_to_ring` is not threadsafe.
If a process retrieves the member_meta and then
it's concurrently updated by another process,
the original process' changed will be overwritten.

To exhibit the original bug, I added a
timer:sleep(crypto:rand_uniform(1, 1000))
line inside the spawned fun that calls
riak_core_ring_manager:ring_trans(F, ok)
  • Loading branch information...
commit 094954d6ded786b917a2d6dfe7f8097ba7d42975 1 parent fc8a51f
@reiddraper reiddraper authored
Showing with 1 addition and 3 deletions.
  1. +1 −3 src/riak_core_capability.erl
View
4 src/riak_core_capability.erl
@@ -377,9 +377,7 @@ publish_supported(State) ->
ignore
end
end,
- spawn(fun() ->
- riak_core_ring_manager:ring_trans(F, ok)
- end),
+ riak_core_ring_manager:ring_trans(F, ok),
ok.
%% Add a node's capabilities to the provided ring
Please sign in to comment.
Something went wrong with that request. Please try again.