Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Firebase is giving "maxretry" error

Tags:

We're using Firebase as a backend for our mobile app. Some of our users have sporadically received an error "maxretry" with a transaction writing to a path with single numeric value. We don't have multiple users or connections, nor multiple writes to the same path, as far as I know. What might be causing this?

I have a suspicion that this is caused by using floating point values with many decimal places. This error happened to me locally once and I was able to resolve it by limiting the precision to two decimal places. Can this be it?

-Albert

Edit:

Here's the code that is causing this:

return fireRef.child(fbPath).transaction(function(originalVal) {
  return func(originalVal, by_value);
}, _.noop, false)

where in this case the func looks like this:

function(originalVal, val) {
  return val + (originalVal || 0);
}
like image 868
aliz_bazar Avatar asked May 03 '16 10:05

aliz_bazar


1 Answers

The problem persisted even after limiting precision to 2 decimals (getting maxretry error every once in a while).

It looks like when updating a value using Firebase transactions floating point type should not be used at all.

I moved to using integers and haven't had the problem anymore.

like image 101
aliz_bazar Avatar answered Nov 14 '22 21:11

aliz_bazar