fix(server): configure finite DNS cache TTL - #3126
Conversation
Load networkaddress.cache.ttl from a Java security properties file when the HugeGraph security manager is enabled. Add distribution-level coverage for property semantics, startup wiring, disabled mode, and operator overrides. Fixes apache#3124
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #3126 +/- ##
============================================
- Coverage 39.19% 36.04% -3.15%
- Complexity 264 424 +160
============================================
Files 770 770
Lines 65779 65779
Branches 8726 8726
============================================
- Hits 25779 23710 -2069
- Misses 37247 39424 +2177
+ Partials 2753 2645 -108 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
imbajin
left a comment
There was a problem hiding this comment.
Blocking: yes. Summary: The DNS TTL policy can silently disappear with a retained configuration directory, and its regression test can be skipped by unrelated startup prerequisites. Evidence: exact-head static review, a controlled missing-security-properties reproduction, workflow/log inspection, and git diff --check; codecov/project is failing.
There was a problem hiding this comment.
🟢 Ready to approve
The changes are narrowly scoped to Server startup wiring, include a packaged configuration, and add CI coverage validating both the security property value and argument ordering/overrides.
This review doesn't count toward merge requirements. Sign up for the private preview to control whether Copilot approvals count.
Pull request overview
This PR addresses stale JVM DNS caching when HugeGraph Server runs with HugeSecurityManager enabled (Java 11 behavior), which can prevent HStore writes from recovering after a Kubernetes Store pod is replaced behind the same DNS name.
Changes:
- Add a packaged security properties file setting
networkaddress.cache.ttl=30. - Wire the file into Server startup via
-Djava.security.properties=...only whenHugeSecurityManageris enabled. - Add a dedicated CI startup-time verification script and run it in Server CI before existing startup tests.
File summaries
| File | Description |
|---|---|
| hugegraph-server/hugegraph-dist/src/assembly/travis/test-java-security-properties.sh | Adds a focused runtime + launcher-argument test to verify the security property value and startup wiring behavior. |
| hugegraph-server/hugegraph-dist/src/assembly/static/conf/java-security.properties | Introduces the packaged security properties file that sets a finite positive DNS cache TTL. |
| hugegraph-server/hugegraph-dist/src/assembly/static/bin/hugegraph-server.sh | When security is enabled, adds -Djava.security.properties=... alongside HugeSecurityManager to ensure finite DNS caching. |
| .github/workflows/server-ci.yml | Runs the new security-properties verification script as part of the existing Server dist startup test step. |
Review details
- Files reviewed: 3/4 changed files
- Comments generated: 0
- Review effort level: Low
We're testing this review assessment. Please use 👍 or 👎 to tell us if it's correct.
Purpose of the PR
HugeGraph Server enables
HugeSecurityManagerby default. On Java 11, thatmakes successful DNS resolutions remain cached for the JVM lifetime unless a
finite positive cache policy is configured. After a Kubernetes Store pod is
replaced behind the same stable DNS name, HStore writes can therefore continue
using the old pod IP until the Server process is restarted.
Main Changes
networkaddress.cache.ttl=30.java.security.propertiesonly whenHugeSecurityManageris enabled.later operator override is non-empty.
options, including an explicit security-properties override.
step.
The ordinary
-Dnetworkaddress.cache.ttlsystem-property form is deliberatelynot used because Java 11 reads this setting as a security property.
Verifying these changes
hugegraph-dist: passed.Does this PR potentially affect the following parts?
Documentation Status
Doc - TODODoc - DoneDoc - No NeedOut of scope