Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added pattern match to handle timeouts for github Issue 86 #87

Merged
merged 2 commits into from
Oct 4, 2016

Conversation

mk1s
Copy link
Contributor

@mk1s mk1s commented Mar 26, 2015

riaknostic Issue #86 -- Timeout message cached in local stats and causes crash

A recent customer issue revealed a condition where their repeated calls to riak_kv_status:statistics/0 were timing out and storing the {badrpc, timeout} message as the stats, causing riaknostic to crash.

Reproducer

application:set_env(riaknostic, local_stats, {badrpc, timeout}).
application:get_env(riaknostic, local_stats).
riaknostic:main([]).

Fix

The riaknostic_node module is responsible for fetching and caching the stats, so a pattern match was added to the has_stats/0 function to handle the {badrpc, Reason} message and return as if no stats were currently cached so it will refetch in this state.

Test

application:set_env(riaknostic, local_stats, {badrpc, timeout}).
application:get_env(riaknostic, local_stats).
riaknostic:main([]).
{ok, {badrpc, timeout}} =:= application:get_env(riaknostic, local_stats).

@@ -191,6 +191,8 @@ append_node_suffix(Name, Suffix) ->

has_stats() ->
case application:get_env(riaknostic, local_stats) of
{ok, {badrpc, _Reason}} ->
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like indentation was messed up a bit here.

@bsparrow435
Copy link
Contributor

@mk1s had one indentation comment, other than that, +1 and ready to merge. Bors is not set up for riaknostic so we'll need to do it manually.

@zeeshanlakhani
Copy link

@bsparrow435 we just need the indentation and it's ready to merge right?

@bsparrow435
Copy link
Contributor

yep, and the indentation isnt essential, erlang and all

@zeeshanlakhani
Copy link

@bsparrow435. Cool. @mk1s, if you want to update w/ the indentation, that'd be rad. Otherwise, no matter what, we'll try and review and get this in for 2.1.2 (as we're in the midst of figuring out the necessary release needs going forward)

@bsparrow435 bsparrow435 merged commit af9edc5 into basho:develop Oct 4, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants