# How to Handle le\_avdata\_PushRecord Handler Failure

**URL:** <https://forum.legato.io/t/how-to-handle-le-avdata-pushrecord-handler-failure/4684>\
**Category:** Legato Application Framework\
**Created:** [September 9, 2019, 10:11pm UTC](https://forum.legato.io/t/how-to-handle-le-avdata-pushrecord-handler-failure/4684 "2019-09-09T22:11:12Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![dbeckwith](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.legato.io/dbeckwith/32/663_2.png) [@dbeckwith](https://forum.legato.io/u/dbeckwith)\
**Post date:** [September 9, 2019, 10:11pm UTC](https://forum.legato.io/t/how-to-handle-le-avdata-pushrecord-handler-failure/4684/1 "2019-09-09T22:11:12Z")

</div>

What should be done when the `le_avdata_PushRecord()` handler returns `LE_AVDATA_PUSH_FAILED`?

Should I retry the push, delete the resource loosing the data and then start again?

This is related to [https://forum.legato.io/t/le-avdata-pushrecord-handler-failure/4440](https://forum.legato.io/t/le-avdata-pushrecord-handler-failure/4440)

Thanks

---

<div class="post-metadata">

**Author:** ![nvd](https://avatars.discourse-cdn.com/v4/letter/n/82dd89/32.png) [@nvd](https://forum.legato.io/u/nvd)\
**Post date:** [September 10, 2019, 10:35pm UTC](https://forum.legato.io/t/how-to-handle-le-avdata-pushrecord-handler-failure/4684/2 "2019-09-10T22:35:10Z")

</div>

Hey Darren,

Have you looked closely at any of the AirVantage or LWM2M code (see [GitHub - legatoproject/legato-Service-AirVantageConnector: AirVantageConnector service](https://github.com/legatoproject/legato-Service-AirVantageConnector) and [GitHub - legatoproject/lwm2mCore: LWM2M Core](https://github.com/legatoproject/lwm2mCore))? I believe your error originates from line #99 in `avcDaemon/push.c` (see [avc-service.c · GitHub](https://gist.github.com/nvandoorn/b4a2d1df51699e36eb2e64863daca00e#file-avc-service-c-L23)). Looks like this error is reported when an ack is missed. Based on this quick analysis I would either a) re-send the data or b) verify that `avcService` will retry these failed pushes.

Hope this is helpful,

Happy hacking

---

<div class="post-metadata">

**Author:** ![dbeckwith](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.legato.io/dbeckwith/32/663_2.png) [@dbeckwith](https://forum.legato.io/u/dbeckwith)\
**Post date:** [September 10, 2019, 11:21pm UTC](https://forum.legato.io/t/how-to-handle-le-avdata-pushrecord-handler-failure/4684/3 "2019-09-10T23:21:57Z")

</div>

@nvd

Hey Nick,

Thanks for your thoughts and the links. I was already looking at some of those files especially `avcDaemon/push.c`.

Couple of things I have found so far that lead me to scratch my head:

1. Once a record has successfully pushed or queued then the record is reset. See `avcDaemon/timeseriesData.c` line #1597
2. It doesn’t matter if a push handler is called with a status of `LE_AVDATA_PUSH_SUCCESS` or `LE_AVDATA_PUSH_FAILED` the item on the push linked list is removed from the list and the data is lost at that point. See `avcDaemon/push.c` lines #105 to #122.

Perhaps you can review and see if you agree with my assessment.

Thoughts?

---

<div class="post-metadata">

**Author:** ![nvd](https://avatars.discourse-cdn.com/v4/letter/n/82dd89/32.png) [@nvd](https://forum.legato.io/u/nvd)\
**Post date:** [September 10, 2019, 11:30pm UTC](https://forum.legato.io/t/how-to-handle-le-avdata-pushrecord-handler-failure/4684/4 "2019-09-10T23:30:05Z")

</div>

Hey Darren,

That does seem accurate based on the code (though it may be good to review with the authors since it’s a complex project with lots of dependencies). If that analysis is correct, perhaps the code for `avcService` should be changed to remove data from the linked list after we receive the ACK.

Alternatively you could maintain your own list/queue in another app and only delete them after receiving `LE_AVDATA_PUSH_SUCCESS`. This seems like a ton of abstraction though, so it’s probably better to just submit a patch to `avcService`.

---

<div class="post-metadata">

**Author:** ![dbeckwith](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.legato.io/dbeckwith/32/663_2.png) [@dbeckwith](https://forum.legato.io/u/dbeckwith)\
**Post date:** [September 12, 2019, 3:55pm UTC](https://forum.legato.io/t/how-to-handle-le-avdata-pushrecord-handler-failure/4684/5 "2019-09-12T15:55:43Z")

</div>

Sierra has identified this as a problem and the issue is being worked on internally.

> [@le\_avdata\_PushRecord Handler Failure](https://forum.legato.io/t/le-avdata-pushrecord-handler-failure/4440):
>
> What would cause le\_avdata\_PushRecord to return LE\_OK but then the push handler to report LE\_AVDATA\_PUSH\_FAILEDLE\_AVDATA\_PUSH\_FAILED . The network is connected and an AirVantage session is open. There doesn’t seem to be any other clues in the log. Thoughts,
