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

eureka client down after invoke refreshScope.refreshAll() ? #4160

Open
yonyong opened this issue Feb 8, 2023 · 5 comments
Open

eureka client down after invoke refreshScope.refreshAll() ? #4160

yonyong opened this issue Feb 8, 2023 · 5 comments

Comments

@yonyong
Copy link

yonyong commented Feb 8, 2023

The service of the eureka client is offline after using refreshAll or refresh(beanName).
My troubleshooting conclusion is that executing the refreshAll() or refresh(beanName) method will trigger multiple StatusChangeEvents and call the instance. setStatus() method in parallel to modify the instance status.
My idea is to disable eureka refresh, but after turning off the configuration, the application can still receive the RefreshScopeRefreshedEvent event.
So are there two things to consider?
1)If I set the configuration refresh to false: eureka.client.refresh.enable=false,then EurekaClientConfigurationRefresher should not receive the RefreshScopeRefreshedEvent event
2)If EurekaClientConfigurationRefresher receives the RefreshScopeRefreshedEvent event, it should do a layer of filtering, such as whether the event name is Eureka

@spencergibb
Copy link
Member

Are you trying to disable refresh of a running application?

@yonyong
Copy link
Author

yonyong commented Mar 4, 2023

Are you trying to disable refresh of a running application?
^_^ That's not it.

We use Apollo as our configuration hub and hot updates to our configuration are done using springcloud's refreshScope.refreshAll(). But the refreshAll method will rebuild the eureka bean and re-register to eureka server, which is not what we want, we just want to refresh a business configuration item.
So I tried to configure eureka.client.refresh.enabled=false and restarted the project.
But I found that org.springframework.cloud.netflix.eureka.EurekaDiscoveryClientConfiguration.EurekaClientConfigurationRefresher The onApplicationEvent method still receives the RefreshScopeRefreshedEvent event fired by refreshAll and performs an eureka reregistration. I don't think the design is quite right, is it?

@yonyong
Copy link
Author

yonyong commented Mar 4, 2023

image
I think when configure eureka.client.refresh.enable=false,this listener should be turned off as well. Otherwise a single call to refreshAll will trigger a re-registration of eureka here

@chenguanglee
Copy link

I also encountered such a problem

@yonyong
Copy link
Author

yonyong commented Feb 26, 2024

I think this should be a problem with the eureka implementation. Just turn off the eureka refresh listener, see my fix package for details: https://github.com/yonyong/spring-cloud-netflix-eureka-patch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants