Repository navigation
Conversation
DanielLeens
left a comment
There was a problem hiding this comment.
What Problem Does This PR Solve?
AbstractSeaTunnelServerTest configures the Hazelcast test node with port-count: 100 (the node is allowed to auto-increment across 100 ports while binding) but only hazelcast.tcp.join.port.try.count: 30 (the TCP-IP joiner only scans 30 ports when trying to discover cluster members, including itself). When TestUtils.getAvailablePort(100) lands the actual bound port more than 30 slots away from the configured base port, Hazelcast's joiner can't find the node's own address, and the node throws IllegalStateException: Node failed to start! — a source of CI flakiness (e.g. CheckpointTimeOutTest). The PR raises hazelcast.tcp.join.port.try.count from 30 to 100 in this one test class so the join-scan window covers the full bind range.
1. Code Change Review
1.1 Core Logic Analysis
Before:
port-count: 100
...
hazelcast.tcp.join.port.try.count: 30After:
port-count: 100
...
hazelcast.tcp.join.port.try.count: 100Runtime path: AbstractSeaTunnelServerTest.before() → Config.loadFromString(getHazelcastConfig()) → SeaTunnelServerStarter.createHazelcastInstance(...) → Hazelcast's TcpIpJoiner scans port .. port + try.count - 1 on localhost to discover members (including itself, since member-list only contains localhost). The fix is directionally correct: try.count must be >= port-count for the joiner to be able to see every port the node could possibly have bound to via auto-increment. Setting it equal to port-count (100 = 100) is the tightest correct value — not oversized.
1.2 Compatibility Impact
None. The change is confined to an inline YAML string inside a src/test/java test base class; it does not touch seatunnel-engine-common/src/main/resources/hazelcast.yaml (the shipped default config) or any Option definition. No user-facing config, default value, or SPI contract is affected. Backward compatible.
1.3 Performance/Side-Effects
Raising the join-port-try-count from 30 to 100 only bounds the maximum number of ports the TCP-IP joiner will probe on localhost during test-node startup; it does not force 100 attempts on every run — probing stops once the node finds itself/peers. Worst-case startup latency increase is small and confined to the test JVM. Not a concern for this change in isolation (see Issue 3 for the untested-invariant risk).
1.4 Error Handling/Logging
Issue 1: The identical port-count/join.port.try.count mismatch this PR fixes still exists in the shipped production default config, unaddressed
- Location:
seatunnel-engine/seatunnel-engine-common/src/main/resources/hazelcast.yaml:35(port-count: 100) and:39(hazelcast.tcp.join.port.try.count: 30) - Problem: This is the actual default config packaged and shipped to real Zeta deployments (loaded via
ConfigProviderwhen no override is supplied), not a test fixture. It has the exact sameport-count: 100/try.count: 30inconsistency this PR's own description identifies as the root cause of "Node failed to start!" — the fix is applied only to the test copy. - Potential risk: Any real cluster node that relies on
port.auto-incrementand happens to bind more than 30 ports away from the configured baseport(e.g. under port contention in containerized/k8s multi-node deployments, which severaldocs/en/getting-started/kubernetes/*.mdexamples target) can hit the same join failure in production, not just in CI. - Best improvement: Apply the same alignment (
hazelcast.tcp.join.port.try.count: 100) toseatunnel-engine-common/src/main/resources/hazelcast.yaml, or explicitly document why the production default is exempt from the invariant this PR asserts. - Severity: High
- Raised by another reviewer: No
Issue 2: Four other test classes carry the exact same pre-fix mismatch and were left untouched
- Location:
seatunnel-engine-server/src/test/java/.../resourcemanager/WorkerTagTest.java:67,74,.../rest/OptionRulesApiTest.java:167,174,.../rest/RestApiSubmitJobStartWithSavePointTest.java:527,534,.../rest/RestApiSubmitJobConfigShadeDecryptTest.java:375,382— all useport-count: 100withhazelcast.tcp.join.port.try.count: 30 - Problem: These classes instantiate Hazelcast test nodes the same way as
AbstractSeaTunnelServerTestdid before this fix, with an identical inline config block. - Potential risk: The PR's stated goal ("reduces CI instability caused by the mismatch") is only partially achieved — the same latent
Node failed to start!flake remains reachable through these four classes. - Best improvement: Extend the fix to all four files (or better, factor the shared join-port-try-count constant so it can't drift from
port-countagain — see Issue 4). - Severity: Medium
- Raised by another reviewer: No
Issue 3: Documented example configs still show the inconsistent pairing
- Location:
docs/en/engines/zeta/resource-isolation.md:34,docs/en/engines/zeta/rest-api-v1.md:34(and zh equivalents) pairport-count: 100withhazelcast.tcp.join.port.try.count: 30 - Problem: Users copying these documented examples inherit the same mismatch this PR treats as a bug.
- Potential risk: Low — these are illustrative snippets, not necessarily copy-pasted verbatim, but they contradict the invariant this PR just established.
- Best improvement: Update docs alongside Issue 1 if the production default is corrected.
- Severity: Low
- Raised by another reviewer: No
2. Code Quality Assessment
2.1 Coding Standards
The change is a single-line value edit inside an existing inline YAML string; formatting and style are consistent with the surrounding file. No standards violation.
2.2 Test Coverage/Stability
Issue 4: No test asserts the try.count >= port-count invariant; the magic-number edit itself is unguarded
- Location:
AbstractSeaTunnelServerTest.java:99 - Problem: The fix corrects a value but adds no assertion or shared constant enforcing that
hazelcast.tcp.join.port.try.countmust be>= port-count. Git history onseatunnel-engine-common/src/main/resources/hazelcast.yamlshows this exact property has already flip-flopped between100and30more than once historically, which is consistent with how easily it can silently regress without a guarding test. - Potential risk: A future edit to either
port-countortry.countin isolation (in this file or the other four listed in Issue 2) can silently reintroduce the same CI flake. - Best improvement: Extract both values into named constants in one place (or a small unit/assertion in test setup) that fails fast if
try.count < port-count, rather than relying on manually keeping two independent literals in sync across five test files and the production yaml. - Severity: Medium
- Raised by another reviewer: No
Stable/Risk rating: Risk present — the change itself is a safe, backward-compatible test-only fix, but it is an incomplete instance of a broader unguarded invariant (Issues 1, 2, 4), so residual flake/production risk remains from the untouched copies.
2.3 Docs
Not updated; see Issue 3. No incompatible-changes.md entry needed since there is no user-facing behavior change from this PR as scoped.
3. Architectural Soundness
The PR treats the symptom (one flaky test class) rather than the root cause (an unguarded coupling between port-count and hazelcast.tcp.join.port.try.count that is duplicated as literal YAML across at least six locations — one production default, five test classes — and drifts independently). The most architecturally sound fix would centralize this relationship (e.g., derive try.count from port-count, or a shared test config builder) rather than hand-editing one of six copies. Given the PR is intentionally minimal and test-scoped, that refactor is reasonably deferred, but the production-default instance of the same bug (Issue 1) should not be — it directly contradicts the PR's own stated defect description.
4. Issue Summary
| # | Title | Location | Severity | Raised by another reviewer |
|---|---|---|---|---|
| 1 | Production default hazelcast.yaml has the identical unfixed mismatch | seatunnel-engine-common/src/main/resources/hazelcast.yaml:35,39 | High | No |
| 2 | Four other test classes carry the same unfixed mismatch | WorkerTagTest.java, OptionRulesApiTest.java, RestApiSubmitJobStartWithSavePointTest.java, RestApiSubmitJobConfigShadeDecryptTest.java | Medium | No |
| 3 | Documented example configs still pair port-count:100 with try.count:30 | docs/en(zh)/engines/zeta/resource-isolation.md, rest-api-v1.md | Low | No |
| 4 | No test/constant guards the try.count >= port-count invariant | AbstractSeaTunnelServerTest.java:99 | Medium | No |
5. Merge Recommendation
实施与计划部分匹配 / Changes Requested
The one-line fix in AbstractSeaTunnelServerTest.java is correct and safe as far as it goes, but it is an incomplete fix for the bug class it describes: the identical mismatch remains live in the actual shipped production default (seatunnel-engine-common/src/main/resources/hazelcast.yaml), in four other test classes, and in the docs — none of which this PR's description or diff acknowledges.
Blockers
- Issue 1: shipped production default (
hazelcast.yaml) still hasport-count: 100/try.count: 30, the same pattern the PR calls a bug.
Recommended fixes (non-blocking but strongly requested before merge)
- Issue 2: align the four other test classes with the same
try.count. - Issue 4: guard the invariant with a shared constant or assertion so it can't silently regress again (git history shows it already has).
- Issue 3: update the two docs pages once the production default is corrected.
CI: Build check was still pending/in progress at review time; branch is 1 ahead / 12 behind dev (diverged, not yet rebased). Please rebase onto latest dev and ensure CI is green in addition to addressing Issue 1 before merge.
DanielLeens
left a comment
There was a problem hiding this comment.
Re-reviewing the current head (c8b8cee4) from scratch, since a substantial new commit landed after my last review. Good progress: both my previous blockers are now addressed, and the new commit goes further than I asked, adding a self-consistency guard. However, I pulled the fork's actual CI log for this head rather than trusting the green/red summary, and found a real, currently-failing Windows unit-test run that hits the exact symptom this PR claims to fix, in the exact class this PR modified — details below, this needs to be resolved or explained before merge.
What Problem Does This PR Solve?
AbstractSeaTunnelServerTest configures the Hazelcast test node with port-count: 100 (auto-increment across 100 ports while binding) but only hazelcast.tcp.join.port.try.count: 30 (the TCP-IP joiner only scans 30 ports to discover cluster members, including itself). When the bound port lands more than 30 slots from the base port, the joiner can't find its own address and the node throws IllegalStateException: Node failed to start! — a CI-flakiness source. The PR raises try.count to match port-count everywhere this pairing exists.
1. Code Change Review
1.1 Core Logic Analysis
What changed since my last review (2 commits, 9 files, +33/-13):
c8b8cee47 [Fix][Zeta] Align Hazelcast join port try count with bind range
on top of the previously-reviewed e6944d7b7. Full diff re-read against dev, not just the delta:
- Issue 1 (was High, blocking) — RESOLVED. The shipped production default,
seatunnel-engine-common/src/main/resources/hazelcast.yaml:39, is nowhazelcast.tcp.join.port.try.count: 100(was30), matchingport-count: 100at line 35. This was the actual config packaged to real Zeta deployments, not a test fixture, and it now carries the same fix the PR's own description identifies as necessary. - Issue 2 (was Medium) — RESOLVED. All four sibling test classes I flagged as carrying the identical unfixed mismatch are now aligned:
WorkerTagTest.java:74,OptionRulesApiTest.java:174,RestApiSubmitJobStartWithSavePointTest.java:534,RestApiSubmitJobConfigShadeDecryptTest.java:382all changed30→100. - Bonus fixes beyond what I flagged:
seatunnel-engine-client/src/test/resources/hazelcast.yamlhadport-count: 10/try.count: 30(over-provisioned, not under — tightened to10/10, still correct and no longer wasteful).seatunnel-engine-common/src/test/resources/hazelcast.yamlandseatunnel-engine-server/src/test/resources/hazelcast.yamlhadport-count: 100with nohazelcast.tcp.join.port.try.countproperty at all — meaning they silently fell back to Hazelcast's internal default of3, an even worse mismatch than the30I originally flagged. Both now explicitly settry.count: 100. I verified these are correct fixes, not new problems. - Issue 4 (was Medium, "no guard against regression") — Partially resolved.
AbstractSeaTunnelServerTest.javanow has:This is a real, correctly-placed guard (fires atprivate static final int HAZELCAST_PORT_COUNT = 100; private static final int HAZELCAST_TCP_JOIN_PORT_TRY_COUNT = HAZELCAST_PORT_COUNT; ... protected String getHazelcastConfig() { assertHazelcastJoinPortTryCount(HAZELCAST_PORT_COUNT, HAZELCAST_TCP_JOIN_PORT_TRY_COUNT); ... } public static void assertHazelcastJoinPortTryCount(int portCount, int joinPortTryCount) { if (joinPortTryCount < portCount) { throw new IllegalArgumentException(...); } }
@BeforeAllbefore the Hazelcast config string is even built) that will catch a future accidental edit to either constant in this class. However, I checked whether it actually protects the four sibling classes fixed in Issue 2 — it does not:WorkerTagTest,OptionRulesApiTest,RestApiSubmitJobStartWithSavePointTest, andRestApiSubmitJobConfigShadeDecryptTestall@Override protected String getHazelcastConfig()with their own fully independent hard-coded YAML string (verified inWorkerTagTest.java:47-83) and never callsuper.getHazelcastConfig()orassertHazelcastJoinPortTryCount(...). So the regression this PR is trying to prevent (git history shows this property has flip-flopped between30/100more than once) can still silently reoccur in any of those four files without the new assertion ever firing. See Issue 4 below (downgraded from Medium-blocking-concern to Medium-residual-gap, since the base class itself is now guarded).
In-depth correctness analysis: the fix is a pure test/config-resource change; no production request-handling, checkpoint, or serialization code is touched. Config.loadFromString(getHazelcastConfig()) in AbstractSeaTunnelServerTest.before() (:64) is the only consumer, called once per test-class @BeforeAll (@TestInstance(PER_CLASS)), so the new assertion executes exactly once per class before any Hazelcast instance is created — no lifecycle-ordering risk.
1.2 Compatibility Impact
Fully compatible, with one nuance worth calling out explicitly: unlike the version I reviewed previously (test-only), this commit's core fix (seatunnel-engine-common/src/main/resources/hazelcast.yaml:39) does touch the production default config packaged to real Zeta deployments. That's a behavior change for any real cluster relying on the previous default (try.count: 30) — but it's a change in exactly the direction that fixes the documented bug class (a node whose auto-incremented port lands beyond the old 30-port scan window now works instead of failing to join), so this is a compatible bug fix, not an incompatible behavior change. No Option definition, protocol, or serialization format is touched; no incompatible-changes.md entry is needed since defaults for internal Hazelcast join tuning aren't part of the documented Option surface.
1.3 Performance/Side-Effects
Unchanged from my previous analysis: raising try.count only bounds the maximum ports the TCP-IP joiner may probe; probing stops once the node finds itself/peers, so this is not a forced 100-iteration cost on every start. No new allocations or blocking behavior introduced.
1.4 Error Handling and Logging
Issue 3 (carryover, still open, non-blocking): Documented example configs still show the inconsistent pairing
- Location:
docs/en/engines/zeta/resource-isolation.md:34,docs/en/engines/zeta/rest-api-v1.md:34(and zh equivalents) still pairport-count: 100withhazelcast.tcp.join.port.try.count: 30. - Status: Unchanged since my last review — not touched by this commit.
- Severity: Low.
Issue 4 (downgraded from Medium, residual gap): Regression guard only covers the base class, not the 4 sibling classes it was meant to protect
- Location:
WorkerTagTest.java:47-83,OptionRulesApiTest.java,RestApiSubmitJobStartWithSavePointTest.java,RestApiSubmitJobConfigShadeDecryptTest.java— all independently overridegetHazelcastConfig()without callingassertHazelcastJoinPortTryCount(...). - Potential risk: The exact regression this PR is trying to prevent (an independent literal edit to
port-countortry.countdrifting the two apart again) remains possible in any of these four files with no assertion to catch it. - Best improvement: Either have these four classes call
AbstractSeaTunnelServerTest.assertHazelcastJoinPortTryCount(...)with their own local port-count/try-count values before building their config string, or extract the config-string-building itself into a shared helper method on the base class that the four overrides delegate to instead of duplicating the whole YAML literal. - Severity: Medium.
Issue 5 (new, found in this round — CI-verified, not a code-review guess): Windows unit-test still fails with the exact symptom this PR claims to fix, in the exact class this PR modified
- Location: CI evidence, fork run
https://github.com/JeremyXin/seatunnel/actions/runs/32275129532/job/96143784015(unit-test (11, windows-latest)), current headc8b8cee47. - Problem description: I pulled the full job log rather than trusting the pass/fail summary. It shows:
[ERROR] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 311.399 s <<< FAILURE! - in org.apache.seatunnel.engine.server.rest.OptionRulesApiTest java.lang.IllegalStateException: Node failed to start! at org.apache.seatunnel.engine.server.rest.OptionRulesApiTest.before(OptionRulesApiTest.java:73)OptionRulesApiTestis one of the four classes this exact PR fixed in Issue 2 (try.count: 30→100, matchingport-count: 100) — and on the current, fully-fixed head, it still throws the identicalIllegalStateException: Node failed to start!on Windows, at essentially the same ~311s elapsed time (consistent with Hazelcast's join-timeout budget being exhausted, not a quick failure). - Potential risk: This is directly relevant to whether the PR's stated root-cause diagnosis (port-try-count window mismatch) is complete. Two readings are both plausible and I want to be upfront about which is which: (a) this is a known, pre-existing, environmental
windows-latest-only flake (I have direct memory of seeing this sameIllegalStateException: Node failed to start!/ ~300s-elapsed signature on 3 separate, unrelated PRs'engine-serverunit-test jobs, each time hitting a different test class — consistent with a runner-level networking/resource issue on GitHub's Windows hosts, not a code defect), in which case this occurrence is bad luck, not a regression from this PR; or (b) the port-try-count theory doesn't fully explain "Node failed to start!" on Windows (e.g., IPv4/IPv6localhostresolution differences onwindows-latest, or socket exclusivity/TIME_WAIT behavior causing the actually-bound address to differ from what the joiner scans), in which case this PR's fix is necessary but not sufficient for Windows specifically. I cannot distinguish these two from a single log, but either way, the CI on this exact head is objectively red right now because of it (gh pr checks 11868→Build fail), on the very test class this PR set out to stabilize. - Best improvement: Rerun the failed Windows job (
gh run rerun <run-id> --job 96143784015on the fork, or ask the contributor to push an empty commit / rerun) before merge. If it passes on rerun, this supports reading (a) — the known environmental flake — and merge can proceed. IfOptionRulesApiTest(or another of the four classes this PR touched) hits the same error again on Windows specifically, that's real evidence the fix is incomplete for that platform and needs further investigation (e.g., what address the joiner is actually advertising vs. scanning onwindows-latest). - Severity: High (CI is currently failing on this exact head; even under the more charitable "known flake" reading, I'd rather have a confirmed-green rerun in hand than assume it away, given this is the identical class/scenario this PR is meant to fix).
- Raised by another reviewer: No.
2. Code Quality Assessment
2.1 Coding Standards
Issue 6 (new, minor): new constants and the new guard method have no comments
- Location:
AbstractSeaTunnelServerTest.java:51-52(HAZELCAST_PORT_COUNT,HAZELCAST_TCP_JOIN_PORT_TRY_COUNT),:114(assertHazelcastJoinPortTryCount). - Problem: Per this repo's convention (new non-trivial fields/methods need a comment explaining purpose/constraint), these three new symbols have zero Javadoc — a one-line comment on why
HAZELCAST_TCP_JOIN_PORT_TRY_COUNTis deliberately tied toHAZELCAST_PORT_COUNT(rather than an independent literal) would prevent a future editor from "simplifying" it back into two unrelated constants. - Severity: Low.
2.2 Test Coverage and Test Stability
No new dedicated unit test exercises assertHazelcastJoinPortTryCount(...)'s failure branch directly (e.g. asserting it throws for try.count < port-count) — acceptable for a defensive assertion helper, not a blocker, but cheap to add. The mandatory flaky-test/stability angle is squarely relevant here since this whole PR is about a flaky-test root cause: rating Risk present, downgraded from my previous round's rating because the residual risk is now narrower (limited to the four sibling classes per Issue 4, plus the open Windows CI question in Issue 5) rather than a known-and-unfixed production config bug.
2.3 Documentation Updates
Not updated; see Issue 3 (carryover, non-blocking).
3. Architectural Soundness
3.1 Elegance of the Solution
Between Precise fix and Temporary workaround: the production-default fix (Issue 1) and the four-class alignment (Issue 2) are precise, and the new self-consistency assertion is a genuine architectural improvement over "just edit the number." It still falls short of fully centralizing the invariant (Issue 4 — four classes remain unguarded duplicated literals), so I'd call this "mostly precise, with a known-and-bounded remaining gap," which is a fair place to land for a test-stability PR.
3.2 Maintainability
Net positive versus the version I reviewed previously — a documented, enforced constant relationship in the base class is meaningfully better than five independent literals with no relationship encoded anywhere. The four sibling classes are the one place this improvement doesn't yet reach.
3.3 Extensibility
No impact beyond what's already covered.
3.4 Historical-Version Compatibility
No impact — this only affects join-scan behavior during Hazelcast node startup; no wire protocol, serialized state, or checkpoint format is touched, and old configs that don't override hazelcast.tcp.join.port.try.count will now pick up the corrected shipped default rather than the old under-provisioned one, which can only help, not hurt, existing deployments.
4. Issue Summary
| # | Issue | Location | Severity | Status |
|---|---|---|---|---|
| 1 | Production hazelcast.yaml had the identical unfixed mismatch |
seatunnel-engine-common/src/main/resources/hazelcast.yaml:35,39 |
High | Resolved |
| 2 | Four other test classes carried the same unfixed mismatch | WorkerTagTest.java, OptionRulesApiTest.java, RestApiSubmitJobStartWithSavePointTest.java, RestApiSubmitJobConfigShadeDecryptTest.java |
Medium | Resolved |
| 3 | Documented example configs still pair port-count:100 with try.count:30 |
docs/en(zh)/engines/zeta/resource-isolation.md, rest-api-v1.md |
Low | Open (non-blocking) |
| 4 | New regression guard only covers the base class, not the 4 sibling overrides | WorkerTagTest.java + 3 others |
Medium | Partially resolved / residual gap |
| 5 | Windows unit-test currently fails with Node failed to start! in OptionRulesApiTest — the exact class this PR fixed |
fork run 32275129532, job 96143784015 |
High | New, open — needs CI verification before merge |
| 6 | New constants/guard method have no comments | AbstractSeaTunnelServerTest.java:51-52,114 |
Low | New, non-blocking |
5. Merge Recommendation
Conclusion: Ready to merge after fixes
-
Blockers — must be fixed
- Issue 5: confirm (via a CI rerun of the failed Windows job) whether
OptionRulesApiTest'sNode failed to start!onwindows-latestis the known unrelated environmental flake or a sign the fix is incomplete for Windows. I don't want to approve a PR whose entire purpose is fixing this exact exception while its own current head is failing with that exact exception on the class it touched, without at least one confirmed-green rerun in hand.
- Issue 5: confirm (via a CI rerun of the failed Windows job) whether
-
Recommended fixes — non-blocking
- Issue 4: extend the new
assertHazelcastJoinPortTryCountguard (or a shared config-builder) to the four sibling classes so the regression this PR fixes can't silently reappear there. - Issue 3: update the two docs pages to match the corrected default.
- Issue 6: add short comments to the new constants/method.
- Issue 4: extend the new
Overall assessment: This is real, meaningful progress since my last review — both previous blockers are fixed correctly, and the author went beyond the ask by discovering and fixing two more implicit-default instances of the same bug and adding a genuine (if partial) regression guard. The one thing keeping this from "ready to merge" outright is that I checked the actual CI log rather than the summary and found the current head's Windows job failing with precisely the symptom this PR is supposed to eliminate, in a class this PR touched — that's too on-the-nose a coincidence to wave off without at least a confirmed rerun. Happy to flip to Approve once that's cleared up.
DanielLeens
left a comment
There was a problem hiding this comment.
Re-reviewing the current head (9b95505c7) from scratch, since a new commit landed after my last review (which flagged a currently-failing Windows unit-test as the one remaining blocker). Good news: I pulled the fork's live CI results for this exact head rather than trusting a cached summary, and both unit-test (8, windows-latest) and unit-test (11, windows-latest) — the jobs, and the exact test class (OptionRulesApiTest), that were failing on the previous head — are now green. Details and full re-verification below.
What Problem Does This PR Solve?
AbstractSeaTunnelServerTest configures the Hazelcast test node with port-count: 100 (auto-increment across 100 ports while binding) but only hazelcast.tcp.join.port.try.count: 30 (the TCP-IP joiner only scans 30 ports to discover cluster members, including itself). When the bound port lands more than 30 slots from the base port, the joiner can't find its own address and the node throws IllegalStateException: Node failed to start! — a CI-flakiness source. The PR raises try.count to match port-count everywhere this pairing exists.
1. Code Change Review
1.1 Core Logic Analysis
What changed since my last review (1 commit, 1 file, +92/-3):
9b95505c7 [Test][Zeta] Add OptionRulesApiTest startup diagnostics
on top of the previously-reviewed c8b8cee47. I re-verified the full diff against dev from scratch, not just this delta:
- Issue 1 (production default) — still RESOLVED, re-confirmed.
seatunnel-engine-common/src/main/resources/hazelcast.yaml:35,39is stillport-count: 100/try.count: 100. - Issue 2 (four sibling test classes) — still RESOLVED, re-confirmed.
WorkerTagTest.java:74,OptionRulesApiTest.java:207,RestApiSubmitJobStartWithSavePointTest.java:534,RestApiSubmitJobConfigShadeDecryptTest.java:382all still carrytry.count: 100alongsideport-count: 100. - Issue 4 (regression guard) — still only covers the base class, unchanged.
AbstractSeaTunnelServerTest.java:51-52,80,114still hasHAZELCAST_PORT_COUNT/HAZELCAST_TCP_JOIN_PORT_TRY_COUNTandassertHazelcastJoinPortTryCount(...), and the four sibling classes still don't call it — this non-blocking gap from my last review is unchanged (expected, since it wasn't a blocker). - Issue 3 (docs) and Issue 6 (missing comments) — also unchanged, as expected (both were non-blocking carryovers).
Issue 5 (the actual blocker) — this round's real change. Rather than just rerunning the previously-failed job as I suggested, the new commit adds diagnostic instrumentation to OptionRulesApiTest (logStartupContext, logCauseChain, logThreadDump, isPortInUse helpers, wrapping createHazelcastInstance in a try/catch that logs full context on failure). This doesn't change the port-count/try-count values themselves — it's purely for capturing more evidence if the failure recurs, not a functional fix. That said, it does trigger a fresh CI run, which is what actually matters here. I checked the fork's live Actions results for this new head (9b95505c7a71bc6d577edbb1c9707cc0acb22ea7) directly rather than the cached rollup:
Run / unit-test (11, windows-latest)→ success (https://github.com/JeremyXin/seatunnel/actions/runs/32352285042/job/96374679026)Run / unit-test (8, windows-latest)→ success (https://github.com/JeremyXin/seatunnel/actions/runs/32352285042/job/96374678996)- All other completed jobs in this run (Code style, License header, unit-test on ubuntu, jdbc-connectors-it, engine-v2-it, all-connectors-it, transform-v2-it) are also green; a handful of unrelated
all-connectors-it/transform-v2-itshards were stillin_progressat the time I checked, but none had failed, and none of them touch the files this PR changes. - This is exactly the "confirmed-green rerun" I asked for before merging — the Windows
Node failed to start!symptom did not reproduce on the fixed config. Per my own framing in the last review, this supports the "known environmental flake, not an incomplete fix" reading, and clears Issue 5.
1.2 Compatibility Impact
Fully compatible. Same as last round: the production-default change (try.count: 30 → 100) is a compatible bug fix (widens the join-port scan window, doesn't change any public Option, protocol, or serialization format), and this round's only change is test-only diagnostic logging with zero production impact.
1.3 Performance / Side-Effect Analysis
The new isPortInUse check opens and immediately closes a throwaway ServerSocket/DatagramSocket on the configured port purely for diagnostic logging in @BeforeAll/on failure — negligible cost, test-only, no production path affected.
1.4 Error Handling and Logging
No new blocking issues found this round. Carried-forward non-blocking items (unchanged, still worth doing before or shortly after merge):
Issue 3 (carryover, non-blocking): Documented example configs still show the old inconsistent port-count/try.count pairing.
- Location:
docs/en/docs/zhexample Hazelcast configs (as previously identified) - Severity: Low
- Raised by another reviewer: No
Issue 4 (carryover, non-blocking): The new assertHazelcastJoinPortTryCount guard only protects AbstractSeaTunnelServerTest; the four sibling classes it was meant to protect (WorkerTagTest, OptionRulesApiTest, RestApiSubmitJobStartWithSavePointTest, RestApiSubmitJobConfigShadeDecryptTest) each hard-code their own YAML and never call it.
- Location: the four sibling test classes
- Severity: Medium
- Raised by another reviewer: No
Issue 6 (carryover, non-blocking): New constants (HAZELCAST_PORT_COUNT, HAZELCAST_TCP_JOIN_PORT_TRY_COUNT) and the new guard method lack doc comments explaining the invariant they encode.
- Location:
AbstractSeaTunnelServerTest.java:51-52,114 - Severity: Low
- Raised by another reviewer: No
2. Code Quality Assessment
2.1 Coding Standards
The new diagnostic-logging code in OptionRulesApiTest (logStartupContext, logCauseChain, logThreadDump, isPortInUse) is private/static helper code, self-explanatory from naming, and test-only — no missing-doc-comment concern for these.
2.2 Test Coverage and Test Stability
Stable, upgraded from "Risk present" last round now that the flagged Windows failure has a confirmed-green rerun at the current head. The new diagnostic logging is a reasonable defensive addition for a flaky-test-history file — if OptionRulesApiTest ever fails again on Windows, the thread dump and port-in-use checks will make root-causing much faster. No new flaky-test anti-patterns introduced (no new Thread.sleep, no new nondeterministic assertions).
2.3 Documentation Updates
Not updated this round; see Issue 3 (non-blocking carryover).
3. Architectural Soundness
3.1 Elegance of the Solution
Precise fix for the core issue (Issues 1 and 2), plus a genuine architectural improvement (the self-consistency guard, Issue 4's partial coverage). This round's diagnostic-logging addition is a reasonable pragmatic move given the CI evidence I asked for — it didn't change behavior but got the fresh CI run that resolves the open question.
3.2 Maintainability
Good — the new logging will materially help diagnose any future recurrence of this class of Windows CI flake, which has a documented history of recurring across unrelated PRs.
3.3 Extensibility
N/A — test-and-config-only change.
3.4 Historical-Version Compatibility
No compatibility risk — same conclusion as last round.
4. Issue Summary
| # | Issue | Location | Severity | Status |
|---|---|---|---|---|
| 3 | Docs show old try.count/port-count pairing |
docs/en, docs/zh |
Low | Open, non-blocking |
| 4 | Regression guard doesn't cover the 4 sibling test classes | WorkerTagTest.java etc. |
Medium | Open, non-blocking |
| 5 | Windows unit-test Node failed to start! on the exact class this PR touched |
fork run 32275129532 (old head) |
High | Resolved — confirmed green on new head (32352285042) |
| 6 | New constants/guard method lack doc comments | AbstractSeaTunnelServerTest.java |
Low | Open, non-blocking |
5. Merge Recommendation
Conclusion: Ready to merge
- Blockers — must be fixed: None remaining. The one High-severity blocker from my last review (Issue 5, CI red on the Windows unit-test job for the exact class/symptom this PR targets) is now cleared with a confirmed-green rerun at the current head.
- Recommended fixes — non-blocking: Issues 3, 4, and 6 above (docs, extending the regression guard to the 4 sibling classes, and comments on the new constants) would be worth a fast follow-up, but none of them block this PR — it accomplishes its stated goal correctly and compatibly.
Overall: this has been a solid iterative round-trip — both original blockers were fixed precisely, and the author went beyond what I asked for (production default, self-consistency guard) and then closed the loop on my CI concern with a real green rerun rather than hand-waving it away. Nice work, and thanks for the quick turnaround.
|
CI record correction on my own approval, @JeremyXin — the fix itself is unaffected, but I want to be precise about what's currently red. When I approved, I cited a confirmed-green rerun of
None of these touch My "Ready to merge" conclusion stands. A rerun of the three affected jobs should get this back to green; no action needed on your end. |
|
CI record update, @JeremyXin — following up on my 2026-08-22 note again, since the The most recent completed attempt on this exact head (
Neither failure touches |
|
CI record update, @JeremyXin — following up again since the That attempt (fork run I want to be precise about why I don't think this is a regression of this PR's own fix, even though it's technically the same exception text and the same base class this PR modifies:
My "Ready to merge" conclusion from 2026-08-20 stands. At 19 rerun attempts with a different unrelated flaky job/class failing almost every time, I don't think further reruns are a productive way to reach a clean run — I'd recommend a maintainer with write access merge on the strength of the code review rather than continuing to wait for an all-green attempt. |
|
Flagging a merge-state fact I haven't called out separately before: GitHub currently reports this branch as @JeremyXin could you sync the latest |
|
Synchronized with current This remains a configuration-and-test change: the embedded Hazelcast discovery probe count is aligned with the configured member port range, including the production configuration already changed by this PR. No test is disabled or weakened. Affected common/core/server formatting and static diff checks passed. Fresh current-head GitHub CI still needs to complete before this can be considered validated; the old run has already reached attempt 24, so I did not add another speculative retry. |
DanielLeens
left a comment
There was a problem hiding this comment.
Thanks for the quick turnaround on the merge! The head was updated by a merge of dev that carries your regression guard forward, so I re-read the full diff and re-traced the call chain against head 4d7cddba7c3a. This is a code-reading review only; nothing was executed locally.
What Problem Does This PR Solve?
- User pain point: several Zeta unit-test classes (and the embedded default
hazelcast.yaml) configureport-count: 100buthazelcast.tcp.join.port.try.count: 30. When the local test member lands on a port beyond the probed range, TCP discovery cannot find it and the node fails withNode failed to start!(seen on Windows CI). - Fix approach: align the probe count with the port range (100/100) in the default config and the affected test fixtures, lower the client test fixture to match its own
port-count: 10, and add an explicitjoin try count >= port-countguard toAbstractSeaTunnelServerTest. - One-sentence summary: make Hazelcast TCP join probe every port the member is allowed to bind, and guard that invariant in the test base class.
1. Code Change Review
1.1 Core Logic Analysis
Runtime path: SeaTunnelServerStarter.createHazelcastInstance -> Hazelcast TcpIpJoiner -> probes try.count ports starting at the configured port; the member itself binds anywhere in [port, port + port-count) via auto-increment. If try.count < port-count and the bind lands past the probed window, the joiner never finds the member.
Key changes:
seatunnel-engine-common/src/main/resources/hazelcast.yaml:try.count 30 -> 100(matchesport-count: 100at line 35). Also adds the missing trailing newline.seatunnel-engine-client/src/test/resources/hazelcast.yaml:30 -> 10, matching the fixture'sport-count: 10.seatunnel-engine-common/src/test/resources/hazelcast.yamlandseatunnel-engine-server/src/test/resources/hazelcast.yaml: addtry.count: 100.AbstractSeaTunnelServerTest.java: introducesHAZELCAST_PORT_COUNT/HAZELCAST_TCP_JOIN_PORT_TRY_COUNTconstants andassertHazelcastJoinPortTryCount(...), called fromgetHazelcastConfig().WorkerTagTest,OptionRulesApiTest,RestApiSubmitJobConfigShadeDecryptTest,RestApiSubmitJobStartWithSavePointTest: embedded YAML aligned to 100.OptionRulesApiTest.javaadditionally gains startup diagnostics (context log, cause-chain log, thread dump on failure, port-in-use probe).
Correctness: this is a pure configuration/test-fixture alignment. It only widens (or, for the client fixture, exactly matches) the discovery window; it cannot make a previously discoverable member undiscoverable.
1.2 Compatibility Impact
Fully compatible. No Option, public API, serialization or checkpoint change. The one runtime-visible effect is that the packaged fallback hazelcast.yaml in seatunnel-engine-common now probes up to 100 ports instead of 30; this only matters when the member bound past the 30th port of the range.
1.3 Performance / Side-Effect Analysis
try.count is an upper bound, not a fixed number of attempts, so the extra probing only happens when many ports are already in use. Negligible startup cost in the normal case. The thread dump added to OptionRulesApiTest only runs on startup failure.
1.4 Error Handling and Logging
Issue 1 (carryover, non-blocking): the shipped distribution configs still have the same mismatch
- Location:
config/hazelcast.yaml:38,config/hazelcast-master.yaml:39,config/hazelcast-worker.yaml, anddeploy/kubernetes/seatunnel/conf/hazelcast-*.yamlall keephazelcast.tcp.join.port.try.count: 30with noport-countoverride (the Hazelcast default range is 100). - Problem: in my earlier review I treated
seatunnel-engine-common/src/main/resources/hazelcast.yamlas "the shipped production default" and marked that item resolved. That was incomplete: the files users actually receive in the binary distribution underconfig/are the ones above, and they still carry 30. I am sorry I did not point this out at the time. - Risk: low; these configs usually run on hosts with free ports, so the failure needs many occupied ports. But the PR description presents the production default as fixed.
- Best fix: align them to
100in this PR, or leave them and note in the description that distribution configs are intentionally untouched. A follow-up PR is acceptable. - Severity: Low
- Raised by another reviewer: No
Issue 2: debug scaffolding in OptionRulesApiTest
- Location:
OptionRulesApiTest.javastartup block (about lines 82-106) and the helper methods at the end of the file. - Problem: about 90 lines of startup diagnostics (full YAML dump, thread dump through
LOG.error, port probes viaServerSocket/DatagramSocket) were added to a single test class. The context log line hard-codeshazelcastPortCount=100, hazelcastJoinPortTryCount=100instead of using constants, so it can drift from the real config.isPortInUsebinds and releases a socket, which can itself race with the member start. - Risk: noise and drift only; no behavior change.
- Best fix: drop it before merge, or move it into
AbstractSeaTunnelServerTestif it is meant to help all server tests, and read the numbers from constants. - Severity: Low
- Raised by another reviewer: No
Issue 3 (carryover): docs still show the old pairing
- Location:
docs/en|zh/engines/zeta/resource-isolation.md,docs/en|zh/getting-started/kubernetes/*.mdexample YAML (try.count: 30). - Severity: Low, non-blocking
- Raised by another reviewer: No
2. Code Quality Assessment
2.1 Coding Standards
Formatting is clean. assertHazelcastJoinPortTryCount has a proper Javadoc. The two new constants in AbstractSeaTunnelServerTest have no comment explaining why they must stay equal; one line would help.
2.2 Test Coverage and Test Stability
Rating: Stable. No test is disabled or weakened. The new guard is invoked from getHazelcastConfig(), so a subclass that sets the numbers inconsistently fails fast with a clear message. Sibling classes with their own inline YAML (WorkerTagTest etc.) are aligned by hand to 100 rather than through the guard, so they could still drift. seatunnel-e2e/.../connector-seatunnel-e2e-base/src/test/resources/hazelcast.yaml still has port-count: 100 with try.count: 30; it is an e2e fixture outside this PR's target.
2.3 Documentation Updates
No user-visible option change, so no docs are strictly required; see Issue 3 for examples that still show the old values.
3. Architectural Soundness
3.1 Elegance
Precise fix for the root cause (probe window smaller than bind window) in the main resource and the affected fixtures, plus a guard in the base test class.
3.2 Maintainability
The number 100 is still duplicated across YAML and inline strings; the guard covers only the base-class path.
3.3 Extensibility
Deriving try.count from port-count in one test config builder would remove the duplication entirely; fine as a follow-up.
3.4 Historical-Version Compatibility
No impact on existing jobs, configs, state or the upgrade path; only default discovery probing widens.
4. Issue Summary
| Number | Issue | Location | Severity |
|---|---|---|---|
| 1 | Distribution configs under config/ and k8s conf still try.count: 30 |
config/hazelcast*.yaml, deploy/kubernetes/seatunnel/conf/* |
Low |
| 2 | Debug scaffolding with hard-coded numbers in one test class | OptionRulesApiTest.java startup block |
Low |
| 3 | Docs examples still show the old pairing | docs/en|zh/engines/zeta/resource-isolation.md etc. |
Low |
5. Merge Recommendation
Conclusion: Ready to merge
Blockers (must fix): none.
Recommended fixes (non-blocking): Issues 1-3 above; Issue 1 is the most useful and can be a follow-up.
CI: the real build runs in the contributor fork: Build run https://github.com/JeremyXin/seatunnel/actions/runs/40164766553 finished success for this head. The apache-side PR signal run is action_required, which is only the first-run approval gate, not a test result. The branch is 2 commits behind dev with no conflicts; no sync is needed.
Overall assessment: the earlier High items (production default, sibling classes, invariant guard, Windows CI) remain resolved on this head, and the dev-merge conflict was resolved without weakening any assertion. A maintainer with write access still needs to do the final approval and merge-queue step.
DanielLeens
left a comment
There was a problem hiding this comment.
Thanks for preserving the join-range change and the newer IPv4 fixture correction. I re-reviewed the complete nine-file diff at 4d7cddba7c3adfd825a8e093143d63417c4347c8. The configured ranges are consistent in the changed fixtures. Sorry for treating the regression coverage as sufficient in the earlier review: the existing integration path still does not exercise discovery beyond the old probe range. That is a carryover coverage gap, not a new production regression.
What problem this PR solves
- User pain: A member can bind within an auto-increment range larger than the port range TCP discovery probes, leaving the later ports undiscoverable from a portless member address.
- Fix approach: Align probe count with the configured bind range: 100 in the common/server fixtures and classpath fallback, 10 in the client fixture.
- One-line summary: Discovery can search all ports the corresponding auto-increment configuration permits.
For example, if binding moves from base port P to P+40, a 30-port probe window cannot cover that endpoint; a 100-port window can. This does not prove that every historical Node failed to start symptom had this cause.
1. Code-change review
1.1 Core logic analysis
Complete diff: +130/-13, configuration and tests. Representative change:
# Before: port-count 100, TCP probe count 30
# After:
port-count: 100
hazelcast.tcp.join.port.try.count: 100The client test configuration instead pairs port-count 10 with try-count 10. The new base-fixture constants share one value and call assertHazelcastJoinPortTryCount() before constructing YAML.
ConfigProvider / Hazelcast config locator
-> load explicit YAML or classpath fallback
-> NetworkConfig bind range and TCP_JOIN_PORT_TRY_COUNT property
-> Hazelcast member startup -> TcpIpJoiner
-> read maxPortTryCount
-> portless configured member address: enumerate that many candidate ports
-> explicitly port-qualified member address: one port
-> discover/join cluster -> normal SeaTunnel server lifecycle
Server UT fixture
-> getAvailablePort(range) -> generated YAML -> member startup
-> OptionRulesApiTest additionally logs context/failure causes/thread stacks
I checked the exact Hazelcast 5.1 source used by the project: TcpIpJoiner reads the property and uses portIsDefined ? 1 : maxPortTryCount when expanding addresses. Key findings:
- Startup using the changed fallback/fixtures reaches this setting; explicit external YAML is not rewritten by this PR.
- The widened range affects portless TCP discovery, not job/checkpoint state or explicit host:port semantics.
config/hazelcast.yamlstill uses a fixed port with auto-increment disabled. The existing documentation examples I checked also describe fixed-port setups. A value of 30 there is not itself proof of the 100-versus-30 mismatch. I withdraw the earlier blanket claim that every such example must become 100.- Startup diagnostics are evidence collection, not a functional cure for every Windows startup failure. A green run cannot prove a historical flake has been eliminated.
1.2 Compatibility impact
Compatible, with an intentional classpath-fallback discovery-window change from 30 to 100. No API/SPI, option name, protocol, default bind port, serialized state, or checkpoint contract changes. Explicit supplied configurations retain their own values. No data migration is needed.
1.3 Performance and side effects
Portless discovery can attempt up to 70 additional addresses per configured host, increasing startup connection work/latency in unsuccessful discovery; this is not a per-row cost. No new production threads, locks, buffers, retries, replay, or resource ownership is added. Diagnostic socket probes and thread dumps are test-only, with sockets closed by try-with-resources.
1.4 Error handling, logging, and formal issues
The startup catch logs context and rethrows the same Throwable; it does not turn failure into success. Logged YAML is the generated test configuration, not arbitrary customer credentials. The existing cleanup restores fixture settings.
Issue 4 — Protect the real discovery boundary in the existing engine IT (Medium, required coverage).
- Location:
seatunnel-engine/seatunnel-engine-server/src/test/java/org/apache/seatunnel/engine/server/AbstractSeaTunnelServerTest.java:80,122-131; existingseatunnel-e2e/seatunnel-engine-e2e/connector-seatunnel-e2e-base/src/test/java/org/apache/seatunnel/engine/e2e/LocalModeIT.javais unchanged. - Description/risk: The guard compares constants that are defined equal. It neither exercises discovery after binding beyond the old 30-port window nor protects independently constructed sibling YAML. A configuration typo or wrong runtime property path can escape it. The changed engine area has an existing IT, which should be extended in this change.
- Best improvement: Extend an existing engine startup/cluster IT to force a member into the later permitted range and verify another node discovers the actual endpoint. Hold any occupied-port sockets until member bind, use isolated cluster names, condition-based membership assertions, and deterministic cleanup. A parsed-config assertion can additionally protect sibling YAML.
- Already raised by another reviewer: No; this extends Daniel's existing Issue 4. My earlier assessment missed the required integration coverage.
Issue 6 — Explain the new invariant fields and diagnostic helpers (Medium, non-blocking carryover).
- Location:
AbstractSeaTunnelServerTest.java:51-52;OptionRulesApiTest.java:215-269. - Description/risk: The guard method now has Javadoc, but the non-trivial invariant constants and startup/port-probing helpers still lack the purpose/limitations comments previously requested. In particular, a diagnostic “in use” probe is only a point-in-time TCP/UDP observation, not a reservation or diagnosis of the original failure.
- Best improvement: Add brief comments capturing those contracts; no refactor is necessary.
- Already raised by another reviewer: No; carryover comment-completeness point.
2. Code quality assessment
2.1 Coding conventions
The guard now documents its parameters and error. The IPv4 loopback repair remains present. Static git diff --check upstream/dev...HEAD is clean. No local formatter/build/test, member startup, or job was run.
2.2 Test coverage and stability
The current fixture values are correct by inspection; Issue 4 separates that from real discovery regression coverage. OptionRulesApiTest retains its actual API assertions and now logs failures without suppressing them.
Stability rating: Stable for the changed diagnostic/assertion structure. No new sleep or timing assertion is introduced, and diagnostic probes close their sockets. Existing fixed HTTP port 18082 and reserve-then-release member-range allocation remain environmental limitations; the new logging does not remove them. The required IT should avoid extending those patterns.
The exact-head fork Build 40164766553 is successful. The current Apache rollup is empty, so effective required-check reporting still needs maintainer confirmation. Old run attempts and the prior Windows outcome are not a substitute for this head's evidence.
2.3 Documentation
No paired docs change is needed merely to replace valid fixed-port examples. A short English/Chinese explanation of the invariant for custom auto-increment deployments would be useful, but is not a new merge blocker.
3. Architectural assessment
3.1 Solution quality
A precise configuration correction, plus test-only diagnostics.
3.2 Maintainability
A shared constant helps the base fixture; actual parsed configuration and runtime discovery coverage are stronger regression guards.
3.3 Extensibility
The range invariant can guide other fixtures without changing task execution architecture.
3.4 Historical compatibility
Only the selected startup probe window changes. Job state and deployed explicit YAML remain compatible.
4. Issue summary
| Number | Issue | Location | Severity |
|---|---|---|---|
| Issue 4 | Existing IT does not cover discovery beyond the old probe window | AbstractSeaTunnelServerTest.java:80,122-131; LocalModeIT.java | Medium, required |
| Issue 6 | Invariant/diagnostic limitations need brief comments | AbstractSeaTunnelServerTest.java:51-52; OptionRulesApiTest.java:215-269 | Medium, non-blocking |
5. Merge conclusion
Conclusion: Can merge after fixes
- Blocking items: Issue 4, complete the existing engine integration regression for the behavior being changed. This is a delivery/coverage requirement, not evidence of a current functional failure.
- Suggested fixes, non-blocking: Issue 6 and optional paired deployment guidance.
There is no non-Daniel formal review or inline finding in the fetched review list to duplicate. Current comparison is ahead by 4, behind by 2, diverged, with no conflict. Successful exact-head fork CI does not justify a sync-first comment and does not clear the specific coverage gap.
The production direction is sound; a larger implementation is unnecessary. Daniel's READ permission keeps this COMMENT technical conclusion separate from effective maintainer approval and any historical review display. Thank you for keeping the fixture corrections intact through the sync.
nzw921rx
left a comment
There was a problem hiding this comment.
It is more like a user's tuning guide, and it is recommended not to change the system's basic YAML.
Purpose of this pull request
This PR fixes an inconsistent Hazelcast test configuration in
AbstractSeaTunnelServerTest.Previously,
port-countwas set to100, buthazelcast.tcp.join.port.try.countwas only30.When the test node bound to a port outside the first 30 candidates, Hazelcast join could fail to discover the node itself, which could cause UTs such as
CheckpointTimeOutTestto fail with:java.lang.IllegalStateException: Node failed to start!What is changed
hazelcast.tcp.join.port.try.countwithport-count30to100Result
This reduces CI instability caused by the mismatch between Hazelcast bind port range and join scan range in engine server tests.
Does this PR introduce any user-facing change?
How was this patch tested?
Check list
New License Guide
incompatible-changes.mdto describe the incompatibility caused by this PR.