Skip to content

Fix active health check target address validation - #15712

Merged
KomachiSion merged 1 commit into
alibaba:developfrom
KomachiSion:codex/fix-active-health-check-address
Aug 14, 2026
Merged

KomachiSion merged 1 commit into
alibaba:developfrom
KomachiSion:codex/fix-active-health-check-address

Conversation

@KomachiSion

Copy link
Copy Markdown
Collaborator

What is the purpose of the change

Active health check processors construct network targets from the registered instance address. The address should remain a plain host and must not introduce additional URL components into processor-specific connection strings.

This change validates active health check targets before processor dispatch. Invalid targets are treated as failed checks without invoking the concrete processor. It also separates the MySQL JDBC URL from connection properties and explicitly disables local-file and multi-query capabilities.

Brief changelog

  • Validate active health check instance addresses centrally before processor dispatch.
  • Treat invalid addresses as failed checks without issuing a network request.
  • Pass MySQL connection options through Properties while keeping the JDBC URL limited to host and port.
  • Document the plain-host requirement in the English and Chinese naming health-check specifications.
  • Add unit coverage for valid/invalid addresses, delegate dispatch, and MySQL connection construction.

Verifying this change

  • mvn -B clean compile apache-rat:check checkstyle:check spotbugs:check spotless:check -e -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn
    • All 62 reactor modules passed.
  • mvn -pl naming -Dtest=HealthCheckAddressValidatorTest,HealthCheckProcessorV2DelegateTest,MysqlHealthCheckProcessorTest test
    • 29 tests passed.
  • Started Nacos in cluster mode with embedded storage and configured an HTTP active health check.
    • A valid target continued receiving successful health-check requests and remained healthy.
    • A target containing additional URL components was marked unhealthy with an invalid-address log entry, while an independent capture server received no request.

Follow this checklist to help us incorporate your contribution quickly and easily:

  • Make sure there is a Github issue filed for the change (usually before you start working on it). Trivial changes like typos do not require a Github issue. Your pull request should address just this issue, without pulling in other changes - one PR resolves one issue. No public GitHub issue is linked for this defensive hardening.
  • Format the pull request title like [ISSUE #123] Fix UnknownException when host config not exist. Each commit in the pull request should have a meaningful subject line and body. This PR has no public issue number.
  • Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
  • Write necessary unit-test to verify your logic correction, more mock a little better when cross module dependency exist. If the new feature or significant change is committed, please remember to add integration-test in test module.
  • Run mvn -B clean package apache-rat:check spotbugs:check -DskipTests to make sure basic checks pass. Run mvn clean install to make sure unit-test pass. Run mvn clean test-compile failsafe:integration-test to make sure integration-test pass. The current GitHub CI equivalent check and affected unit tests passed as listed above.

Validate active health check hosts before processor dispatch and isolate MySQL JDBC properties from target construction.

Assisted-by: OpenAI Codex
@github-actions

Copy link
Copy Markdown

Thanks for your this PR. 🙏
Please check again for your PR changes whether contains any usage/api/configuration change such as Add new API , Add new configuration, Change default value of configuration.
If so, please add or update documents(markdown type) in docs/next/ for repository nacos-group/nacos-group.github.io


感谢您提交的PR。 🙏
请再次查看您的PR内容,确认是否包含任何使用方式/API/配置参数的变更,如:新增API、新增配置参数、修改默认配置等操作。
如果是,请确保在提交之前,在仓库nacos-group/nacos-group.github.io中的docs/next/目录下添加或更新文档(markdown格式)。

@KomachiSion KomachiSion added kind/enhancement Category issues or prs related to enhancement. area/Naming labels Aug 14, 2026
@KomachiSion KomachiSion added this to the 3.2.4 milestone Aug 14, 2026
@KomachiSion
KomachiSion merged commit 9890c67 into alibaba:develop Aug 14, 2026
8 checks passed
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 84.31373% with 8 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
...heck/v2/processor/HealthCheckAddressValidator.java 77.77% 0 Missing and 6 partials ⚠️
...hcheck/v2/processor/MysqlHealthCheckProcessor.java 86.66% 2 Missing ⚠️

📢 Thoughts on this report? Let us know!

@KomachiSion
KomachiSion deleted the codex/fix-active-health-check-address branch August 14, 2026 06:25
KomachiSion added a commit that referenced this pull request Aug 14, 2026
Validate active health check hosts before processor dispatch and isolate MySQL JDBC properties from target construction.

Assisted-by: OpenAI Codex
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/Naming kind/enhancement Category issues or prs related to enhancement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants