Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

xDrip detect future data #1690

Open
hapvlz opened this issue Mar 30, 2021 · 30 comments
Open

xDrip detect future data #1690

hapvlz opened this issue Mar 30, 2021 · 30 comments
Labels
Projects

Comments

@hapvlz
Copy link

hapvlz commented Mar 30, 2021

Hi Guys,

I've been using xDrip for some time but today I've experienced seems like a bug.
On main page I can see that last update of glucose is from 182 minutes ago.

In Status page I can see message "Your device has future data on it, Please double check the time and timezone on this phone"
Restarting collector, forgetting device, deleting future data do not help.

In log viewer I can see error "NonMonotonicSequenceException: org.apache.commons.math3.exception.NonMonotonicSequenceException: points 20 and 21 are not strictly increasing (1 621 420 351 801 >= 1 617 126 284 505)

No any other errors observed. Sensor can be scanned using other apps, but manual scan also fails on xDrip.

I am using FreeStyle Libre 1 + Miao Miao 2 -> xDrip
xDrip version is: 1f9d6e6-2021.03.26
Phone is: Xiaomi Mi 8 Pro Android 10 QKQ1

  • Tried to restart phone
  • Since we recently had timezone change (i think 2-3 days ago) I've tried to change manually phone to 1 hour back but not helped.

Not sure what is causing this behavior.
Any ideas?

// What I've noticed that in the background the reading looks fine, when I scan manually sensor with NFC graph seems to showing correct value, however main screen and it value on the top is getting crazy, same about the time.
Also due to that data is not being passed to Nightscout, and also dats is not fetched from miao miao.

@hapvlz
Copy link
Author

hapvlz commented Mar 31, 2021

Do you have somewhere available alternative xDrip source that can be used in parallel with original xDrip?
I don't want to mess with the original app, but in other hand I would like to debug this issue, however source code base on the released version and while starting it in android studio it's trying to replace the original one on my phone.

I've already installed alternative release on phone, but need to debug it with source.
Seems the problem is somewhere in function : CalculateFromDataTransferObject() in file LibreAlarmReceiver.

Seems like failing on this catch -

if(polyxList.size() >= 3) {
                    // The need to have at least 3 points is a demand from the interpolate function.
                    try {
                        PolynomialSplineFunction polySplineF = splineInterp.interpolate(
                                Forecast.PolyTrendLine.toPrimitiveFromList(polyxList),
                                Forecast.PolyTrendLine.toPrimitiveFromList(polyyList));
    
                        final long startTime = mHistory.get(0).realDate;
                        final long endTime = mHistory.get(mHistory.size() - 1).realDate;
    
                        for (long ptime = startTime; ptime <= endTime; ptime += 300000) {
                            if (d)
                                Log.d(TAG, "Spline: " + JoH.dateTimeText((long) ptime) + " value: " + (int) polySplineF.value(ptime));
                            if (use_raw) {
                                // Here we do not use smoothed data, since data is already smoothed for the history
                                createBGfromGD(new GlucoseData((int) polySplineF.value(ptime), ptime), false, true);
                            } else {
                                BgReading.bgReadingInsertFromInt((int) polySplineF.value(ptime), ptime, false);
                            }
                        }
                    } catch (org.apache.commons.math3.exception.NonMonotonicSequenceException e) {
                        Log.e(TAG, "NonMonotonicSequenceException: " + e);
                    }
                }

@Navid200
Copy link
Collaborator

The suggestion was to use facebook first, not to use facebook and also open an issue here.

Anyway, do you have a watch or any other device like a pump that you have not mentioned?

Can you show Android settings -> System -> Date & Time

@hapvlz
Copy link
Author

hapvlz commented Mar 31, 2021

There are but nothing that should interfere with xDrip.
Samsung Galaxy Smartwatch but it's not connected directly to xDrip, it's going through G-Watch application that fetch data from xDrip I guess.
Pump is not connected to this loop at all.
Nightscout is set with xDrip but I've disabled it for the time when problem appear.

After a day xDrip started working properly, it's fully working now. (It fixed by it own) from a scan to scan error about NonMonotonicSequenceException disappear.
However I would like to keep this issue open to avoid such situation in future or find solution for it.

Date time is set to use network provided.
Timezone is also set to automatically use network provided timezone.

I think screen is not needed here, anyway most likely it will not be understandable as it's in my language which is not English.
The problem seems to be in data received from sensor that could not be parsed properly.

If needed I can also provide the dump of sensor memory from time when problem happened for further investigation.

@Navid200
Copy link
Collaborator

This can be found in a search even after it is closed. If your issue has been resolved, there is no reason to keep this issue open.

And if you find instructions or more data that you like to add, you can continue to add it here even after the issue is closed.

@hapvlz
Copy link
Author

hapvlz commented Mar 31, 2021

Additional useful information, issue happened between:
Started -
30-March-2021 19:35 (First error about "Cannot inject display glucose value as time different is too great: 2021-05-19 12:33:10 vs 2021-03-30 19:35:23)
30-March-2021 19:50 (First error about "NonMonotonicSequenceException: org.apache.commons.math3.exception.NonMonotonicSequenceException: points 30 and 31 are not strictly increasing (1 621 420 329 790 >= 1 617 126 262 494)

Ended:
31-March-2021 03:30 (Last error about "NonMonotonicSequenceException: org.apache.commons.math3.exception.NonMonotonicSequenceException: points 0 and 1 are not strictly increasing (1 621 420 320 865 >= 1 617 126 253 569)

@hapvlz hapvlz closed this as completed Mar 31, 2021
@hapvlz hapvlz reopened this Mar 31, 2021
@hapvlz
Copy link
Author

hapvlz commented Mar 31, 2021

I've tried to close this issue, however it's not appearing anymore on list of open issues.
Which is not the point, the issue is still open, can re-occur anytime not just for me but everyone, and we don't know what is the reason of it, or how to fix/avoid that.

I would still like to keep it open maybe someone will have idea for it.
The fact that it's not happening for now doesn't mean as for me that it should be closed.

@Navid200
Copy link
Collaborator

Duplicate: #1493

@hapvlz
Copy link
Author

hapvlz commented Mar 31, 2021

Dear @Navid200,

how is it a duplicate? I've did research across all the issues and I seen just one similar behavior but it was happening for Libre2.
Issue that you pinned as duplicate is not relevant at all to issue that I've reported, I don't see a single point that would be the same in pinned duplicate issue and mine.

Can you please provide more info how the issue explained in #1493 is relevant to the one reported by me ?
Timezone switch in my country happened on 27-March, and issue happened on 30 March.

Also subject of MiBand and everything else is not relevant.

The relevant issue is #1294 but there was never an answer/fix.

@Navid200
Copy link
Collaborator

Navid200 commented Mar 31, 2021

He calls it legal time. But, he means daylight savings time, which is the issue.

@hapvlz
Copy link
Author

hapvlz commented Mar 31, 2021

But it's not related at all, as you can see in my previous posts here, I'm mentioning that xDrip discover data from 2 months in future. That seems to be not relevant for daylight saving time at all.

Quote -

30-March-2021 19:35 (First error about "Cannot inject display glucose value as time different is too great: 2021-05-19 12:33:10 vs 2021-03-30 19:35:23)

I'm fine having marked it as duplicate, doesn't matter that much for me.
However I don't see any connection between those two issues - sorry.

@Navid200
Copy link
Collaborator

Your description states that this whole thing started because you changed the time.

Whenever you have multiple devices communicating and transferring data, time synchronization is a requirement. If the times are not synchronized, you could have all sorts of symptoms. The symptoms may be different. But, if we open a unique issue for every single symptom, we will have hundreds of issues, which aren't real issues, burying the real issues.

@hapvlz
Copy link
Author

hapvlz commented Mar 31, 2021

@Navid200 Sorry then, I didn't meant that that the issue started after changing the time.
I've changed time to see if the problem with time difference will change as I was suspecting that recent daylight switch time happened on 27-March could cause this. But changing the time manually didn't change anything, the issue was still the same.

I didn't touch the date/time before the issue happened.
Also the problem occurred 3 days after the daylight switch happened, so that's not an option it cause the issue.

@Navid200
Copy link
Collaborator

That's OK. The label suggests that there are commonalities. That's all.

@Navid200
Copy link
Collaborator

Navid200 commented Mar 31, 2021

Can you describe a method to reproduce this?

@hapvlz
Copy link
Author

hapvlz commented Mar 31, 2021

I have one a little bit advanced way. I have exported memory of sensor while the issue happened. I was able to import the memory into another sensor that is not used anymore and xDrip while reading showing exactly the same error.

Apart from this I have no idea how we can re-produce that, it just randomly happened.

If any of dev willing to try it out I can share the memory dump, or if something I am available to collect traces or whatever is needed from xDrip using the sensor with "corrupted" memory. I am also available for remote session if needed.

I will put my all efforts to help you fix it if it's a bug (and seems it is).
We have private group of people sick in Poland, already 3-4 people experienced it randomly (not just in past week) but month-two months.

@Navid200
Copy link
Collaborator

I personally only know about Dexcom and I am not a developer yet.
Hopefully, someone who has experience with Libre can help.

@Navid200
Copy link
Collaborator

Navid200 commented Apr 2, 2021

Do you have a Bluetooth glucose meter?

@hapvlz
Copy link
Author

hapvlz commented Apr 2, 2021

Yes, but not connected to xDrip/Phone.

@hapvlz
Copy link
Author

hapvlz commented Apr 3, 2021

Again, the same problem happening on a fresh new sensor.
I've just injected new one, activated with Libre application, 60 minutes passed, and xdrip showing exactly the same error and it cannot pass the start new sensor procedure.

Some screens -

https://i.imgur.com/1AkFKBM.png
https://i.imgur.com/fiAa1sf.png
https://i.imgur.com/eO7YmN3.png
https://i.imgur.com/vdffRDM.png
https://i.imgur.com/9qtG2tc.png

I can try re-install the app, maybe some of the settings I use cause this.
Not sure if I re-install if I lose all the historic.

@Navid200 Navid200 added bug any kind of software error device-libre device-miaomiao help and removed duplicate labels Apr 3, 2021
@hapvlz
Copy link
Author

hapvlz commented Apr 10, 2021

Another person in another group experienced similar issue with same error -

https://i.imgur.com/aT79Gh3.png

@hapvlz
Copy link
Author

hapvlz commented Apr 27, 2021

New sensor started, error still appear -

"NonMonotonicSequenceException: org.apache.commons.math3.exception.NonMonotonicSequenceException: points 0 and 1 are not strictly increasing (1 619 473 052 521 >= 1 619 473 052 521)

Application updated to latest possible beta version.

@slawie
Copy link

slawie commented May 15, 2021

haplz - just to let you know that are not alone. My xDrip has had the exact same issue for the second time yesterday. The first time it happened I tried all the same things you did with the same observations.
Yesterday (14th May 2021) the logs are showing that there are glucose values from the 4th July 2021, waaay into the future.
I live in Brisbane so there are no timezone changes here at any time of the year.
My setup is Libre 1, with maiomaio 1, and I also sync data to my nightscout site and my Garmin Nautix 5 watch.

@yosepito
Copy link

Hi, just a question related to this. I'm suffering from BLE disconnections with both direct link to FL2, patched app passing data to Xdrip and MM2. Any configuration shares the problem that, ocasionally, when the BLE is interrupted, xdrip is unable to yield the BG reading, despite OOP2 has replied to query. The main error in log is "sensor age has not advanced" and it seems to me -I am not a techie expert at all- that the main problem is that every 5 minutes xdrip takes values from FRAM. When a reading is lost, the most updated set of readings still contains readings in the past so, somehow, xdrip understoods that sensor age has not advanced (timestamp readings from sensor contain some past readings and "future" readings). Can this problem be related to your issue? Is it a common problem of time handling with FL2?

Earlier versions that did not use FRAM do not have this problem. Furthermore, when I NFC scanned the sensor in Xdrip it yielded readings, but with newer versions the problem is "sensor age has not advanced" when doing such NFC scan.

Any update on this?

@tolot27
Copy link
Collaborator

tolot27 commented Oct 13, 2021

@tzachi-dar Do you have any idea what is causing the ""sensor age has not advanced" message?

@tolot27 tolot27 added this to Low priority in Bug fixing Nov 17, 2021
@nwsiqueira
Copy link

Hello, @hapvlz

Did you manage to find any solution?
I had the same problem here out of the blue, I can't get it back to normal at all...

Screenshot_2023-05-26-12-05-26-659_com.eveningoutpost.dexdrip.png

Screenshot_2023-05-26-12-00-59-638_com.eveningoutpost.dexdrip.jpg

@Navid200
Copy link
Collaborator

Navid200 commented Mar 6, 2024

@PhilTU Do you know anything about this?

@tzachi-dar
Copy link
Contributor

Is this still happening to anyone?

@PhilTU
Copy link

PhilTU commented Mar 6, 2024

Not quite sure what's being asked, but we do see data being removed with timing related error messages :-
417485411_10231246882012905_7642145974842450362_n

@Navid200
Copy link
Collaborator

Navid200 commented Mar 6, 2024

Not quite sure what's being asked, but we do see data being removed with timing related error messages :- !

No readings, with the message: future data

@PhilTU
Copy link

PhilTU commented Mar 6, 2024

No readings, with the message: future data

don't recall seeing that. Sensor age backwards is more common. Will keep an eye out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Bug fixing
Low priority
Development

No branches or pull requests

8 participants