Repository navigation
Keep the SeaweedFS mini admin gRPC port out of the ephemeral range - #115512
Conversation
test_database_iceberg_seaweedfs_catalog could fail during fixture setup with a Connection refused from wait_for_seaweedfs, which reads as "the Iceberg REST catalog never started". That reading is wrong: the catalog answered HTTP 200 on all 314 polls, and the Connection refused was only the final poll, issued after the container had already exited 255. weed mini derives its admin gRPC port as admin.port + 10000, i.e. 23646 + 10000 = 33646, which is inside the Linux ephemeral range (floor 32768). One of mini's own startup dials can therefore take 33646 as an outbound source port before the admin server binds it, and the listen fails with "bind: address already in use" (mini.go:1583). Admin is the only derived gRPC port above the floor: mini derives exactly five of them (master 19333, filer 18888, volume 19340, s3 18333, admin 33646), and WebDAV and Iceberg carry a null gRPC pointer so they derive nothing. The failure then masks itself. glog.Fatalf (mini.go:1598) skips defer close(allServicesReady), and ensureMiniTableBuckets, which creates -tableBucket=analytics, runs only after <-allServicesReady. So the Iceberg service keeps answering 200 while the analytics bucket is never created, and the fixture's "analytics" in buckets condition can never become true. Pinning -admin.port=12646 makes the derived port 22646: below the ephemeral floor, and below the 22768 cap SeaweedFS uses for this same problem in its own test port allocator (seaweedfs/seaweedfs#10209, which left the mini default alone). The default is still 23646 on tags 4.41, 4.42 and upstream master, so bumping the image does not help. -admin.ui=false does not help either: startMiniAdminWithWorker is launched unconditionally and miniEnableAdminUI only affects the welcome banner. Extending the fixture wait cannot help, because the container is dead and the bucket is never created. Validated by forcing the collision with docker run --sysctl net.ipv4.ip_local_port_range="33646 33646" on chrislusf/seaweedfs:4.41: without the pin the CI log reproduces verbatim at both mini.go:1583 and mini.go:1598 including the two-minute readiness gap, and the analytics bucket is never created; with the pin it is. A control run on the default range passes unpinned, so the harness is not trivially red. The integration test itself passes and its container log reports Admin UI: ...:12646, where the same run on unpinned master reports ...:23646. The other SeaweedFS entry point, ci/jobs/scripts/functional_tests/ setup_seaweedfs.sh, needs no change: it runs weed server, which has no admin server, and already pins ports deriving to 21111..21114. The same collision reaches users through the two documented setups, so they are pinned as well: the SeaweedFS catalog guide's docker-compose.yml and the SeaweedFS connector page's docker run. Both pin image :latest, and admin.port is still 23646 there. Their symptom is worse than the test's, because the bucket each page tells the reader to use is the one that is never created, while the container keeps answering HTTP 200: the guide's CREATE DATABASE against s3://analytics and the connector page's clickhouse bucket both fail against a container that looks healthy. Verified on chrislusf/seaweedfs:latest with the same forced collision, once per page: unpinned, neither "created bucket clickhouse" nor "created table bucket analytics" appears and the container exits 255; pinned, each bucket is created and the container reports Admin UI: ...:12646. Both snippets keep publishing only 8333 and 8181, so the pinned admin port stays inside the container. The eight locale copies of the guide are left alone: they are generated from the English source (docs/README.md), so editing them by hand would be overwritten. CI report: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=109368&sha=4443610796f2ef985ff5615a261456a7ea4155ea&name_0=PR&name_1=Integration%20tests%20%28amd_tsan%2C%205%2F6%29 Related: ClickHouse#109368 Upstream: seaweedfs/seaweedfs#10838
Internal second-model review (click to expand)Three review rounds, an independent cold review plus a second-model gate each round. The final
💡 💡 Two refutations recorded rather than assumed. An image bump cannot fix this: the 23646 💡 The magic port is now explained on both docs pages, since each page explains every other 💡 No new ClickHouse test, and none is constructible. The condition is a third-party 💡 Alternative considered and rejected: raising the container's Carriers enumerated independently: 11 Session id: cron:clickhouse-review-slot-8:20260819-202200 |
Pre-PR validation gate (click to expand)
Session id: cron:clickhouse-impl-slot-4:20260819-152200 |
|
Workflow [PR], commit [1d9a61e] Summary: ✅ AI ReviewSummaryThis PR pins Final Verdict✅ No findings. |
|
cc @chrislusf @hanfei1991, could you review this? |
|
This is a good fix. The other fix is to set |
|
Both work. I picked |
Build profile diff (arm_release)Comparing ✅ No significant changes. Binary sizes
Only the stripped binary is compared: the official master build keeps debug symbols while PR builds strip them, so the other binaries differ by construction. Compile time of recompiled translation units6 translation units recompiled, 4 s compile time in total, 6 of them have a recent master baseline. |
|
cc @azat |
|
Ok, but @groeneai who asked you to create issue in upstream? Nobody. Please, before creating issues in upstream, wait for approval |
azat
left a comment
There was a problem hiding this comment.
Actually why it happens if we should have net.ipv4.ip_local_port_range: '55000 65535' ?
|
Because that sysctl never reaches this container: it is per-netns, and the note you left at Measured on a box whose host range is
So 33646 is ephemeral in the SeaweedFS netns, and A On the upstream issue: understood, I should have asked first and will wait for approval before filing in a repo I do not own. seaweedfs/seaweedfs#10838 is open with no comments; tell me whether to close it and whether to keep the |
azat
left a comment
There was a problem hiding this comment.
Ok, let's go this way (not to spend more CI time)
|
How it is possible if seaweedfs has been added only in 26.8? #113828 UPD: I removed the label |
…out of the ephemeral range Conflict resolution: the two .mdx documentation files touched by the original PR do not exist on the 26.7 release branch, so only the compose-file change (pinning -admin.port=12646) is backported. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
…out of the ephemeral range Conflict resolution: the two .mdx documentation files touched by the original PR do not exist on the 26.6 release branch, so only the compose-file change (pinning -admin.port=12646) is backported. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Cherry pick #115512 to 26.7: Keep the SeaweedFS mini admin gRPC port out of the ephemeral range
Cherry pick #115512 to 26.6: Keep the SeaweedFS mini admin gRPC port out of the ephemeral range
… of the ephemeral range
… of the ephemeral range
Backport #115512 to 26.7: Keep the SeaweedFS mini admin gRPC port out of the ephemeral range
Backport #115512 to 26.6: Keep the SeaweedFS mini admin gRPC port out of the ephemeral range
…ener (#11816) * admin: default to port 12535, keep 23646 as a best-effort compat listener The default admin HTTP port 23646 derives a worker gRPC port of 33646 (port + GrpcPortOffset), inside the Linux default ephemeral range (32768+). One of our own startup dials can claim 33646 before the admin binds it, killing startup. This is the same failure #10209 fixed for the test port allocator, still reachable via the mini default (#10838) and via standalone `weed admin` defaults. Move the default admin port to 12535 (gRPC 22535) everywhere, keeping the http+10000 convention so worker -admin derivation, the Rust worker and host:http.grpc addressing keep working: - weed admin -port, weed mini -admin.port - weed worker -admin, the plugin worker fallback, Rust worker and weed-lance-worker defaults - help text, README, helm values, docker compose, tests So old workers, bookmarks and scripts keep working, admin also serves the same handler and the worker gRPC server on the previous default (-port.legacy / -admin.port.legacy, default 23646, 0 disables). The legacy gRPC port binds best-effort: it lives in the ephemeral range, so a failed bind only warns instead of reintroducing the startup failure. weed mini reserves it early like the primary port and keeps it out of its own port relocation. grpc.Server tracks every listener handed to Serve, so the compat listener stops with the primary. Also warn when an explicitly configured admin port puts the derived gRPC port at or above the ephemeral floor, the other fix suggested in the issue. Supersedes the pinned-grpc approach in #11814: pinning -admin.port.grpc off the +10000 convention breaks external workers that derive the admin gRPC port from the HTTP address. ClickHouse/ClickHouse#115512 pins -admin.port on their side; this makes that pin unnecessary. Fixes #10838 * admin: let services win the legacy ports, close compat listener on failure Review findings on the compat listeners: - Do not put the legacy ports in mini's reservedPorts: an explicit -s3.port=23646 or -master.port.grpc=33646 must be honored, not rejected or stolen by the early reservation. Mini now checks the finalized port set and skips only the conflicting compat listener, so HTTP and gRPC compat degrade independently and the service keeps its port. - Also skip the legacy HTTP listener when a mini service owns the port: a wildcard-bound service can still leave loopback bindable, which would let the compat listener shadow it for loopback clients. - Close legacyServer's raw listener in the deferred cleanup: Serve may not have registered it yet when startAdminServer returns early. - Helm: add admin.legacyPort (default 23646) and expose the legacy http/grpc ports through the admin Service, container ports and NetworkPolicy so older workers resolved via the Service keep working. * helm: only pass -port.legacy when it differs from the binary default ct install deploys the released image with the new chart, and 4.48 does not know -port.legacy, so the admin pod crash-loops. Omitting the flag at the default value is behavior-identical on new binaries (their default is also 23646) and keeps older releases installable; legacyPort: 0 or a custom port still renders the flag.
Related: #109368
Related: seaweedfs/seaweedfs#10838
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
...
Description
test_database_iceberg_seaweedfs_catalogcan fail in fixture setup with aConnection refusedreadingas "the catalog never started"
(report,
tagged
retry_ok). It did start: it answered 200 on all 314 polls; the refusal is the last poll,after the container exited 255. Its log shows why.
weed miniderives the admin gRPC port asadmin.port + 10000= 33646, inside the Linux ephemeralrange (floor 32768), so one of mini's own startup dials can take it as a source port before admin
binds it. It is the only derived gRPC port above the floor; the other four land in 18333..19340.
The failure hides itself:
glog.Fatalfskipsdefer close(allServicesReady), and the call creating-tableBucket=analyticsruns only after<-allServicesReady. S3 and Iceberg keep answering 200while
analyticsis never created, so"analytics" in bucketsnever becomes true and a longer waitcannot help.
-admin.port=12646derives 22646: below the floor, and below the 22768 cap SeaweedFS derives forthis same problem in its own test port allocator (seaweedfs/seaweedfs#10209, which left the
minidefault alone). That default is 23646 on 4.41, 4.42 and master, so an image bump does not help; it is
filed upstream. Raising
ip_local_port_rangeviasysctls, as the Kafka composes do, would work too,but for every dial mini makes.
It reaches users too: the SeaweedFS catalog guide and connector page both document
minionimage: latest, so the bucket each tells the reader to use never appears. Both are pinned here;the guide's locale copies are left to the translation workflow.
Validated with
docker run --sysctl net.ipv4.ip_local_port_range="33646 33646": unpinned reproducesthe CI log verbatim, pinned creates the bucket, a default-range control is green.
Workflow [PR]
Sync PR [sync-upstream/pr/115512]
Version info
26.8.1.1762(included in26.8and later)26.7.7.71,26.6.5.102