AndroidAPS icon indicating copy to clipboard operation
AndroidAPS copied to clipboard

Data Loss with AndroidAPS-Nightscout via NSCLIENTV3, due to Nightscout starting without database connection

Open petervanrijt opened this issue 11 months ago • 0 comments

Describe the bug The AndroidAPS queue is lost when the Nightscout front-end starts without a proper database connection. This issue is observed after updating to AndroidAPS v3.2.0.0+ (currently at AndroidAPS v3.2.0.4) and Nightscout v15.0.2. See screenshots 1 and 2 below.

Expected behavior AndroidAPS removes uploads from the queue even when there is an error message like 'NOT_FOUND DeviceStatus Error Cannot POST /api/v3/devicestatus'. The expected behavior is for AndroidAPS to only remove an upload from the queue if the upload was successful (see screenshot 3). It appears there is no (yet) control mechanism in AndroidAPS's NSCLIENTV3 that verifies whether an upload was successful before removing it from the queue.

My setup information I am currently running nightscout/cgm-remote-monitor:15.0.2 on Docker with mongo:4.4.17-rc0, all on a Synology NAS. We use AndroidAPS 3.2.0.4 to upload data to Nightscout using websockets.

To Reproduce

  • Scenario 1 - data loss I shut down my Synology and then boot it. It automatically boots the Nightscout container and mongo database container. Most of the time, Nightscout starts up before the MongoDB database, leading to an error on the Nightscout front-end (as shown in screenshot 2). AndroidAPS polls frequently to check whether Nightscout is available and, if it is, starts processing the queue (despite the error on the front-end). The uploads in the queue are lost because AndroidAPS uploads data without being able to save it in the Nightscout database (screenshot 1).

  • Scenario 2 - data queued I shut down Synology and then boot it without starting the Nightscout container and mongo database container. AndroidAPS queues uploads until nightscout becomes available. No data is lost.

Screenshot 1 20240324 1640 AndroidAPS - NSCLIENT V3

Screenshot 2 20240324 1640 Nightscout site

Screenshot 3 20240324 2157 AndroidAPS - NSCLIENT V3 OK

petervanrijt avatar Mar 24 '24 21:03 petervanrijt