Details
-
Bug
-
Status: Resolved
-
Minor
-
Resolution: Fixed
-
None
-
None
-
OBT
Description
The error messages is:
Error: 570. Test: memcachedtest.ecl '--- memcachedtest.xml +++ memcachedtest.xml @@ -41,7 +41,7 @@ <Row><Result_14>true</Result_14></Row> </Dataset> <Dataset name=Result 15> - <Row><Result_15>true</Result_15></Row> + <Row><Result_15>false</Result_15></Row> </Dataset> <Dataset name=Result 16> <Row><Result_16>false</Result_16></Row> '
This result belongs to this code fragment:
SEQUENTIAL( memcached.Clear(servers); memcached.SetString('testExpire', 'foobar', servers,, 10); memcached.Exists('testExpire', servers); // Result_14 Std.System.Debug.Sleep(9 * 1000); memcached.Exists('testExpire', servers); // Result_15 Std.System.Debug.Sleep(2 * 1000); memcached.Exists('testExpire', servers); // Result_16 );
Some info from GitHub
1 Second TTL Expires (Nearly) Immediately #307 neoform commented on Oct 24, 2017 When you set the TTL for an item when the clock is nearing the end of that second (eg, 21:00:00.999999) the item expires 0.000001 seconds later instead of 1 second later. dormando commented on Oct 25, 2017 Sadly since there's no high resolution clock in use, that's a thing that'll happen. The smallest realistic TTL is 2, and that'll still be +/- 1. It's always been this way though, and not sure it should be changed. Should I document this better somewhere before closing the issue?
So it seems in our case the expire can happen after 9.x second and the second Exists test can return with false instead of the expected true.
I think the proper fix is to set the first sleep to 8.5 or 8 sec and the second to 3.5 or 4 sec.