Repository navigation
[Fix][Zeta] Isolate REST test HTTP ports from Hazelcast discovery - #13030
Conversation
DanielLeens
left a comment
There was a problem hiding this comment.
Review of 7bd50c98251346b2635880b70953cc5483fef033 — no blocking source findings. Merge remains blocked by queued current-head CI and required independent approval.
Basic information: [Fix][Zeta] Isolate REST test HTTP ports from Hazelcast discovery; author DanielLeens; target dev; +7/-3 across two existing test files. Report time: 2026-10-28 02:38:48 EDT (UTC-0400). Local branch codex-review-13030-20261028, worktree /Volumes/disk8/tmp/seatunnel-review-13030-20261028. This is an independent source inspection in the current audit; a COMMENT posted by the PR author account is not independent human approval.
What changes: two REST fixtures used HTTP listener ports inside the random Hazelcast allocation pool. For example, Hazelcast probing a 100-port range could reach an already-running HTTP listener and fail its protocol handshake. OptionRulesApiTest now reserves its one HTTP port through TestUtils. The savepoint fixture reserves two adjacent HTTP ports and limits dynamic selection to precisely those two ports.
Key findings:
OptionRulesApiTest.java:51-52allocates HTTP before Hazelcast.TestUtils.getAvailablePortis synchronized, checks every recorded range for overlap, probes all requested ports, and records the complete inclusive allocation. The one HTTP port therefore cannot be inside this fixture's 100-port Hazelcast range.RestApiSubmitJobStartWithSavePointTest.java:78-80,96-101,443-447allocates Hazelcast first and reserves a two-port HTTP range before either member starts.EngineConfigcan use the shared defaultHttpConfigfromServerConfigOptions.MasterServerConfigOptions.HTTP; configuring the worker can therefore also enable HTTP on the master. Reserving two ports is necessary.JettyService.chooseAppropriatePortusesport <= initialPort + portRange, soHTTP_PORT_COUNT - 1supplies exactly the two reserved candidates. The worker reads its bound connector port instead of assuming the base.- All original test methods, exact HTTP status/body assertions, two-member cluster assertions, checkpoint restore identity/mode assertions and wait budgets are unchanged. No CI selection is removed or relaxed.
Runtime chain: fixture allocation -> configuration -> master and worker Hazelcast startup -> each enabled Jetty listener chooses a free port in the reserved two-port range -> getHttpPort(workerServer) locates the actual worker connector -> REST/savepoint tests execute. Normal fixture startup reaches the change. Hazelcast auto-increment and discovery remain at 100 ports. Exception handling, checkpoint setup and teardown are unchanged. Allocator reservations are JVM bookkeeping rather than held OS sockets, so unrelated-process races remain an existing limitation.
Compatibility and quality: only test-fixture configuration changes. Production API/SPI/configuration names/defaults, old job semantics, checkpoint/savepoint serialization, connector registration and resources remain untouched. No migration or user-facing English/Chinese documentation is needed. No new thread/timer/queue/retry/logging or cleanup ownership is added. Existing REST option-rule and checkpoint component/integration tests retain failure capability; ordinary connector E2E is not claimed as proof of this fixture repair.
Change-location assessment: the root cause is fixture-local REST ports bypassing an existing shared allocation contract. These fixture initializers/setup and their small HTTP range are the best change locations. The smallest safe fix and global best fix coincide: use the existing allocator for every candidate port these fixtures may bind. Changing discovery, production JettyService, shared HttpConfig behavior or the allocator itself would expand compatibility and verification costs unnecessarily. The PR is a focused root-cause fixture fix, not a timeout/retry workaround.
Actual verification:
git fetch upstream pull/13030/head:codex-review-13030-20261028, exact-refgit show, fullgit diff cec3276740d989c8cb67c7b8c37e0a817e728059...codex-review-13030-20261028,git diff --check: passed; both complete changed files and affected allocator/configuration/Jetty chains inspected.gh pr view 13030 --json headRefOid,mergeable,mergeStateStatus,reviewDecision,reviews,statusCheckRollupand REST review/comment reads: passed; no prior formal or inline review/comments were present at review time.- Compilation, unit tests, integration tests, E2E, Docker and services: not run, under the repository's CI-only runtime-validation rule. No artifacts were reused, and
seatunnel-engine-uiwas not built because no build ran. Contributor-reported checks are not independent runtime evidence.
Completeness cross-check: all changed lines and deletions, initialization order, shared-configuration boundary, inclusive range arithmetic, actual bound-port lookup, preserved assertions, failure/cleanup paths, configuration compatibility, documentation applicability and current gates were examined. No changed file remains unreviewed. No evidenced introduced blocking or nonblocking source defect was found.
Merge gates at review time: MERGEABLE, mergeStateStatus=BLOCKED, reviewDecision=REVIEW_REQUIRED; PR signal succeeded, while Build is queued. Relevant current-head unit-test matrix execution and independent human approval remain outstanding. Conclusion: source review has no blocking findings; do not merge until those gates pass. This COMMENT does not grant approval.
Publication gate snapshot (2026-10-28 02:44:47 EDT (UTC-0400)): reviewed head 7bd50c98251346b2635880b70953cc5483fef033 remains current; mergeable=MERGEABLE, mergeStateStatus=BLOCKED, reviewDecision=REVIEW_REQUIRED. Exact-head checks: Signal pull request update COMPLETED/SUCCESS; Build IN_PROGRESS. This latest snapshot supersedes earlier gate observations above; it does not replace required runtime coverage or approval.
|
Thanks for the contribution. The CI fact cited in my previous conclusion has changed; this follow-up updates that gate on the unchanged reviewed head, without issuing another full source review. Gate snapshot (2026-10-28T15:52:20+00:00), head The blocking jobs are Run / engine-v2-it (17, ubuntu-latest) Observed log evidence: This evidence points to artifact transfer/extraction rather than establishing a product-diff defect. Rerun only the affected failed job after the transient artifact/cache problem is corrected. A simple base sync does not repair a connection reset or corrupted runner archive; I found no verified source-sync cure for that exact environment failure. My previous source conclusion remains clear for the reviewed scope. CI is not being passed by inference, and this follow-up is not an effective approval. Comparison recorded in this scan: base |
davidzollo
left a comment
There was a problem hiding this comment.
+1 if CI passes.
LGTM, thanks for your work and keep up the good effort!
DanielLeens
left a comment
There was a problem hiding this comment.
Thanks for the update. I re-read the complete changed-head diff and checked the affected fixture lifecycle.
What Problem Does This PR Solve?
User pain point: Two REST fixtures bypass the shared port allocator and can collide with other tests in the same JVM.
Fix approach: Allocate the option-rule HTTP port and the savepoint fixture's two HTTP candidates through TestUtils.getAvailablePort.
One-sentence summary and example: The two-member fixture reserves ports p and p+1 and sets Jetty's inclusive range to 1 instead of scanning a 2000-port range outside its reservation.
1. Code Change Review
1.1 Core Logic Analysis
OptionRulesApiTest uses one allocated HTTP port with dynamic-port selection disabled. RestApiSubmitJobStartWithSavePointTest reserves two consecutive ports because members can share HttpConfig. JettyService.chooseAppropriatePort uses <= initialPort + portRange, so HTTP_PORT_COUNT - 1 matches the reservation. The worker URL comes from its bound connector, not an assumed base port. The fixed 20000 argument is on the initially HTTP-disabled master setup; shared configuration can later enable both listeners on the reserved range.
Before:
HTTP_PORT = 18082;
createSeaTunnelConfig(clusterName, 23000, true);
httpConfig.setPortRange(2000);After:
HTTP_PORT = TestUtils.getAvailablePort();
workerHttpPort = TestUtils.getAvailablePort(2);
httpConfig.setPortRange(1);Key Findings
- The allocator records inclusive reservations and checks bindability.
- The configured Jetty range matches exactly two candidates.
- Existing REST status/body, cluster-membership and savepoint assertions are preserved.
Complete runtime path
Fixture setup -> shared port allocator -> SeaTunnelConfig -> Hazelcast member startup
-> JettyService chooses available candidate -> bound worker connector -> REST requests
-> existing teardown closes members and fixture files
The allocation/configuration arithmetic is consistent. Reservations are JVM bookkeeping rather than sockets held until Jetty binds, so an unrelated process can still race; this pre-existing allocator limitation is not introduced by the PR.
1.2 Compatibility Impact
Fully compatible. Test-only change; production APIs, options, dependencies and checkpoint formats are unchanged.
1.3 Performance / Side-Effect Analysis
No production cost. The existing fixture owns the same resources and assertions.
1.4 Error Handling and Logging
Existing startup/assertion exceptions and teardown handling remain unchanged.
No blocking source issues found. No numbered source findings remain for this head.
2. Code Quality Assessment
2.1 Coding Standards
The narrow existing-fixture edit follows the project style and documents its lifecycle constraint.
2.2 Test Coverage and Test Stability
Test stability: Stable for the change. The fix reduces intra-JVM port collisions without adding sleeps, larger timeouts, retries or weakened assertions. Both existing real-server fixtures retain their failure capability and teardown. It is not a claim that external port races become impossible.
Local analysis: fetched the head, created independent branch seatunnel-review-13030, read the complete 2-file diff and traced affected callers with git show/git grep. No local compilation, unit tests, integration tests, E2E, containers, or job execution was performed, as requested. These are source-analysis conclusions; execution evidence is the current-head CI below.
2.3 Documentation Updates
No user-facing English/Chinese guide or migration change is required for this test-only correction.
3. Architectural Soundness
3.1 Elegance of the Solution
Precise fix. The fixtures own the incorrect port choices, so changing them is the smallest safe fix. Production Jetty/discovery behavior does not need alteration.
3.2 Maintainability
Keep the lifecycle invariant documented next to the existing setup/cleanup.
3.3 Extensibility
No new framework or shared production abstraction is needed.
3.4 Historical-Version Compatibility
No production upgrade or state migration is introduced.
4. Issue Summary
| Number | Issue | Location | Severity |
|---|---|---|---|
| — | No formal issues found | Complete changed-file set | — |
5. Merge Recommendation
Conclusion: Ready to merge
- Blockers — must be fixed
- No source blocker identified. Current-head CI is successful; effective independent maintainer approval and repository gates still apply.
- Recommended fixes — non-blocking
- No additional unrelated changes requested.
Overall assessment: No source blocker found. The exact-head successful CI clears the earlier pending Build observation.
Existing-review reconciliation: @davidzollo expressed LGTM conditional on CI. The current head reports successful checks; the repository's actual required-review gate still applies. Author replies have been incorporated into this single full review.
Head e7d69741a21026aba9801147a4ffabbe72ccb993. Live base dev at 3ac2d1cec6aa7b3741c4dacdd23020f778e23c02; comparison ahead, ahead 2 / behind 0; merge state CLEAN. Behind/diverged alone is recorded metadata, not a request to synchronize upstream. Checks: Label PRs when reviewed = SUCCESS; Signal pull request update = SUCCESS; Build = SUCCESS
The current-head Build and Signal checks are SUCCESS.
Daniel has READ repository permission. This COMMENT records the technical conclusion; it is not an effective maintainer approval or a dismissal of any historical requested-changes entry. A write-capable maintainer owns the final repository approval gate.
Purpose of this pull request
Yes, I am contributing this test-fixture fix to Apache SeaTunnel.
Keep the HTTP listeners in two REST test fixtures outside their Hazelcast discovery ranges. Both failures occurred on October 27 in PRs that do not change these fixtures:
OptionRulesApiTeststarts Hazelcast at18044, then repeatedly connects to its HTTP listener at18082. It fails to join after 300 seconds.RestApiSubmitJobStartWithSavePointTeststarts Hazelcast at22981, then repeatedly connects to HTTP port23000, with the same startup failure.#11630 (
696e27422) introduced random Hazelcast ranges while leaving HTTP ports unreserved. #11572 (c7401bf14) subsequently moved allocation into10000..30000, which contains both fixed HTTP ports. #11868 widened discovery from 30 to 100 ports: the observed OptionRules collision is 38 ports above its base, while the savepoint collision is 19 ports above its base and was already within the previous scan width. A distinct cluster name cannot prevent the wrong-protocol connection.This patch uses the existing
TestUtilsallocator for both HTTP fixtures:OptionRulesApiTestbefore allocating its Hazelcast range.HttpConfig, so dynamic selection is retained. Jetty's upper endpoint is inclusive: a range of one covers exactly the two reserved ports. This replaces the unreserved 2,001-candidate range rather than reserving a large block in the shared test-port pool.Related: #13028 addresses the same collision pattern in
RestApiHttpsForTruststoreTest. This PR changes neither that fixture nor its branch.Does this PR introduce any user-facing change?
No. Only two test fixtures change. Production code, shared allocator implementation, POMs, APIs, checkpoint formats, test methods, assertions, timeouts and Hazelcast discovery settings are unchanged.
How was this patch tested?
./mvnw -f seatunnel-engine/seatunnel-engine-server/pom.xml -nsu -Dmaven.gitcommitid.skip=true spotless:apply spotless:check.git diff --checkalso passed.OptionRulesApiTestretains its exact REST status and option-rule checks. The savepoint test retains its two-member cluster check, missing-checkpoint HTTP 400 checks, restored job identifiers and restore-mode assertions.Check list