Transaction failed: DatabaseError: The operation had to be aborted due to a network disconnect

544 views
Skip to first unread message

Kirtan Thakkar

unread,
Aug 22, 2016, 11:09:57 AM8/22/16
to Firebase Google Group

When I read your docs for transaction it says something like this:


Handling Transactions Offline
Any transactions that are performed while our app is offline, will be queued. Once the app regains network connectivity, the transactions will be sent to the server.


But, when I perform any transaction while offline, it gives me an error like this, and falls back to the original values:


W/RepoOperation: Transaction at /-KPXECP6a1pXaM4gEYe0 failed: DatabaseError: The operation had to be aborted due to a network disconnect


I lost the data there. What's going on?


Thanks,

Kirtan

Michael Lehenbauer

unread,
Aug 22, 2016, 1:46:56 PM8/22/16
to Firebase Google Group
You are likely running into an unfortunate bug in the current Android SDK.  Namely, if you queue a transaction before your client connects to Firebase, it will fail with that error.  This will be fixed in an upcoming release.

In the meantime you may be able to work around this by watching the ".info/connected" location and not doing your transaction until after it becomes true.  Else, you could handle this error and just re-do the transaction.

Sorry for the inconvenience!  Hope this helps,
-Michael

--
You received this message because you are subscribed to the Google Groups "Firebase Google Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to firebase-talk+unsubscribe@googlegroups.com.
To post to this group, send email to fireba...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/firebase-talk/cc468345-3fb2-49e4-8898-13543e3fef41%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Kirtan Thakkar

unread,
Aug 22, 2016, 2:19:14 PM8/22/16
to Firebase Google Group
Hi Michael,

I can confirm that, I am not queuing transaction before the initial firebase connection when the app starts. I have started my app with connected to WiFi. Made some changes, turned wifi off. And performed an operation containing transaction. And it fired the error I mentioned. 

When is the new version coming? Actually, I am running out of time. I just found a thread from july, saying same. But, not released yet?

Thanks,
Kirtan


On Monday, August 22, 2016 at 11:16:56 PM UTC+5:30, Michael Lehenbauer wrote:
You are likely running into an unfortunate bug in the current Android SDK.  Namely, if you queue a transaction before your client connects to Firebase, it will fail with that error.  This will be fixed in an upcoming release.

In the meantime you may be able to work around this by watching the ".info/connected" location and not doing your transaction until after it becomes true.  Else, you could handle this error and just re-do the transaction.

Sorry for the inconvenience!  Hope this helps,
-Michael
On Mon, Aug 22, 2016 at 6:59 AM, Kirtan Thakkar <kirtant...@gmail.com> wrote:

When I read your docs for transaction it says something like this:


Handling Transactions Offline
Any transactions that are performed while our app is offline, will be queued. Once the app regains network connectivity, the transactions will be sent to the server.


But, when I perform any transaction while offline, it gives me an error like this, and falls back to the original values:


W/RepoOperation: Transaction at /-KPXECP6a1pXaM4gEYe0 failed: DatabaseError: The operation had to be aborted due to a network disconnect


I lost the data there. What's going on?


Thanks,

Kirtan

--
You received this message because you are subscribed to the Google Groups "Firebase Google Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to firebase-tal...@googlegroups.com.

Michael Lehenbauer

unread,
Aug 22, 2016, 4:06:22 PM8/22/16
to Firebase Google Group
Yeah, I apologize for the long delay.  Unfortunately the release date is out of my hands.  Should be within the next month. In the meantime, you may want to retry the transaction if you get that error.  You may want to do that irrespective of this bug, since a transaction can legitimately fail with this error if your client does a transaction while online but loses its internet connection before the transaction is confirmed by the server.  Since we don't know whether the transaction was applied or not, you will get this same error.

Sorry again.  Hope this helps some,
-Michael

To unsubscribe from this group and stop receiving emails from it, send an email to firebase-talk+unsubscribe@googlegroups.com.

To post to this group, send email to fireba...@googlegroups.com.

Kirtan Thakkar

unread,
Aug 23, 2016, 10:36:16 AM8/23/16
to Firebase Google Group
Thanks for the alternative.

In case of firebase looses connection before transaction is confirmed by the server, I can retry and that is fine. But, in the case transaction starts offline and it fails, so I call the transaction again and it will fail for sure. So, it will end up in loop when offline and never updates the data into the local state also. So, when I am offline, I am going to see the stale state of data as transactions are failing repeatedly in loop and not even reflecting locally. 

I hope it gets fixed soon. As, I can not move forward with this bug in production.

Thanks,
Kirtan

Kirtan Thakkar

unread,
Sep 25, 2016, 7:15:27 AM9/25/16
to Firebase Google Group
So, What I see today is the Firebase Android SDK update. It is now sustaining Transactions. Thank you for the update.

Regards,
Kirtan

Michael Lehenbauer

unread,
Sep 26, 2016, 4:11:53 PM9/26/16
to Firebase Google Group
Great to hear.  Thanks for following up!

To unsubscribe from this group and stop receiving emails from it, send an email to firebase-talk+unsubscribe@googlegroups.com.

To post to this group, send email to fireba...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages