-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
hds: prevent timer reset on every update #5977
Conversation
Signed-off-by: Sebastian Schepens <sebastian.schepens@mercadolibre.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, looks legit, can you add a test case in hds_integration_test
to cover this behavior?
@htuch i was wondering how to test this in an integration test. Do you have any ideas? |
@sschepens I think some variant of
Test/SimulatedTimeSystem (not sure how easy it is to use inside integration tests yet).
|
@htuch we have 2 things that could be tested, one is the update of the interval, if I change the interval I should receive a new response in the new interval. The other thing is the bug of the timer being reset everytime an update is received. |
Maybe just iterate some arbitrary number of times, e.g. 10, and see if we observe 10 responses? |
Signed-off-by: Sebastian Schepens <sebastian.schepens@mercadolibre.com>
We would need to sleep enough in each iteration to allow for responses to arrive, would that be OK? I just committed a test for interval update, could you take a look at it please? |
Interval update test looks good (although I wish we could use simulated time, will need to check with @jmarantz when he is back on this). I'd take as guidance that we don't want these tests to take more than a few seconds each as the upper bound on any real-time delays you'll add. |
Signed-off-by: Sebastian Schepens <sebastian.schepens@mercadolibre.com>
This pull request has been automatically marked as stale because it has not had activity in the last 7 days. It will be closed in 7 days if no further activity occurs. Please feel free to give a status update now, ping for review, or re-open when it's ready. Thank you for your contributions! |
+1 for using simulated time, which is definitely done in at least one integration test:
I'm not 100% sure whether that will work in this case, because if the timing is done in grpc itself it won't be using the Envoy time system abstraction. It's easy enough to tell: just switch to a SimulatedTimeSystem per the pattern above, and then run the test. It will run very fast, and probably fail 99% of the time, or work 100% of the time. |
Signed-off-by: Sebastian Schepens <sebastian.schepens@mercadolibre.com>
@jmarantz it would seem that |
See the example I pointed to. Just inherit from SimulatedTimeSystem in your test class. TimeSystem is the base class for SimulatedTimeSystem. |
Signed-off-by: Sebastian Schepens <sebastian.schepens@mercadolibre.com>
@htuch not excatly sure what you meant here, but I increased the timeouts to avoid flakes |
@sschepens ping me on slack if you have more questions about how sim-time works with integration tests. The the admin integration test I described above inherits indirectly from BaseIntegrationTest but it just inherits from SimulatedTimeSystem first, which establishes what time-system to use for the duration of the test. |
@sschepens Looks good, but could you chat with @jmarantz and figure out if we could use simulated time here without too much extra work? Thanks. |
SimulatedTimeSystem works with this test, but actually (and surprisingly to me) makes it 10x slower. I want to go investigate why that is and follow up. In the meantime I suggest going forward with this as is, using real time and I can address later. |
@jmarantz ack, thanks for looking into this folks. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
If we push frequent updates but with the same interval, we may never get responses back because the timer gets reset on every update. This change makes a reset only if the interval has changed or a disconnect ocurred. Signed-off-by: Sebastian Schepens <sebastian.schepens@mercadolibre.com> Signed-off-by: Fred Douglas <fredlas@google.com>
If we push frequent updates but with the same interval, we may never get responses back because the timer gets reset on every update.
This change makes a reset only if the interval has changed or a disconnect ocurred.