-
Notifications
You must be signed in to change notification settings - Fork 392
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
Add protection against folsom stat errors #356
Conversation
@@ -90,6 +90,9 @@ get_stat(Stat) -> | |||
Pid = riak_core_stat_calc_sup:calc_proc(Stat), | |||
riak_core_stat_calc_proc:value(Pid). | |||
|
|||
err2unavailable({error, _, _}) -> unavailable; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is there a reason that we're not logging what the folsom error actually is here? would it make sense to just throw an exception so that it gets dumped into the normal, logged error path in the catch below?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it makes sense to change it so that all errors go through the same path. I'll update it soon.
Folsom may sometimes return an error tuple if something goes wrong (see folsom_ets.erl), but our code was only catching exceptions. So the error would end up being used as a valid value and crash the riak_kv_stat process later. This fixes that problem and gives us better protection from folsom funkiness.
Changed to throw folsom error tuples, so all errors go down the same code path. The astute reader might notice a rebase... |
@@ -90,6 +90,10 @@ get_stat(Stat) -> | |||
Pid = riak_core_stat_calc_sup:calc_proc(Stat), | |||
riak_core_stat_calc_proc:value(Pid). | |||
|
|||
throw_folsom_error({error, _, _} = Err) -> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in an ideal world, I feel that this would be called maybe_throw_folsom_error, but that is deep in the nit-picky weeds.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, if it's a folsom error, it will absolutely throw it. Not maybe. That's my argument and I'm sticking to it :)
👍, all folsom errors hit the logging path now, neither crash kills stats, everything seems happy. |
Add protection against folsom stat errors
Folsom may sometimes return an error tuple if something goes wrong (see
folsom_ets.erl), but our code was only catching exceptions. So the error
would end up being used as a valid value and crash the riak_kv_stat
process later. This fixes that problem and gives us better protection
from folsom funkiness.