Repository navigation
Description
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 awaitedURLTranscoderVerticle.start() calls server.listen(transcodePort, ar -> ...) and returns without waiting for the bind, so the deployment is complete before the socket exists. Two consequences:
- There is a window in which the internal port answers and the client-facing port refuses connections.
- 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.URLTranscoderVerticleTestdocuments 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 useIt 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
[Server] Wait for the client-facing port before reporting the server …