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

nacos-server 由2.2.3升级到2.3.1,不能发现已启动的服务。降级也是如此。 #11887

Open
habwang opened this issue Mar 27, 2024 · 19 comments
Assignees

Comments

@habwang
Copy link

habwang commented Mar 27, 2024

nacos-server-2.2.3升级到nacos-server-2.3.1后,不能自动发现已启动的服务。
使用的nacos-client 1.4.1
nacos-server降级也是如此。nacos-server-2.3.1降级到nacos-server-2.2.3后,服务列表也是空;

INFO ConnectionMetrics, totalCount = 0, detail = {long_connection=0, long_polling=0}

@habwang habwang changed the title nacos-server 由2.2.3升级到2.3.1,不能发现已启动的服务 nacos-server 由2.2.3升级到2.3.1,不能发现已启动的服务。降级也是如此。 Mar 27, 2024
@stone-98
Copy link
Contributor

能否提供更多的详细信息?

@habwang
Copy link
Author

habwang commented Mar 28, 2024

能否提供更多的详细信息?

nacos管理界面提示

nacos.log

2024-03-28 01:28:09,386 INFO Starting Nacos v2.3.1 using Java 17.0.8 on cnki with PID 3179465 (/home/website/nacos-2.3.1/target/nacos-server.jar started by root in /home/website/nacos-2.3.1)

2024-03-28 01:28:09,387 INFO The following 1 profile is active: "standalone"

2024-03-28 01:28:09,522 INFO Load Nacos package exclude filter success, package prefix com.alibaba.nacos.config.server, filter com.alibaba.nacos.config.server.filter.ConfigEnabledFilter

2024-03-28 01:28:09,522 INFO Load Nacos package exclude filter success, package prefix com.alibaba.nacos.naming, filter com.alibaba.nacos.naming.config.NamingEnabledFilter

2024-03-28 01:28:09,523 INFO Load Nacos package exclude filter success, package prefix com.alibaba.nacos.istio, filter com.alibaba.nacos.istio.config.IstioEnabledFilter

2024-03-28 01:28:09,692 INFO Skip @SpringBootApplication annotation for class com.alibaba.nacos.config.server.Config to avoid duplicate scan

2024-03-28 01:28:09,805 INFO Skip @SpringBootApplication annotation for class com.alibaba.nacos.naming.NamingApp to avoid duplicate scan

2024-03-28 01:28:09,817 INFO Skip @SpringBootApplication annotation for class com.alibaba.nacos.cmdb.CmdbApp to avoid duplicate scan

2024-03-28 01:28:09,827 WARN Istio module disabled because set nacos.extension.naming.istio.enabled as false

2024-03-28 01:28:09,828 WARN Istio module disabled because set nacos.extension.naming.istio.enabled as false

2024-03-28 01:28:09,828 WARN Istio module disabled because set nacos.extension.naming.istio.enabled as false

2024-03-28 01:28:09,828 WARN Istio module disabled because set nacos.extension.naming.istio.enabled as false

2024-03-28 01:28:09,828 WARN Istio module disabled because set nacos.extension.naming.istio.enabled as false

2024-03-28 01:28:09,828 WARN Istio module disabled because set nacos.extension.naming.istio.enabled as false

2024-03-28 01:28:09,829 WARN Istio module disabled because set nacos.extension.naming.istio.enabled as false

2024-03-28 01:28:09,829 WARN Istio module disabled because set nacos.extension.naming.istio.enabled as false

2024-03-28 01:28:09,829 WARN Istio module disabled because set nacos.extension.naming.istio.enabled as false

2024-03-28 01:28:09,829 WARN Istio module disabled because set nacos.extension.naming.istio.enabled as false

2024-03-28 01:28:09,829 WARN Istio module disabled because set nacos.extension.naming.istio.enabled as false

2024-03-28 01:28:09,830 WARN Istio module disabled because set nacos.extension.naming.istio.enabled as false

2024-03-28 01:28:09,830 WARN Istio module disabled because set nacos.extension.naming.istio.enabled as false

2024-03-28 01:28:09,830 WARN Istio module disabled because set nacos.extension.naming.istio.enabled as false

2024-03-28 01:28:09,830 WARN Istio module disabled because set nacos.extension.naming.istio.enabled as false

2024-03-28 01:28:09,830 WARN Istio module disabled because set nacos.extension.naming.istio.enabled as false

2024-03-28 01:28:09,830 WARN Istio module disabled because set nacos.extension.naming.istio.enabled as false

2024-03-28 01:28:09,830 WARN Istio module disabled because set nacos.extension.naming.istio.enabled as false

2024-03-28 01:28:09,831 WARN Istio module disabled because set nacos.extension.naming.istio.enabled as false

2024-03-28 01:28:09,831 WARN Istio module disabled because set nacos.extension.naming.istio.enabled as false

2024-03-28 01:28:09,831 WARN Istio module disabled because set nacos.extension.naming.istio.enabled as false

2024-03-28 01:28:09,831 WARN Istio module disabled because set nacos.extension.naming.istio.enabled as false

2024-03-28 01:28:09,831 WARN Istio module disabled because set nacos.extension.naming.istio.enabled as false

2024-03-28 01:28:09,831 WARN Istio module disabled because set nacos.extension.naming.istio.enabled as false

2024-03-28 01:28:09,832 WARN Istio module disabled because set nacos.extension.naming.istio.enabled as false

2024-03-28 01:28:09,832 INFO Skip @SpringBootApplication annotation for class com.alibaba.nacos.istio.IstioApp to avoid duplicate scan

2024-03-28 01:28:09,832 WARN Istio module disabled because set nacos.extension.naming.istio.enabled as false

2024-03-28 01:28:09,832 WARN Istio module disabled because set nacos.extension.naming.istio.enabled as false

2024-03-28 01:28:09,832 WARN Istio module disabled because set nacos.extension.naming.istio.enabled as false

2024-03-28 01:28:09,832 WARN Istio module disabled because set nacos.extension.naming.istio.enabled as false

2024-03-28 01:28:09,832 WARN Istio module disabled because set nacos.extension.naming.istio.enabled as false

2024-03-28 01:28:09,833 WARN Istio module disabled because set nacos.extension.naming.istio.enabled as false

2024-03-28 01:28:09,833 WARN Istio module disabled because set nacos.extension.naming.istio.enabled as false

2024-03-28 01:28:09,833 WARN Istio module disabled because set nacos.extension.naming.istio.enabled as false

2024-03-28 01:28:09,833 WARN Istio module disabled because set nacos.extension.naming.istio.enabled as false

2024-03-28 01:28:09,833 WARN Istio module disabled because set nacos.extension.naming.istio.enabled as false

2024-03-28 01:28:09,833 WARN Istio module disabled because set nacos.extension.naming.istio.enabled as false

2024-03-28 01:28:10,129 INFO Skip @SpringBootApplication annotation for class com.alibaba.nacos.prometheus.PrometheusApp to avoid duplicate scan

2024-03-28 01:28:11,941 INFO Tomcat initialized with port(s): 8848 (http)

2024-03-28 01:28:12,144 INFO Starting service [Tomcat]

2024-03-28 01:28:12,144 INFO Starting Servlet engine: [Apache Tomcat/9.0.83]

2024-03-28 01:28:12,236 INFO Initializing Spring embedded WebApplicationContext

2024-03-28 01:28:12,236 INFO Root WebApplicationContext: initialization completed in 2781 ms

2024-03-28 01:28:12,490 INFO Nacos-related cluster resource initialization

2024-03-28 01:28:12,495 INFO Load com.alibaba.nacos.core.ability.RemoteAbilityInitializer for ServerAbilityInitializer

2024-03-28 01:28:12,495 INFO Load com.alibaba.nacos.naming.ability.NamingAbilityInitializer for ServerAbilityInitializer

2024-03-28 01:28:12,498 INFO The cluster resource is initialized

2024-03-28 01:28:12,754 INFO HikariPool-1 - Starting...

2024-03-28 01:28:12,926 INFO HikariPool-1 - Start completed.

2024-03-28 01:28:13,457 INFO [MapperManager] Load Mapper(class com.alibaba.nacos.plugin.datasource.impl.mysql.ConfigInfoAggrMapperByMySql) datasource(mysql) tableName(config_info_aggr) successfully.

2024-03-28 01:28:13,457 INFO [MapperManager] Load Mapper(class com.alibaba.nacos.plugin.datasource.impl.mysql.ConfigInfoBetaMapperByMySql) datasource(mysql) tableName(config_info_beta) successfully.

2024-03-28 01:28:13,457 INFO [MapperManager] Load Mapper(class com.alibaba.nacos.plugin.datasource.impl.mysql.ConfigInfoMapperByMySql) datasource(mysql) tableName(config_info) successfully.

2024-03-28 01:28:13,457 INFO [MapperManager] Load Mapper(class com.alibaba.nacos.plugin.datasource.impl.mysql.ConfigInfoTagMapperByMySql) datasource(mysql) tableName(config_info_tag) successfully.

2024-03-28 01:28:13,458 INFO [MapperManager] Load Mapper(class com.alibaba.nacos.plugin.datasource.impl.mysql.ConfigTagsRelationMapperByMySql) datasource(mysql) tableName(config_tags_relation) successfully.

2024-03-28 01:28:13,458 INFO [MapperManager] Load Mapper(class com.alibaba.nacos.plugin.datasource.impl.mysql.HistoryConfigInfoMapperByMySql) datasource(mysql) tableName(his_config_info) successfully.

2024-03-28 01:28:13,458 INFO [MapperManager] Load Mapper(class com.alibaba.nacos.plugin.datasource.impl.mysql.TenantInfoMapperByMySql) datasource(mysql) tableName(tenant_info) successfully.

2024-03-28 01:28:13,458 INFO [MapperManager] Load Mapper(class com.alibaba.nacos.plugin.datasource.impl.mysql.TenantCapacityMapperByMySql) datasource(mysql) tableName(tenant_capacity) successfully.

2024-03-28 01:28:13,458 INFO [MapperManager] Load Mapper(class com.alibaba.nacos.plugin.datasource.impl.mysql.GroupCapacityMapperByMysql) datasource(mysql) tableName(group_capacity) successfully.

2024-03-28 01:28:13,458 INFO [MapperManager] Load Mapper(class com.alibaba.nacos.plugin.datasource.impl.derby.ConfigInfoAggrMapperByDerby) datasource(derby) tableName(config_info_aggr) successfully.

2024-03-28 01:28:13,458 INFO [MapperManager] Load Mapper(class com.alibaba.nacos.plugin.datasource.impl.derby.ConfigInfoBetaMapperByDerby) datasource(derby) tableName(config_info_beta) successfully.

2024-03-28 01:28:13,458 INFO [MapperManager] Load Mapper(class com.alibaba.nacos.plugin.datasource.impl.derby.ConfigInfoMapperByDerby) datasource(derby) tableName(config_info) successfully.

2024-03-28 01:28:13,458 INFO [MapperManager] Load Mapper(class com.alibaba.nacos.plugin.datasource.impl.derby.ConfigInfoTagMapperByDerby) datasource(derby) tableName(config_info_tag) successfully.

2024-03-28 01:28:13,458 INFO [MapperManager] Load Mapper(class com.alibaba.nacos.plugin.datasource.impl.derby.ConfigInfoTagsRelationMapperByDerby) datasource(derby) tableName(config_tags_relation) successfully.

2024-03-28 01:28:13,458 INFO [MapperManager] Load Mapper(class com.alibaba.nacos.plugin.datasource.impl.derby.HistoryConfigInfoMapperByDerby) datasource(derby) tableName(his_config_info) successfully.

2024-03-28 01:28:13,458 INFO [MapperManager] Load Mapper(class com.alibaba.nacos.plugin.datasource.impl.derby.TenantInfoMapperByDerby) datasource(derby) tableName(tenant_info) successfully.

2024-03-28 01:28:13,458 INFO [MapperManager] Load Mapper(class com.alibaba.nacos.plugin.datasource.impl.derby.TenantCapacityMapperByDerby) datasource(derby) tableName(tenant_capacity) successfully.

2024-03-28 01:28:13,458 INFO [MapperManager] Load Mapper(class com.alibaba.nacos.plugin.datasource.impl.derby.GroupCapacityMapperByDerby) datasource(derby) tableName(group_capacity) successfully.

2024-03-28 01:28:13,641 INFO Not configure type of control plugin, no limit control for current node.

2024-03-28 01:28:13,643 INFO Load connection metrics collector,size=2,[com.alibaba.nacos.config.server.service.LongPollingConnectionMetricsCollector@3a08078c, com.alibaba.nacos.core.remote.LongConnectionMetricsCollector@29f85fe1]

2024-03-28 01:28:13,643 INFO No connection rule content found ,use default empty rule

2024-03-28 01:28:13,651 INFO Fail to find connection runtime ejector for name nacos,use default

2024-03-28 01:28:13,660 INFO No tps control rule of CONFIG_PUSH_COUNT found,content =null

2024-03-28 01:28:13,660 WARN Tps point for CONFIG_PUSH_COUNT registered, But tps control manager is no limit implementation.

2024-03-28 01:28:13,660 INFO No tps control rule of CONFIG_PUSH_SUCCESS found,content =null

2024-03-28 01:28:13,660 WARN Tps point for CONFIG_PUSH_SUCCESS registered, But tps control manager is no limit implementation.

2024-03-28 01:28:13,660 INFO No tps control rule of CONFIG_PUSH_FAIL found,content =null

2024-03-28 01:28:13,660 WARN Tps point for CONFIG_PUSH_FAIL registered, But tps control manager is no limit implementation.

2024-03-28 01:28:14,653 INFO Connection check task start

2024-03-28 01:28:14,653 INFO Long connection metrics detail ,Total count =0, sdkCount=0,clusterCount=0

2024-03-28 01:28:14,654 INFO Out dated connection ,size=0

2024-03-28 01:28:14,654 INFO Connection check task end

2024-03-28 01:28:14,809 INFO ConnectionMetrics, totalCount = 0, detail = {long_connection=0, long_polling=0}

2024-03-28 01:28:15,230 INFO Ready to get current node abilities...

2024-03-28 01:28:15,233 INFO Ready to initialize current node abilities, support modes: [CLUSTER_CLIENT, SDK_CLIENT, SERVER]

2024-03-28 01:28:15,233 INFO Initialize current abilities finish...

2024-03-28 01:28:15,234 INFO Ready to get current node abilities...

2024-03-28 01:28:15,234 INFO Ready to initialize current node abilities, support modes: [SDK_CLIENT]

2024-03-28 01:28:15,234 INFO Initialize current abilities finish...

2024-03-28 01:28:15,235 INFO [AbilityControlManager] Successfully initialize AbilityControlManager

2024-03-28 01:28:17,117 INFO Will secure any request with [org.springframework.security.web.session.DisableEncodeUrlFilter@3c66b7d8, org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter@37e69c43, org.springframework.security.web.context.SecurityContextPersistenceFilter@6824b913, org.springframework.security.web.header.HeaderWriterFilter@3138953b, org.springframework.security.web.csrf.CsrfFilter@10947c4e, org.springframework.security.web.authentication.logout.LogoutFilter@3e36b7a0, org.springframework.security.web.savedrequest.RequestCacheAwareFilter@705a8dbc, org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter@40729f01, org.springframework.security.web.authentication.AnonymousAuthenticationFilter@5c7dfc05, org.springframework.security.web.session.SessionManagementFilter@f425231, org.springframework.security.web.access.ExceptionTranslationFilter@3667faa8]

2024-03-28 01:28:17,435 INFO Adding welcome page: class path resource [static/index.html]

2024-03-28 01:28:17,676 INFO Connection check task start

2024-03-28 01:28:17,676 INFO Long connection metrics detail ,Total count =0, sdkCount=0,clusterCount=0

2024-03-28 01:28:17,676 INFO Out dated connection ,size=0

2024-03-28 01:28:17,676 INFO Connection check task end

2024-03-28 01:28:17,777 INFO Exposing 1 endpoint(s) beneath base path '/actuator'

2024-03-28 01:28:17,794 WARN You are asking Spring Security to ignore Ant [pattern='/**']. This is not recommended -- please use permitAll via HttpSecurity#authorizeHttpRequests instead.

2024-03-28 01:28:17,794 INFO Will not secure Ant [pattern='/**']

2024-03-28 01:28:17,794 WARN You are asking Spring Security to ignore Mvc [pattern='/prometheus']. This is not recommended -- please use permitAll via HttpSecurity#authorizeHttpRequests instead.

2024-03-28 01:28:17,794 INFO Will not secure Mvc [pattern='/prometheus']

2024-03-28 01:28:17,794 WARN You are asking Spring Security to ignore Mvc [pattern='/prometheus/namespaceId/{namespaceId}']. This is not recommended -- please use permitAll via HttpSecurity#authorizeHttpRequests instead.

2024-03-28 01:28:17,794 INFO Will not secure Mvc [pattern='/prometheus/namespaceId/{namespaceId}']

2024-03-28 01:28:17,794 WARN You are asking Spring Security to ignore Mvc [pattern='/prometheus/namespaceId/{namespaceId}/service/{service}']. This is not recommended -- please use permitAll via HttpSecurity#authorizeHttpRequests instead.

2024-03-28 01:28:17,794 INFO Will not secure Mvc [pattern='/prometheus/namespaceId/{namespaceId}/service/{service}']

2024-03-28 01:28:17,809 INFO ConnectionMetrics, totalCount = 0, detail = {long_connection=0, long_polling=0}

2024-03-28 01:28:17,851 INFO Tomcat started on port(s): 8848 (http) with context path '/nacos'

2024-03-28 01:28:17,871 INFO No TaskScheduler/ScheduledExecutorService bean found for scheduled processing

2024-03-28 01:28:17,884 INFO No tps control rule of ConfigQuery found,content =null

2024-03-28 01:28:17,884 WARN Tps point for ConfigQuery registered, But tps control manager is no limit implementation.

2024-03-28 01:28:17,884 INFO No tps control rule of ClusterConfigChangeNotify found,content =null

2024-03-28 01:28:17,884 WARN Tps point for ClusterConfigChangeNotify registered, But tps control manager is no limit implementation.

2024-03-28 01:28:17,884 INFO No tps control rule of ConfigListen found,content =null

2024-03-28 01:28:17,884 WARN Tps point for ConfigListen registered, But tps control manager is no limit implementation.

2024-03-28 01:28:17,884 INFO No tps control rule of ConfigRemove found,content =null

2024-03-28 01:28:17,884 WARN Tps point for ConfigRemove registered, But tps control manager is no limit implementation.

2024-03-28 01:28:17,885 INFO No tps control rule of ConfigPublish found,content =null

2024-03-28 01:28:17,885 WARN Tps point for ConfigPublish registered, But tps control manager is no limit implementation.

2024-03-28 01:28:17,885 INFO No tps control rule of HealthCheck found,content =null

2024-03-28 01:28:17,885 WARN Tps point for HealthCheck registered, But tps control manager is no limit implementation.

2024-03-28 01:28:17,885 INFO No tps control rule of RemoteNamingServiceQuery found,content =null

2024-03-28 01:28:17,885 WARN Tps point for RemoteNamingServiceQuery registered, But tps control manager is no limit implementation.

2024-03-28 01:28:17,885 INFO No tps control rule of RemoteNamingInstanceBatchRegister found,content =null

2024-03-28 01:28:17,885 WARN Tps point for RemoteNamingInstanceBatchRegister registered, But tps control manager is no limit implementation.

2024-03-28 01:28:17,885 INFO No tps control rule of RemoteNamingInstanceRegisterDeregister found,content =null

2024-03-28 01:28:17,885 WARN Tps point for RemoteNamingInstanceRegisterDeregister registered, But tps control manager is no limit implementation.

2024-03-28 01:28:17,885 INFO No tps control rule of RemoteNamingServiceListQuery found,content =null

2024-03-28 01:28:17,885 WARN Tps point for RemoteNamingServiceListQuery registered, But tps control manager is no limit implementation.

2024-03-28 01:28:17,885 INFO No tps control rule of RemoteNamingServiceSubscribeUnSubscribe found,content =null

2024-03-28 01:28:17,885 WARN Tps point for RemoteNamingServiceSubscribeUnSubscribe registered, But tps control manager is no limit implementation.

2024-03-28 01:28:17,885 WARN Tps point for RemoteNamingInstanceRegisterDeregister registered, But tps control manager is no limit implementation.

2024-03-28 01:28:17,886 INFO No tps control rule of NamingInstanceMetadataUpdate found,content =null

2024-03-28 01:28:17,886 WARN Tps point for NamingInstanceMetadataUpdate registered, But tps control manager is no limit implementation.

2024-03-28 01:28:17,886 WARN Tps point for NamingInstanceMetadataUpdate registered, But tps control manager is no limit implementation.

2024-03-28 01:28:17,886 INFO No tps control rule of NamingInstanceDeregister found,content =null

2024-03-28 01:28:17,886 WARN Tps point for NamingInstanceDeregister registered, But tps control manager is no limit implementation.

2024-03-28 01:28:17,886 INFO No tps control rule of NamingInstanceRegister found,content =null

2024-03-28 01:28:17,886 WARN Tps point for NamingInstanceRegister registered, But tps control manager is no limit implementation.

2024-03-28 01:28:17,886 WARN Tps point for NamingInstanceDeregister registered, But tps control manager is no limit implementation.

2024-03-28 01:28:17,886 INFO No tps control rule of NamingServiceRegister found,content =null

2024-03-28 01:28:17,886 WARN Tps point for NamingServiceRegister registered, But tps control manager is no limit implementation.

2024-03-28 01:28:17,886 INFO No tps control rule of NamingInstanceUpdate found,content =null

2024-03-28 01:28:17,886 WARN Tps point for NamingInstanceUpdate registered, But tps control manager is no limit implementation.

2024-03-28 01:28:17,886 WARN Tps point for ConfigQuery registered, But tps control manager is no limit implementation.

2024-03-28 01:28:17,886 WARN Tps point for ConfigPublish registered, But tps control manager is no limit implementation.

2024-03-28 01:28:17,886 INFO No tps control rule of NamingServiceQuery found,content =null

2024-03-28 01:28:17,886 WARN Tps point for NamingServiceQuery registered, But tps control manager is no limit implementation.

2024-03-28 01:28:17,886 INFO No tps control rule of HttpHealthCheck found,content =null

2024-03-28 01:28:17,886 WARN Tps point for HttpHealthCheck registered, But tps control manager is no limit implementation.

2024-03-28 01:28:17,886 WARN Tps point for NamingInstanceMetadataUpdate registered, But tps control manager is no limit implementation.

2024-03-28 01:28:17,886 WARN Tps point for HttpHealthCheck registered, But tps control manager is no limit implementation.

2024-03-28 01:28:17,886 INFO No tps control rule of NamingServiceSubscribe found,content =null

2024-03-28 01:28:17,886 WARN Tps point for NamingServiceSubscribe registered, But tps control manager is no limit implementation.

2024-03-28 01:28:17,887 INFO No tps control rule of NamingInstanceQuery found,content =null

2024-03-28 01:28:17,887 WARN Tps point for NamingInstanceQuery registered, But tps control manager is no limit implementation.

2024-03-28 01:28:17,887 INFO No tps control rule of NamingServiceListQuery found,content =null

2024-03-28 01:28:17,887 WARN Tps point for NamingServiceListQuery registered, But tps control manager is no limit implementation.

2024-03-28 01:28:17,887 WARN Tps point for NamingServiceSubscribe registered, But tps control manager is no limit implementation.

2024-03-28 01:28:17,887 INFO No tps control rule of NamingServiceUpdate found,content =null

2024-03-28 01:28:17,887 WARN Tps point for NamingServiceUpdate registered, But tps control manager is no limit implementation.

2024-03-28 01:28:17,887 WARN Tps point for NamingServiceQuery registered, But tps control manager is no limit implementation.

2024-03-28 01:28:17,887 INFO No tps control rule of NamingServiceDeregister found,content =null

2024-03-28 01:28:17,887 WARN Tps point for NamingServiceDeregister registered, But tps control manager is no limit implementation.

2024-03-28 01:28:17,888 WARN Tps point for NamingServiceUpdate registered, But tps control manager is no limit implementation.

2024-03-28 01:28:17,888 WARN Tps point for NamingInstanceQuery registered, But tps control manager is no limit implementation.

2024-03-28 01:28:17,888 WARN Tps point for NamingServiceListQuery registered, But tps control manager is no limit implementation.

2024-03-28 01:28:17,888 WARN Tps point for NamingServiceDeregister registered, But tps control manager is no limit implementation.

2024-03-28 01:28:17,888 WARN Tps point for NamingInstanceMetadataUpdate registered, But tps control manager is no limit implementation.

2024-03-28 01:28:17,888 WARN Tps point for NamingInstanceRegister registered, But tps control manager is no limit implementation.

2024-03-28 01:28:17,888 WARN Tps point for NamingInstanceUpdate registered, But tps control manager is no limit implementation.

2024-03-28 01:28:17,888 WARN Tps point for NamingServiceRegister registered, But tps control manager is no limit implementation.

2024-03-28 01:28:17,891 INFO Started Nacos in 9.346 seconds (JVM running for 9.802)

2024-03-28 01:28:17,892 INFO Nacos started successfully in stand alone mode. use external storage

2024-03-28 01:28:17,896 INFO Initializing Spring DispatcherServlet 'dispatcherServlet'

2024-03-28 01:28:17,896 INFO Initializing Servlet 'dispatcherServlet'

2024-03-28 01:28:17,898 INFO Completed initialization in 2 ms

2024-03-28 01:28:17,911 INFO Get ParamCheck config from env, ParamCheckConfig{paramCheckEnabled=trueactiveParamChecker=default}

2024-03-28 01:28:17,915 INFO [AuthPluginManager] Load AuthPluginService(class com.alibaba.nacos.plugin.auth.impl.NacosAuthPluginService) AuthServiceName(nacos) successfully.

2024-03-28 01:28:17,915 INFO [AuthPluginManager] Load AuthPluginService(class com.alibaba.nacos.plugin.auth.impl.LdapAuthPluginService) AuthServiceName(ldap) successfully.

2024-03-28 01:28:20,676 INFO Connection check task start

2024-03-28 01:28:20,676 INFO Long connection metrics detail ,Total count =0, sdkCount=0,clusterCount=0

2024-03-28 01:28:20,676 INFO Out dated connection ,size=0

2024-03-28 01:28:20,676 INFO Connection check task end

2024-03-28 01:28:20,810 INFO ConnectionMetrics, totalCount = 0, detail = {long_connection=0, long_polling=0}

2024-03-28 01:28:23,359 INFO Get Push config from env, PushConfig{pushTaskDelay=500, pushTaskTimeout=5000, pushTaskRetryDelay=1000}

2024-03-28 01:28:23,676 INFO Connection check task start

2024-03-28 01:28:23,676 INFO Long connection metrics detail ,Total count =0, sdkCount=0,clusterCount=0

2024-03-28 01:28:23,676 INFO Out dated connection ,size=0

2024-03-28 01:28:23,676 INFO Connection check task end

2024-03-28 01:28:23,810 INFO ConnectionMetrics, totalCount = 0, detail = {long_connection=0, long_polling=0}

2024-03-28 01:28:23,965 INFO No tps control rule of NAMING_RPC_PUSH found,content =null

2024-03-28 01:28:23,965 WARN Tps point for NAMING_RPC_PUSH registered, But tps control manager is no limit implementation.

2024-03-28 01:28:23,965 INFO No tps control rule of NAMING_RPC_PUSH_SUCCESS found,content =null

2024-03-28 01:28:23,965 WARN Tps point for NAMING_RPC_PUSH_SUCCESS registered, But tps control manager is no limit implementation.

2024-03-28 01:28:23,965 INFO No tps control rule of NAMING_RPC_PUSH_FAIL found,content =null

2024-03-28 01:28:23,965 WARN Tps point for NAMING_RPC_PUSH_FAIL registered, But tps control manager is no limit implementation.

2024-03-28 01:28:23,965 INFO No tps control rule of NAMING_UDP_PUSH found,content =null

2024-03-28 01:28:23,965 WARN Tps point for NAMING_UDP_PUSH registered, But tps control manager is no limit implementation.

2024-03-28 01:28:23,965 INFO No tps control rule of NAMING_UDP_PUSH_SUCCESS found,content =null

2024-03-28 01:28:23,965 WARN Tps point for NAMING_UDP_PUSH_SUCCESS registered, But tps control manager is no limit implementation.

2024-03-28 01:28:23,965 INFO No tps control rule of NAMING_UDP_PUSH_FAIL found,content =null

2024-03-28 01:28:23,965 WARN Tps point for NAMING_UDP_PUSH_FAIL registered, But tps control manager is no limit implementation.

2024-03-28 01:28:23,965 INFO No tps control rule of NAMING_DISTRO_SYNC found,content =null

2024-03-28 01:28:23,965 WARN Tps point for NAMING_DISTRO_SYNC registered, But tps control manager is no limit implementation.

2024-03-28 01:28:23,965 INFO No tps control rule of NAMING_DISTRO_SYNC_SUCCESS found,content =null

2024-03-28 01:28:23,965 WARN Tps point for NAMING_DISTRO_SYNC_SUCCESS registered, But tps control manager is no limit implementation.

2024-03-28 01:28:23,965 INFO No tps control rule of NAMING_DISTRO_SYNC_FAIL found,content =null

2024-03-28 01:28:23,965 WARN Tps point for NAMING_DISTRO_SYNC_FAIL registered, But tps control manager is no limit implementation.

2024-03-28 01:28:23,965 INFO No tps control rule of NAMING_DISTRO_VERIFY found,content =null

2024-03-28 01:28:23,965 WARN Tps point for NAMING_DISTRO_VERIFY registered, But tps control manager is no limit implementation.

2024-03-28 01:28:23,965 INFO No tps control rule of NAMING_DISTRO_VERIFY_SUCCESS found,content =null

2024-03-28 01:28:23,965 WARN Tps point for NAMING_DISTRO_VERIFY_SUCCESS registered, But tps control manager is no limit implementation.

2024-03-28 01:28:23,965 INFO No tps control rule of NAMING_DISTRO_VERIFY_FAIL found,content =null

2024-03-28 01:28:23,966 WARN Tps point for NAMING_DISTRO_VERIFY_FAIL registered, But tps control manager is no limit implementation.

2024-03-28 01:28:26,677 INFO Connection check task start

2024-03-28 01:28:26,677 INFO Long connection metrics detail ,Total count =0, sdkCount=0,clusterCount=0

2024-03-28 01:28:26,677 INFO Out dated connection ,size=0

2024-03-28 01:28:26,677 INFO Connection check task end

2024-03-28 01:28:26,810 INFO ConnectionMetrics, totalCount = 0, detail = {long_connection=0, long_polling=0}

2024-03-28 01:28:27,586 INFO Get NamingClient config from env, ClientConfig{clientExpiredTime=180000}

2024-03-28 01:28:29,677 INFO Connection check task start

2024-03-28 01:28:29,678 INFO Long connection metrics detail ,Total count =0, sdkCount=0,clusterCount=0

2024-03-28 01:28:29,678 INFO Out dated connection ,size=0

2024-03-28 01:28:29,678 INFO Connection check task end

2024-03-28 01:28:29,811 INFO ConnectionMetrics, totalCount = 0, detail = {long_connection=0, long_polling=0}

2024-03-28 01:28:32,678 INFO Connection check task start

2024-03-28 01:28:32,678 INFO Long connection metrics detail ,Total count =0, sdkCount=0,clusterCount=0

2024-03-28 01:28:32,678 INFO Out dated connection ,size=0

core-auth.log
auth start, request: POST /nacos/v1/cs/configs/listener
DEBUG access denied, request: POST /nacos/v1/cs/configs/listener, reason: Invalid signature

@KomachiSion
Copy link
Collaborator

应该和版本没什么关系, 感觉是应用有问题,没有进行连接。

@habwang habwang closed this as completed Mar 29, 2024
@habwang
Copy link
Author

habwang commented Mar 29, 2024

应该和版本没什么关系, 感觉是应用有问题,没有进行连接。

从1.* 升级到2.*,从2.0.升级到2.2. 的时候是可以自动发现的;
应用配置:
build.gradle:
implementation 'com.alibaba.cloud:spring-cloud-starter-alibaba-nacos-discovery:2021.1'
implementation 'com.alibaba.cloud:spring-cloud-starter-alibaba-nacos-config:2021.1'

bootstrap.properties:
nacos.address=127.0.0.1:8848
spring.cloud.nacos.config.refresh-enabled=true
spring.cloud.nacos.config.server-addr=${nacos.address}
spring.cloud.nacos.discovery.server-addr=${nacos.address}
spring.application.name=service-test
spring.cloud.nacos.config.group=PROPERTIES_GROUP
spring.cloud.nacos.config.username=nacos
spring.cloud.nacos.config.password=nacos
spring.cloud.nacos.discovery.username=${spring.cloud.nacos.config.username}
spring.cloud.nacos.discovery.password=${spring.cloud.nacos.config.password}

新建了一个空的springboot web应用,配置如下:
bootstrap.properties

spring.application.name=demo
server.port=1234
nacos.address=192.168.51.85:8848
spring.cloud.nacos.config.refresh-enabled=true
spring.cloud.nacos.config.server-addr=${nacos.address}
spring.cloud.nacos.discovery.server-addr=${nacos.address}
spring.cloud.nacos.config.username=nacos
spring.cloud.nacos.config.password=1qazxdr5^
spring.cloud.nacos.discovery.username=${spring.cloud.nacos.config.username}
spring.cloud.nacos.discovery.password=${spring.cloud.nacos.config.password}
spring.cloud.nacos.username=${spring.cloud.nacos.config.username}
spring.cloud.nacos.password=${spring.cloud.nacos.config.password}

build.gradle
plugins {
id 'java'
id 'org.springframework.boot' version '2.6.5'
id 'io.spring.dependency-management' version '1.0.11.RELEASE'
}

group = 'com.example'
version = '0.0.1-SNAPSHOT'

java {
sourceCompatibility = '17'
}

repositories {
mavenCentral()
}

dependencies {
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.springframework.cloud:spring-cloud-starter-bootstrap:3.1.0'
implementation 'com.alibaba.cloud:spring-cloud-starter-alibaba-nacos-discovery:2021.1'
implementation 'com.alibaba.cloud:spring-cloud-starter-alibaba-nacos-config:2021.1'
}

当nacos版本在版本2.2.3和2.3.1之间升降时web应用报的错:

2024-03-29 11:50:46.733 ERROR 27364 --- [.168.51.85_8848] c.a.n.client.config.impl.ClientWorker : [fixed-192.168.51.85_8848] [check-update] get changed dataId error, code: 403
2024-03-29 11:50:46.934 ERROR 27364 --- [.168.51.85_8848] c.a.n.client.config.impl.ClientWorker : [fixed-192.168.51.85_8848] [check-update] get changed dataId error, code: 403
2024-03-29 11:50:47.138 ERROR 27364 --- [.168.51.85_8848] c.a.n.client.config.impl.ClientWorker : [fixed-192.168.51.85_8848] [check-update] get changed dataId error, code: 403
2024-03-29 11:50:47.339 ERROR 27364 --- [.168.51.85_8848] c.a.n.client.config.impl.ClientWorker : [fixed-192.168.51.85_8848] [check-update] get changed dataId error, code: 403
2024-03-29 11:50:47.534 ERROR 27364 --- [.168.51.85_8848] c.a.n.client.config.impl.ClientWorker : [fixed-192.168.51.85_8848] [check-update] get changed dataId error, code: 403
2024-03-29 11:50:47.549 ERROR 27364 --- [ing.beat.sender] com.alibaba.nacos.client.naming : [NA] failed to request

com.alibaba.nacos.api.exception.NacosException:

Whitelabel Error Page

This application has no explicit mapping for /error, so you are seeing this as a fallback.

Fri Mar 29 03:50:47 UTC 2024
There was an unexpected error (type=Forbidden, status=403).
Invalid signature

at com.alibaba.nacos.client.naming.net.NamingProxy.callServer(NamingProxy.java:615) ~[nacos-client-1.4.1.jar:na]
at com.alibaba.nacos.client.naming.net.NamingProxy.reqApi(NamingProxy.java:526) ~[nacos-client-1.4.1.jar:na]
at com.alibaba.nacos.client.naming.net.NamingProxy.reqApi(NamingProxy.java:498) ~[nacos-client-1.4.1.jar:na]
at com.alibaba.nacos.client.naming.net.NamingProxy.sendBeat(NamingProxy.java:433) ~[nacos-client-1.4.1.jar:na]
at com.alibaba.nacos.client.naming.beat.BeatReactor$BeatTask.run(BeatReactor.java:167) ~[nacos-client-1.4.1.jar:na]
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539) ~[na:na]
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) ~[na:na]
at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:304) ~[na:na]
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) ~[na:na]
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) ~[na:na]
at java.base/java.lang.Thread.run(Thread.java:842) ~[na:na]

2024-03-29 11:50:47.554 ERROR 27364 --- [ing.beat.sender] com.alibaba.nacos.client.naming : [NA] failed to request

com.alibaba.nacos.api.exception.NacosException:

Whitelabel Error Page

This application has no explicit mapping for /error, so you are seeing this as a fallback.

Fri Mar 29 03:50:47 UTC 2024
There was an unexpected error (type=Forbidden, status=403).
Invalid signature

at com.alibaba.nacos.client.naming.net.NamingProxy.callServer(NamingProxy.java:615) ~[nacos-client-1.4.1.jar:na]
at com.alibaba.nacos.client.naming.net.NamingProxy.reqApi(NamingProxy.java:526) ~[nacos-client-1.4.1.jar:na]
at com.alibaba.nacos.client.naming.net.NamingProxy.reqApi(NamingProxy.java:498) ~[nacos-client-1.4.1.jar:na]
at com.alibaba.nacos.client.naming.net.NamingProxy.sendBeat(NamingProxy.java:433) ~[nacos-client-1.4.1.jar:na]
at com.alibaba.nacos.client.naming.beat.BeatReactor$BeatTask.run(BeatReactor.java:167) ~[nacos-client-1.4.1.jar:na]
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539) ~[na:na]
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) ~[na:na]
at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:304) ~[na:na]
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) ~[na:na]
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) ~[na:na]
at java.base/java.lang.Thread.run(Thread.java:842) ~[na:na]

2024-03-29 11:50:47.561 ERROR 27364 --- [ing.beat.sender] com.alibaba.nacos.client.naming : [NA] failed to request

com.alibaba.nacos.api.exception.NacosException:

Whitelabel Error Page

This application has no explicit mapping for /error, so you are seeing this as a fallback.

Fri Mar 29 03:50:47 UTC 2024
There was an unexpected error (type=Forbidden, status=403).
Invalid signature

at com.alibaba.nacos.client.naming.net.NamingProxy.callServer(NamingProxy.java:615) ~[nacos-client-1.4.1.jar:na]
at com.alibaba.nacos.client.naming.net.NamingProxy.reqApi(NamingProxy.java:526) ~[nacos-client-1.4.1.jar:na]
at com.alibaba.nacos.client.naming.net.NamingProxy.reqApi(NamingProxy.java:498) ~[nacos-client-1.4.1.jar:na]
at com.alibaba.nacos.client.naming.net.NamingProxy.sendBeat(NamingProxy.java:433) ~[nacos-client-1.4.1.jar:na]
at com.alibaba.nacos.client.naming.beat.BeatReactor$BeatTask.run(BeatReactor.java:167) ~[nacos-client-1.4.1.jar:na]
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539) ~[na:na]
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) ~[na:na]
at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:304) ~[na:na]
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) ~[na:na]
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) ~[na:na]
at java.base/java.lang.Thread.run(Thread.java:842) ~[na:na]

2024-03-29 11:50:47.561 ERROR 27364 --- [ing.beat.sender] com.alibaba.nacos.client.naming : request: /nacos/v1/ns/instance/beat failed, servers: [192.168.51.85:8848], code: 500, msg:

Whitelabel Error Page

This application has no explicit mapping for /error, so you are seeing this as a fallback.

Fri Mar 29 03:50:47 UTC 2024
There was an unexpected error (type=Forbidden, status=403).
Invalid signature

2024-03-29 11:50:47.561 ERROR 27364 --- [ing.beat.sender] com.alibaba.nacos.client.naming : [CLIENT-BEAT] failed to send beat: {"port":1234,"ip":"192.168.3.15","weight":1.0,"serviceName":"DEFAULT_GROUP@@demo","cluster":"DEFAULT","metadata":{"preserved.register.source":"SPRING_CLOUD"},"scheduled":false,"period":5000,"stopped":false}, code: 500, msg: failed to req API:/nacos/v1/ns/instance/beat after all servers([192.168.51.85:8848]) tried: ErrCode:403, ErrMsg:

Whitelabel Error Page

This application has no explicit mapping for /error, so you are seeing this as a fallback.

Fri Mar 29 03:50:47 UTC 2024
There was an unexpected error (type=Forbidden, status=403).
Invalid signature

@habwang habwang reopened this Mar 29, 2024
@KomachiSion
Copy link
Collaborator

看报错是鉴权失败,Invalid signature, 我看了下应该是默认鉴权插件校验的请求中的token中有一部分内容和server中预期的token不对应,所以报错了。

@habwang
Copy link
Author

habwang commented Apr 2, 2024

看报错是鉴权失败,Invalid signature, 我看了下应该是默认鉴权插件校验的请求中的token中有一部分内容和server中预期的token不对应,所以报错了。

应该是的。服务重启或者token过期就正常了,但这个时间有点长,对于生产环境的服务影响很大。低于2.3.0的版本间切换没有问题,2.3.* 和1.* 、2.1.*、2.2.*的切换貌似都有问题。

@KomachiSion
Copy link
Collaborator

可以研究一下这部分token校验和生成是否有改动过逻辑, 鉴权插件社区中会因为优化和安全问题经常更新或添加新优化, 可能老版本没有校验token的这部分内容或者校验方式错误导致旧版本可以复用旧的错误token。

也可能是新版本改动导致了token校验错误。

@habwang
Copy link
Author

habwang commented Apr 10, 2024

可以研究一下这部分token校验和生成是否有改动过逻辑, 鉴权插件社区中会因为优化和安全问题经常更新或添加新优化, 可能老版本没有校验token的这部分内容或者校验方式错误导致旧版本可以复用旧的错误token。

也可能是新版本改动导致了token校验错误。

此处不一致
V2 3 1
V2 2 3
报错的应该是这个地方
QQ截图20240410101807

@KomachiSion
Copy link
Collaborator

是说新版本和旧版本的base64计算方式不同吗?

@habwang
Copy link
Author

habwang commented Apr 12, 2024

代码上看,accessToken模块不一致的确实是那行。

@KomachiSion
Copy link
Collaborator

代码不一致没关系, 主要是行为一致就可以, 需要帮忙确认下这里是否是base64计算结果不一致导致的。

@cold-l
Copy link

cold-l commented Apr 29, 2024

比较版本

nacos 2.2.3,nacos 2.3.2

2.0.* 并不是使用的的插件机制,所以就没有深入研究。如果不是这个原因,大家再一起讨论下。

问题描述

base64 decode 不一致

secrectKey 使用 SecretKey012345678901234567890123456789012345678901234567890123456789

版本 bitLength SignAlgorithm 方法
2.2.3 552 NacosSignatureAlgorithm.HS512 com.alibaba.nacos.plugin.auth.impl.jwt.NacosJwtParser#NacosJwtParser
2.3.2 408 NacosSignatureAlgorithm.HS384 com.alibaba.nacos.plugin.auth.impl.jwt.NacosJwtParser#NacosJwtParser

secrectKey 使用 VGhpc0lzTXlDdXN0b21TZWNyZXRLZXkwMTIzNDU2Nzg=

版本 bitLength SignAlgorithm 方法
2.2.3 256 NacosSignatureAlgorithm.HS256 com.alibaba.nacos.plugin.auth.impl.jwt.NacosJwtParser#NacosJwtParser
2.3.2 256 NacosSignatureAlgorithm.HS256 com.alibaba.nacos.plugin.auth.impl.jwt.NacosJwtParser#NacosJwtParser

导致不一致的关键代码:com.alibaba.nacos.plugin.auth.impl.jwt.NacosJwtParser#NacosJwtParser

// 2.2.3
      try {
          decode = Base64.getDecoder().decode(base64edKey);
      } catch (IllegalArgumentException e) {
          decode = base64edKey.getBytes(StandardCharsets.US_ASCII);
      }
// 2.3.2
    byte[] decode = Base64Decode.decode(base64edKey);

结论

在使用 Base64.getDecoder().decode(base64edKey) 时,使用不同的key时会出现两种情况

  1. 当 SecretKey 为不严格的base64编码时,此时代码出现异常 base64 Last unit does not have enough valid bits,被try catch捕获,进而导致decode的值采用的非base64解码,导致bitLength 与 2.3.2版本中的 Base64Decode.decode(base64edKey) 得到的值不一致。

  2. 当SecretKey采用的是base64编码字串时,两个版本最终一致,不会出现问题

  3. 我发现当实例化NacosJwtParser时,假如字串不是严格的base64编码时,此时是建议用户尽量采用标准的编码字串。由于NacosJwtParser decode 时已经catch过异常,所以这个提示严格来说是不会再抛出异常提示了。

    image-20240429222111777

  4. 所以Nacos 较新的版本中,其实还是推荐咱们采用标准的base64编码字串,不要再使用一些非法字串了,适得其反,升级都会有问题,大家请按照推荐使用,且行且珍惜啊。

@KomachiSion
Copy link
Collaborator

#10930 issue 中改动引入的,看起来是为了兼容旧版本的情况

@cold-l
Copy link

cold-l commented May 6, 2024

#10930 issue 中改动引入的,看起来是为了兼容旧版本的情况

所以这个是维持现状吗,毕竟只要不是使用了非base64编码的,理论上升级也不会有问题哈。

@KomachiSion
Copy link
Collaborator

#10930 issue 中改动引入的,看起来是为了兼容旧版本的情况

所以这个是维持现状吗,毕竟只要不是使用了非base64编码的,理论上升级也不会有问题哈。

可以想想办法把提示优化打印的好一点。 并且在文档上说明一下。

@cold-l
Copy link

cold-l commented May 11, 2024

#10930 issue 中改动引入的,看起来是为了兼容旧版本的情况

所以这个是维持现状吗,毕竟只要不是使用了非base64编码的,理论上升级也不会有问题哈。

可以想想办法把提示优化打印的好一点。 并且在文档上说明一下。

我的想法是,在 Base64Decode.decode(base64edKey) 之前增加一步 secrectKey % 4 == 0 的校验,如果secrectKey无法被4整除,打印warn级别的日志即可,主要提示为:The secrectKey currently in use is not a standard Base64 encoding and will no longer be supported in future versions;

这样的话,既不会影响 #10930 中的兼容,也可以有一个提示的作用,查看警告日志即可

如果觉得这样可行的话,可以将这个指派给我吗,完成之后,文档部分在升级那边,我会再补充一下升级的注意事项。

@KomachiSion
Copy link
Collaborator

#10930 issue 中改动引入的,看起来是为了兼容旧版本的情况

所以这个是维持现状吗,毕竟只要不是使用了非base64编码的,理论上升级也不会有问题哈。

可以想想办法把提示优化打印的好一点。 并且在文档上说明一下。

我的想法是,在 Base64Decode.decode(base64edKey) 之前增加一步 secrectKey % 4 == 0 的校验,如果secrectKey无法被4整除,打印warn级别的日志即可,主要提示为:The secrectKey currently in use is not a standard Base64 encoding and will no longer be supported in future versions;

这样的话,既不会影响 #10930 中的兼容,也可以有一个提示的作用,查看警告日志即可

如果觉得这样可行的话,可以将这个指派给我吗,完成之后,文档部分在升级那边,我会再补充一下升级的注意事项。

secrectKey % 4 == 0 这个方案能够解决这个问题吗?
原理是什么?

@cold-l
Copy link

cold-l commented May 24, 2024

#10930 issue 中改动引入的,看起来是为了兼容旧版本的情况

所以这个是维持现状吗,毕竟只要不是使用了非base64编码的,理论上升级也不会有问题哈。

可以想想办法把提示优化打印的好一点。 并且在文档上说明一下。

我的想法是,在 Base64Decode.decode(base64edKey) 之前增加一步 secrectKey % 4 == 0 的校验,如果secrectKey无法被4整除,打印warn级别的日志即可,主要提示为:The secrectKey currently in use is not a standard Base64 encoding and will no longer be supported in future versions;
这样的话,既不会影响 #10930 中的兼容,也可以有一个提示的作用,查看警告日志即可
如果觉得这样可行的话,可以将这个指派给我吗,完成之后,文档部分在升级那边,我会再补充一下升级的注意事项。

secrectKey % 4 == 0 这个方案能够解决这个问题吗? 原理是什么?

旧版本中在 字符串长度不为4的倍数时,使用 Base64.getDecoder().decode(base64edKey) 会抛出异常,进而导致直接会使用的字符串的二进制数组。
新的版本采用的自己实现的base64解析方式,我的理解是抛弃了‘解析为数组’的方式,因为解析为数组,本质上是在报错时候的兼容处理。

所以采用最小的改动范围应当是:提示用户不能使用非标准的编码字串,并提示会导致的一些问题。这样应该是比较合理的。文档中应当注明,采用的不合理的编码方式本身也会导致版本升级的问题。

@KomachiSion
Copy link
Collaborator

#10930 issue 中改动引入的,看起来是为了兼容旧版本的情况

所以这个是维持现状吗,毕竟只要不是使用了非base64编码的,理论上升级也不会有问题哈。

可以想想办法把提示优化打印的好一点。 并且在文档上说明一下。

我的想法是,在 Base64Decode.decode(base64edKey) 之前增加一步 secrectKey % 4 == 0 的校验,如果secrectKey无法被4整除,打印warn级别的日志即可,主要提示为:The secrectKey currently in use is not a standard Base64 encoding and will no longer be supported in future versions;
这样的话,既不会影响 #10930 中的兼容,也可以有一个提示的作用,查看警告日志即可
如果觉得这样可行的话,可以将这个指派给我吗,完成之后,文档部分在升级那边,我会再补充一下升级的注意事项。

secrectKey % 4 == 0 这个方案能够解决这个问题吗? 原理是什么?

旧版本中在 字符串长度不为4的倍数时,使用 Base64.getDecoder().decode(base64edKey) 会抛出异常,进而导致直接会使用的字符串的二进制数组。 新的版本采用的自己实现的base64解析方式,我的理解是抛弃了‘解析为数组’的方式,因为解析为数组,本质上是在报错时候的兼容处理。

所以采用最小的改动范围应当是:提示用户不能使用非标准的编码字串,并提示会导致的一些问题。这样应该是比较合理的。文档中应当注明,采用的不合理的编码方式本身也会导致版本升级的问题。

同意在文档中注明,用的不合理的编码方式本身也会导致版本升级的问题。

不过如果添加了,secrectKey % 4 == 0 这个方案能够解决这个问题吗? 如果能够兼容的话, 可以暂时先兼容上,然后给出明确提示。

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

4 participants