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

fix: when entering idle mode, the old resolve-related resources have … #3402

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

harbourlga
Copy link
Contributor

…not been completely processed, and an exception occurs when exiting idle mode immediately.

Description (what this PR does / why we need it):

image1
image2
When grpc quickly enters and exits idle mode, there is a situation where it no longer obtains the latest service information. Previously, it was fixed that when the grpc client enters idle mode, the consul package will no longer watch service information again (#3162).
Recently, I found that it was not in idle mode. The target service was updated, but the client service discovery information was not updated. After investigation, it was found that there were problems with the previous modifications. A logic was added before. Every time it enters idle mode, if the number of watch objects in the serviceset reaches 0, it will try to recycle the serviceset. However, there is a certain delay in recycling the serviceset, and it may be blocked by a tick. Please see the code for details. When the serviceset has not been recycled, it will exit the idle mode immediately. When watching again, the resolve method will no longer be called. If the target service is no longer updated in the future, the client will no longer be able to obtain the latest service information because the goroutine for obtaining service information is no longer available.
What was changed?

  1. Removed serviceset recycling
  2. Added test case for this situation
  3. No longer determine whether the serviceset exists before calling resolve.

Which issue(s) this PR fixes (resolves / be part of):

Other special notes for the reviewers:

@dosubot dosubot bot added the size:L This PR changes 100-499 lines, ignoring generated files. label Aug 21, 2024
@harbourlga harbourlga force-pushed the fix-consul-resolve branch 3 times, most recently from 79b3012 to b90c9c9 Compare August 21, 2024 06:49
…not been completely processed, and an exception occurs when exiting idle mode immediately.

fix(test): fix gotest DATA RACE

fix(test): gotest errchecked

chore(gotest): gofmt

chore(gotest): consul address
@dosubot dosubot bot added the LGTM label Sep 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
LGTM size:L This PR changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants