-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
bug: Unable to get the latest upstream node list by service discovery #2369
Comments
@qiujiayu Do you have time to look at this issue? |
Adding |
I don’t know how to determine the up_version. Eureka does not have this attribute. Although the data of consul has Is there a better solution, or let the implementation of service discovery be responsible for invalidating the server_picker cache? |
When data is synchronized, first compare, and only update to Lua table when changing. then we can use the Lua table as the key of apisix/apisix/plugins/referer-restriction.lua Line 113 in 5b97223
|
Both the configuration and the ip address of the upstream should affect the cache of healthchecker and server-picker. If use table as the cache version, how to know the configuration of the upstream has changed? I think we can maintain the ip list for each upstream in the service discovery, and use a number to indicate the version of the upstream. When the upstream ip changes, the number will increase, and it will be used as part of the current cache version , this will not make the cache version too long |
Fix apache#2369 Fix apache#1838 Signed-off-by: spacewander <spacewanderlzx@gmail.com>
Fix apache#2369 Fix apache#1838 Signed-off-by: spacewander <spacewanderlzx@gmail.com>
Issue description
I use consul as the registry center and configuration center of apisix and I implemented a consul service discovery through consul-template. After an application is redeployed, the log shows that the consul service discovery has obtained the latest application IP list, but accessing the application through apisix returns 502, the log shows that apisix uses the old application IP.
I think it is caused by the cache of server_picker:
When the upstream checker is not enabled, the value of version is equal to
route.modifiedIndex .. "&" .. service.modifiedIndex
, the change of the application ip address in the registry center will not cause this value to change, this will cause the application to be inaccessible until the server_picker cache is invalidated.I use consul as service discovery instead of eureka, but I believe that using eureka will also have this problem. I think the version should be obtained when obtaining the service ip address:
change to:
Environment
apisix version
): lastest master(251625d)Minimal test code / Steps to reproduce the issue
discovery: eureka
andworker_processes: 1
, config eureka address in config.yaml.What's the actual result? (including assertion message & call stack if applicable)
access application through apisix returns 502
What's the expected result?
no error
The text was updated successfully, but these errors were encountered: