Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
fix(dns): Eliminate asynchronous timer in syncQuery() to prevent hang risk #11900
fix(dns): Eliminate asynchronous timer in syncQuery() to prevent hang risk #11900
Changes from all commits
121c9df
dcceee7
bccd2b5
90e5c1d
95247d6
607591a
0e217a8
0c14c6a
b8152a5
7879736
f201ef2
1a407ac
dc2f773
2b7c659
c0483f6
68eb5ff
c31bac6
e4919ea
a20df81
15fbf88
c09fb47
9029c09
40fdfcf
ce058f4
edd877d
0882b53
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
What could happen if we didn't include this
+1
?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.
Please see the comment above, without the +1 there is a risk semaphore might timeout before resolve actually happened. Because timer are eventual consistent system and we can not expect it to always execute in a timely manner.
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.
There are two scenerio where waiting time or timeout
options.timeout
: a timeout used for network IO of the DNS queryresolve_max_wait
: waiting for the completion of the DNS query.If there is no difference of
+1s
, these two timeouts will be similar. Consequently, the second scenario may conclude before the first DNS query retrieves the result.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.
Hmmm - how can we be sure that adding
+2
will makesemaphore:wait()
expire? I'm wondering whether this will not introduce flakiness 🤔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.
Also would it be possible to use some kind of waiter function pattern that would check against a predicate every interval ?
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.
If the waiting of the test case happens under two endpoint of C/S model, like that a client wait for server to complete some tasks, your advice is the suitable way to do. We need to be especially care of handling the synchronization issues between two different processes to prevent the flakiness.
But here we only run the DNS query and wait the result in one process, just testing dns library, not starting the kong gateway to do C/S testing. So if this test case fails, there must be some pressing problem happening in the DNS library.
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.
TL;DR: it is a unit test, the chance of flakiness is much lower because client runs much faster than the entire Gateway