'badarg' thrown in ETS update
Hi!
I have a problem with counter updates which very seldom appears. An error is thrown with the following 'reason':
{error, badarg, [{ets, update_counter, [exometer_2, [some, exometer, id], {8,1}], []}
Unfortunately I am not able to reproduce this, it seems to be a very tricky race condition. However, I was curious how this could even happen within exometer. The error happens HERE. So the internal ID lookup works but the following ETS update call seems to raise an error for whatever reason. For me it looks like such a call to the ETS table should never crash when the previous lookup is successful.
I am very grateful for any hints that I might try on my code.
It's baffling. The update_counter/3 call could fail if (a) the attribute value isn't an integer, or (b) the record is suddenly deleted (after having existed for the lookup). I don't really see how (a) could happen, at least through the exometer_core API, and (b) is of course possible in theory.
@uwiger: I can now frequently generate this error within a larger test suite. I will come back with a better error description when I find the time.