You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
TrueLog.i(TAG, "---- boot time changed " + bootTimeChanged);
return !bootTimeChanged;
}
This method has a serious flaw. I'll start by providing a sequence of action scenario, Base and Scenario A, and finally Scenario B
Base
Phone boots
App launches requestTime is fired and the deviceUptime is cached at 10 seconds (easy round numbers for simplicity) cachedDeviceUptime = 10
Scenario A
Assuming the events of Base occurred first, imagine the following actions
Phone reboot
5 seconds later app is launched and truetime is initialize() cachedDeviceUptime is still 10. elapsedTime is 5
5 < 10 is true thus isTrueTimeCachedFromAPreviousBoot returns false, thus truetime is not initialized as expected.
Scenario B
This scenario exposes the flaw. Let's assume that the previous actions came from Base (Ignore Scenario A)
Phone reboots
20 seconds later app is launched and truetime is initialize() cachedDeviceUptime is 10. elapsedTime is 20
20 < 10 is false thus isTrueTimeCachedFromAPreviousBoot returns true, thus truetime is initialized using old and stale cached data.
This does relate to #85 somewhat. This is mostly an issue if the boot receiver for some reason does not broadcast the boot event to the application (say if the application is in a stopped state after a force-close).
The text was updated successfully, but these errors were encountered:
No solution for this yet? I'm having this issue and apparently creating a custom cache with the solution from #93 is the only solution, but would be nice to have a fix merged on the lib
truetime-android/library/src/main/java/com/instacart/library/truetime/DiskCacheClient.java
Lines 58 to 72 in a59e525
This method has a serious flaw. I'll start by providing a sequence of action scenario, Base and Scenario A, and finally Scenario B
Base
Phone boots
App launches
requestTime
is fired and thedeviceUptime
is cached at10
seconds (easy round numbers for simplicity)cachedDeviceUptime = 10
Scenario A
Assuming the events of
Base
occurred first, imagine the following actionsPhone reboot
5 seconds later app is launched and truetime is
initialize()
cachedDeviceUptime
is still10
.elapsedTime
is5
5 < 10
istrue
thusisTrueTimeCachedFromAPreviousBoot
returns false, thus truetime is not initialized as expected.Scenario B
This scenario exposes the flaw. Let's assume that the previous actions came from Base (Ignore Scenario A)
Phone reboots
20 seconds later app is launched and truetime is
initialize()
cachedDeviceUptime
is10
.elapsedTime
is20
20 < 10
isfalse
thusisTrueTimeCachedFromAPreviousBoot
returns true, thus truetime is initialized using old and stale cached data.This does relate to #85 somewhat. This is mostly an issue if the boot receiver for some reason does not broadcast the boot event to the application (say if the application is in a stopped state after a force-close).
The text was updated successfully, but these errors were encountered: