Skip to content

Bind the backend server to loopback interfaces - #1750

Merged
yili-db merged 1 commit into
unitycatalog:mainfrom
timothyw553:fix/backend-loopback-bind
Aug 6, 2026
Merged

yili-db merged 1 commit into
unitycatalog:mainfrom
timothyw553:fix/backend-loopback-bind

Conversation

@timothyw553

@timothyw553 timothyw553 commented Aug 3, 2026 •

Copy link
Copy Markdown
Collaborator

PR Checklist

  • 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.
  • If you've fixed a bug or added code that should be tested, add tests!
  • If you've added or modified a feature, documentation in docs is updated

Description of changes

The backend HTTP server is meant to receive requests only from the URL transcoder running on the same machine.

Before this change, the backend listened on every network interface. For example, another machine on the same network could try to connect directly to the backend port instead of going through the URL transcoder.

This change binds the backend to loopback interfaces only. The URL transcoder can still reach it, but other machines cannot connect to that port.

A new test checks that every backend listener uses a loopback address. The existing URL transcoder tests still pass.

Tests: sbt -batch javafmtCheckAll and sbt -batch "server/testOnly io.unitycatalog.server.ArmeriaServerBuilderTest io.unitycatalog.server.URLTranscoderVerticleTest"

@yili-db
yili-db merged commit b4dc8f7 into unitycatalog:main Aug 6, 2026
16 checks passed
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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants