Repository navigation
[Server] Wait for the client-facing port before reporting the server started - #1855
Merged
yili-db merged 1 commit intoSep 10, 2026
Merged
Conversation
…started main awaited Armeria on port + 1 and then deployed the Vert.x URL transcoder for the port clients use without awaiting it, and the verticle returned as soon as listen had been called, so the server reported itself started while that port was not yet accepting connections. A bind failure there was logged at INFO and dropped, since the deployment result was never inspected, leaving the process running and exiting 0 while serving nothing on the port every client connects to. The verticle now completes the deployment from its listen callback, and main waits for it and fails the startup if the port cannot be bound. The three readiness probes in the test harnesses waited on the internal port and then talked to the client-facing one, which is how the Python client suite failed in CI; they now probe the port they use. Signed-off-by: Noritaka Sekiyama <[email protected]>
moomindani
requested review from
dennyglee,
openinx,
tdas and
yili-db
as code owners
September 6, 2026 21:27
yili-db
approved these changes
Sep 8, 2026
tdas
approved these changes
Sep 10, 2026
tdas
left a comment
Contributor
There was a problem hiding this comment.
thanks for fixing this corner case.
3 of 4 tasks
yili-db
pushed a commit
that referenced
this pull request
Oct 26, 2026
…L transcoder (#1979) **PR Checklist** - [x] A description of the changes is added to the description of this PR. - [ ] If there is a related issue, make sure it is linked to this PR. - [x] If you've fixed a bug or added code that should be tested, add tests! - [x] If you've added or modified a feature, documentation in `docs` is updated **Description of changes** Today the launcher runs a Vert.x verticle on the client port. It forwards every request over HTTP/1.1 to Armeria on `port + 1`. It does one rewrite: Iceberg's nested-namespace separator `%1F` becomes `.`, in the path and in query values. Unity Catalog has no nested namespaces, so that rewrite doesn't make any request succeed. It only changes which error a client gets for a name it could never resolve. #1918 had to size the transcoder's connection pool to the JDBC pool, and answer `/livez` in front of it, so a saturated proxy wouldn't become the bottleneck. Removing the transcoder makes all of that unnecessary. This change: - removes `URLTranscoderVerticle` and the `vertx-core`, `vertx-web` and `vertx-web-client` dependencies; - binds Armeria to the `-p` port in `main`, instead of `port + 1`, and closes the server if it can't start; - binds the API port on all interfaces. Clients now connect to it directly, and the loopback bind from #1750 only existed because the transcoder sat in front; - drops the `port + 1` handling from the observability-port check; - updates `docs/server/observability.md`, which described the client port and the internal `port + 1` API port. **Reasons** - **Simpler implementation:** the server runs as one Armeria process on one port, with no Vert.x proxy in front. - About 410 lines go, including the transcoder and its 250-line test. - **Removes the unused `\^_` transcoding:** Unity Catalog has no nested namespaces, so rewriting `%1F` to `.` never made a request succeed. - **Fewer dependencies:** `vertx-core`, `vertx-web` and `vertx-web-client` are removed, so there are fewer libraries to patch for CVEs. - **No proxy pool to size:** the workarounds #1918 needed go away, i.e. matching the proxy pool to JDBC and answering `/livez` in front of it. - **Better tail latency under load:** cheap requests no longer queue for a shared HTTP/1.1 connection pool or run through a single Vert.x thread. - The saving per request is small, under a millisecond; the gain is mostly in p99 under concurrency. - **Fixes Datadog spans:** spans aren't closed properly, likely because the Datadog agent doesn't support the Vert.x transcoder, so they stay open until the client drops the idle connection about 30s later. - **No more hidden proxy behaviour:** request and response bodies are no longer held in memory, there are no unconfigurable timeouts, and the code that caused bugs #1716 and #1855 is gone. - **Real client addresses:** Armeria sees the caller's actual IP instead of `127.0.0.1`, which helps logging and metrics. - **HTTP/2 end to end:** HTTP/2 clients reach Armeria directly instead of being downgraded to HTTP/1.1. **Behavior changes** - The server listens on one API port. Nothing binds `port + 1` any more. - The API port is reachable from other machines again, as it was before #1750. Deployments that put a network policy in front of it are unaffected. - `GET /v1/catalogs/{c}/namespaces/a%1Fb` and `GET /v1/catalogs/{c}/namespaces?parent=a%1Fb` now return `404 NoSuchNamespaceException` instead of `400`. Neither form ever matched a schema. - The `hostname_pattern` label of `http_server_requests_total` now names the `-p` port (`*:8080` by default) instead of `port + 1` (`*:8081`). Dashboards or alerts that filter on `*:8081` need updating. - One fewer hop and one fewer HTTP/1.1 connection pool per request. HTTP/2 clients now reach Armeria directly. No REST API, property, or CLI changes. **Verification** - `build/sbt javafmtAll` - `build/sbt "server/testOnly io.unitycatalog.server.ArmeriaServerBuilderTest io.unitycatalog.server.UnityCatalogServerTest io.unitycatalog.server.UnityCatalogServerShutdownTest io.unitycatalog.server.EventLoopStallTest io.unitycatalog.server.service.IcebergRestCatalogTest"`: 42 tests. The first run had one `ServerPortBindException` on a random test port. `IcebergRestCatalogTest` then passed 26/26 on rerun. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Signed-off-by: s-maling-celonis <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR Checklist
docsis updatedDescription of changes
Fixes #1854.
The server reported itself started before the port clients use was listening.
mainawaited Armeria onport + 1and then deployed the Vert.x URL transcoder for the client-facing port without awaiting it, andURLTranscoderVerticle.start()returned as soon asserver.listenhad been called. A bind failure on that port was logged at INFO and dropped, sincedeployVerticle's result was never inspected, so the process kept running and exited 0 while serving nothing on the port every client connects to.The Python client suite hit the first half of this in CI (
1 failed, 34 passed, the failure being the first test to issue a request), because its fixture waits for the internal port and then talks to the client-facing one.Technical changes:
URLTranscoderVerticletakes thePromise<Void>form ofstartand completes it from thelistencallback, so the deployment completes only once the port is bound and fails with the bind error otherwise.UnityCatalogServer.mainwaits for that deployment and, if it fails, logs which port could not be bound, closes the server and rethrows. A server that cannot serve the port its clients use now exits non-zero instead of running half-up.clients/python/tests/conftest.py,tests/test_tutorial.py,tests/test_tarball_generation.py-- now probe the port those suites actually use. The fixedtime.sleepcalls that were masking the race in the latter two are left as they are; this change is about waiting for the right thing, not about retuning those waits.Testing:
URLTranscoderVerticleTest.testDeploymentFailsWhenTheTranscodePortIsTakenoccupies a port and asserts the deployment fails with aBindException. It fails on an unfixed tree, where the deployment reports success. The test class'sawaitPortpolling helper is gone: deployment now means the port is listening, which is what its comment used to work around.build/sbt "server/testOnly io.unitycatalog.server.URLTranscoderVerticleTest"andbuild/sbt -J-Xmx2G "server/test".HEAD /on the client-facing port answers 200, which is what the probes assert. With that port occupied by another process, the server now logsFailed to start the URL transcoder on port 8080, stops cleanly ("Unity Catalog server stopped.", pool cleanup) and exits 1, where before it stayed up on the internal port only.bin/start-uc-serverwith the updated fixture: it came up and ran in 9.7s (3 failed, 32 passed); the three failures arebin/ucinvocations, which need the CLI jar I had not built locally.Backward compatibility: a deployment that could not bind the client-facing port used to leave the process running; it now fails the startup. That is the point of the change -- such a server cannot serve any client -- but it is a behaviour change for anyone who was starting the server with that port already in use.