Skip to content

[Server] The server reports itself started before the client-facing port is listening #1854

Closed

Description

@moomindani

Describe the bug

The server reports itself started before the port clients actually use is listening, and the test harnesses wait on the wrong port, so a suite that talks to the server immediately can fail with a connection refused.

UnityCatalogServer.main starts Armeria on port + 1, waits for it, and then deploys the Vert.x URL transcoder that serves the port clients connect to:

unityCatalogServer.start();          // Armeria, port + 1 -- awaited
Vertx vertx = Vertx.vertx();
Verticle transcodeVerticle = new URLTranscoderVerticle(options.getPort(), options.getPort() + 1);
vertx.deployVerticle(transcodeVerticle);   // client-facing port -- not awaited

URLTranscoderVerticle.start() calls server.listen(transcodePort, ar -> ...) and returns without waiting for the bind, so the deployment is complete before the socket exists. Two consequences:

  1. There is a window in which the internal port answers and the client-facing port refuses connections.
  2. If the client-facing port cannot be bound at all, the failure is logged at INFO and dropped -- deployVerticle's result is never inspected -- so the process keeps running, exits 0 on shutdown, and serves nothing on the port every client uses. URLTranscoderVerticleTest documents the first half of this in a helper comment: "The verticle binds its port asynchronously, so wait for it before sending any request."

The Python client suite hits window 1 in CI. Its fixture waits for the internal port and then talks to the client-facing one:

response = requests.head("http://localhost:8081", timeout=60)   # internal
...
config = Configuration(host="http://localhost:8080/api/2.1/unity-catalog")   # what the tests use

It failed exactly that way on a recent run: 1 failed, 34 passed, the one failure being the first test to issue a request.

FAILED clients/python/tests/test_catalog.py::test_catalog_list - aiohttp.client_exceptions.ClientConnectorError:
Cannot connect to host localhost:8080 ssl:default [Multiple exceptions: [Errno 111] Connect call failed ('::1', 8080, 0, 0),
[Errno 111] Connect call failed ('127.0.0.1', 8080)]

tests/test_tutorial.py and tests/test_tarball_generation.py check the same internal port and print "Server is running."; they are shielded only by fixed time.sleep(60) / time.sleep(15) calls that precede the probe.

To Reproduce

Start the server, and while Armeria is up but the transcoder has not bound yet, request the client-facing port. For the dropped-failure half, occupy port 8080 with another process and start the server: it logs the bind failure at INFO, keeps running with only 8081, and reports success.

Expected behavior

Deploying the transcoder should complete only once its port is listening, a bind failure there should stop the server rather than leave it serving only the internal port, and a readiness probe should test the port the client will use.

Activity

  1. added a commit that references this issue on Sep 10, 2026
    23a0936
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions