exometer_core icon indicating copy to clipboard operation
exometer_core copied to clipboard

'badarg' thrown in ETS update

Open GalaxyGorilla opened this issue 9 years ago • 2 comments

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.

GalaxyGorilla avatar Apr 29 '16 13:04 GalaxyGorilla

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 avatar Apr 29 '16 13:04 uwiger

@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.

GalaxyGorilla avatar Apr 29 '16 14:04 GalaxyGorilla