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

Modify the nacos configuration, Restart the application results in continuous error logs. #13053

Closed
wentfar opened this issue Jan 18, 2025 · 5 comments
Labels
status/duplicate This issue or pull request already exists status/invalid This doesn't seem right

Comments

@wentfar
Copy link

wentfar commented Jan 18, 2025

Describe the bug
A clear and concise description of what the bug is.

I have a springboot application that uses druid components and nacos components, nacos has used authentication. Duird-related configurations are configured in the properties and nacos. Druid is configured with multiple data sources. Resources directory is like this:

  • bootstrap.properties

spring.application.name=cp-index 
spring.cloud.nacos.config.enabled=${NACOS_ENABLED:false} 
spring.cloud.nacos.config.server-addr=${NACOS_SERVER_URL:nacos.infrastructure} 
spring.cloud.nacos.config.file-extension=properties 
spring.cloud.nacos.config.namespace=${NACOS_NAMESPACE:release} 
spring.cloud.nacos.config.group=cp 
spring.cloud.nacos.config.refresh-enabled=true 
spring.cloud.nacos.config.username=${NACOS_USERNAME:nacos} 
spring.cloud.nacos.config.password=${NACOS_PASSWORD:nacos} 
spring.cloud.nacos.config.extension-configs[0].data-id=common.properties 
spring.cloud.nacos.config.extension-configs[0].group=cp 

  • nacos config like this:
data ID: cp-index.properties
group: cp
content:
...
spring.datasource.druid.ob.filter.config.enabled=flase
spring.datasource.druid.ob.connect-properties.config.decrypt=false
spring.datasource.druid.ob.initial-size=10
spring.datasource.druid.ob.max-active=36
spring.datasource.druid.ob.min-idle=10
spring.datasource.druid.ob.max-wait=60000
...
  • application.properties

spring.profiles.include=mybatis,druid,tracer,ob
....

  • application-druid.properties
spring.datasource.druid.filter.config.enabled=true 
spring.datasource.druid.connect-properties.config.decrypt=true 
spring.datasource.druid.connect-properties.config.decrypt.key=${spring.datasource.druid.pub-key} 
spring.datasource.druid.initial-size=1 
spring.datasource.druid.max-active=5

  • application-ob.properties
\# mysql tenant
spring.datasource.druid.ob.driver-class-name=com.alipay.oceanbase.jdbc.Driver 
spring.datasource.druid.ob.url= 
spring.datasource.druid.ob.username= 
spring.datasource.druid.ob.password= 
spring.datasource.druid.ob.filter.config.enabled=flase 
spring.datasource.druid.ob.connect-properties.config.decrypt=false 
spring.datasource.druid.ob.initial-size=2 
spring.datasource.druid.ob.max-active=30 
spring.datasource.druid.ob.min-idle=5 
spring.datasource.druid.ob.max-wait=60000 
\# oracle tenant 
spring.datasource.druid.ob1.driver-class-name=com.alipay.oceanbase.jdbc.Driver 
spring.datasource.druid.ob1.url= 
spring.datasource.druid.ob1.username= 
spring.datasource.druid.ob1.password= 
spring.datasource.druid.ob1.filter.config.enabled=flase 
spring.datasource.druid.ob1.connect-properties.config.decrypt=false 
spring.datasource.druid.ob1.initial-size=2 
spring.datasource.druid.ob1.max-active=30 
spring.datasource.druid.ob1.min-idle=5 
spring.datasource.druid.ob1.max-wait=60000 
spring.datasource.druid.ob1.test-while-idle=true 
spring.datasource.druid.ob1.test-on-borrow=true 
spring.datasource.druid.ob1.validation-query=SELECT 1 FROM DUAL 
spring.datasource.druid.ob1.oracle=true

When the application is running, modify the nacos configuration, such as modifying the max-active configuration of the database in the druid configuration, and then restart the application almost simultaneously. The application has two nodes. One node is normal and the other node keeps reporting errors. The errors are as follows:

ErrCode:403, ErrMsg:http error, code=403,dataId=cp-index-ob.properties,group=cp,tenant=release at com.alibaba.nacos.client.config.impl.ClientWorker$ConfigRpcTransportClient.queryConfig(ClientWorker.java:1035) at com.alibaba.nacos.client.config.impl.ClientWorker.getServerConfig(ClientWorker.java:407) at com.alibaba.nacos.client.config.NacosConfigService.getConfigInner(NacosConfigService.java:166) at com.alibaba.nacos.client.config.NacosConfigService.getConfig(NacosConfigService.java:94) at com.alibaba.cloud.nacos.client.NacosPropertySourceBuilder.loadNacosData(NacosPropertySourceBuilder.java:85) at com.alibaba.cloud.nacos.client.NacosPropertySourceBuilder.build(NacosPropertySourceBuilder.java:73) at com.alibaba.cloud.nacos.client.NacosPropertySourceLocator.loadNacosPropertySource(NacosPropertySourceLocator.java:199) at com.alibaba.cloud.nacos.client.NacosPropertySourceLocator.loadNacosDataIfPresent(NacosPropertySourceLocator.java:186) at com.alibaba.cloud.nacos.client.NacosPropertySourceLocator.loadApplicationConfiguration(NacosPropertySourceLocator.java:149) at com.alibaba.cloud.nacos.client.NacosPropertySourceLocator.locate(NacosPropertySourceLocator.java:103) at org.springframework.cloud.bootstrap.config.PropertySourceLocator.locateCollection(PropertySourceLocator.java:52) at org.springframework.cloud.bootstrap.config.PropertySourceLocator.locateCollection(PropertySourceLocator.java:47) at org.springframework.cloud.bootstrap.config.PropertySourceBootstrapConfiguration.initialize(PropertySourceBootstrapConfiguration.java:101) at org.springframework.boot.SpringApplication.applyInitializers(SpringApplication.java:626) at org.springframework.boot.SpringApplication.prepareContext(SpringApplication.java:370) at org.springframework.boot.SpringApplication.run(SpringApplication.java:314) at org.springframework.boot.builder.SpringApplicationBuilder.run(SpringApplicationBuilder.java:140) at org.springframework.cloud.context.refresh.ContextRefresher.addConfigFilesToEnvironment(ContextRefresher.java:113) at org.springframework.cloud.context.refresh.ContextRefresher.refreshEnvironment(ContextRefresher.java:93) at org.springframework.cloud.context.refresh.ContextRefresher.refresh(ContextRefresher.java:85) at org.springframework.cloud.endpoint.event.RefreshEventListener.handle(RefreshEventListener.java:72) at org.springframework.cloud.endpoint.event.RefreshEventListener.onApplicationEvent(RefreshEventListener.java:61) at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:172) at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:165) at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:139) at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:404) at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:361) at com.alibaba.cloud.nacos.refresh.NacosContextRefresher$1.innerReceive(NacosContextRefresher.java:133) at com.alibaba.nacos.api.config.listener.AbstractSharedListener.receiveConfigInfo(AbstractSharedListener.java:40) at com.alibaba.nacos.client.config.impl.CacheData$1.run(CacheData.java:312) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:750)

Expected behavior
A clear and concise description of what you expected to happen.

The application is normal

Actually behavior
A clear and concise description of what you actually to happen.

The application reports a lot of error logs, as mentioned above.

How to Reproduce
Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See errors

Desktop (please complete the following information):

  • OS: [Centos]
  • Version [e.g. nacos-server xxx, nacos-client 2.0.3,spring-boot-starter 2.3.9,spring-cloud-starter-alibaba-nacos-config 2.2.7 , druid-spring-boot-starter 1.1.24]
  • Module [e.g. naming/config]
  • SDK [e.g. original, spring-cloud-starter-alibaba-nacos-config, druid-spring-boot-starter]

Additional context
Add any other context about the problem here.

@Sarahbella4040
Copy link

Er

@KomachiSion
Copy link
Collaborator

403 is not authed problem, means your configuration leak user and password or with wrong username and password.

According to the issue #13055 you submitted. I think this problem you has sovled.

@KomachiSion KomachiSion added status/invalid This doesn't seem right status/duplicate This issue or pull request already exists labels Jan 20, 2025
@wentfar
Copy link
Author

wentfar commented Jan 20, 2025

403 is not authed problem, means your configuration leak user and password or with wrong username and password.

According to the issue #13055 you submitted. I think this problem you has sovled.

I modify the nacos config item, then restart app, the app result in this error. Then I restart the app again, this errors dismissed, without any change, without changing any username and password info.

And The app of this issue is different with the app of issue #13055 , It seems it is not the same reason.

@KomachiSion
Copy link
Collaborator

Please check with your configuration and env params to make sure there is no more same name configuration about nacos username and password conflict.

From your description, some time start app is ok and some time start is error. Sound like async-concurrent problem. Some time read A properties and wrong username password and sometime read B properties with right username password.

If you are using upper version nacos client like 2.4.3, you can set -DlogAllProperties=true in your app and see nacos client logs:

${user.home}/logs/nacos/config.log to see whether input right username and password.

@KomachiSion
Copy link
Collaborator

No more response from author for a long time, and this problem seems usage problem.

@KomachiSion KomachiSion closed this as not planned Won't fix, can't repro, duplicate, stale Feb 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status/duplicate This issue or pull request already exists status/invalid This doesn't seem right
Projects
None yet
Development

No branches or pull requests

3 participants