Skip to content

[Server] Give EventLoopStallTest room on slow machines - #2330

Merged
yili-db merged 2 commits into
unitycatalog:mainfrom
yili-db:stack/test_timeouts
Dec 2, 2026
Merged

yili-db merged 2 commits into
unitycatalog:mainfrom
yili-db:stack/test_timeouts

Conversation

@yili-db

@yili-db yili-db commented Nov 21, 2026 •

Copy link
Copy Markdown
Collaborator

🥞 Stacked PR

Use this link to review incremental changes.


  • EventLoopStallTest.stopWaitsForBlockedRequestAndExecutorRemainsActive failed in CI because the first request took more than 5s to reach its handler
    • Wait up to 30s for things that should happen: a request reaching its handler, a response, an executor task, the overlapping stream
    • Keep the timings that are assertions: the 3s window in which stop() must still be waiting, and the 300ms client timeout that must fire
  • Size the timeouts to those waits, on the test servers only (production defaults are unchanged)
    • Each held request raises its own request timeout (ServiceRequestContext.setRequestTimeout) above Armeria's 10s default, which would otherwise fail it with a 500
    • The clients' response timeout matches it
    • The shutdown test sets server.shutdown-timeout to 30s, as UnityCatalogServerShutdownTest does, instead of relying on the 5s default

Moved out of #2167 at review, to keep that PR to its test-isolation fixes. The waitForClockToPass deadline moved on to #2419.

Signed-off-by: Yi Li [email protected]

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

This pull request and its description were written by Isaac.

@timothyw553 timothyw553 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

left two comments on the server request and shutdown timeouts in EventLoopStallTest (which still cap things below 30s) and a couple nits. also might be cleaner to split the BaseModelCRUDTest clock change into its own PR.

WebClient client =
WebClient.builder("h2c://127.0.0.1:" + port).responseTimeoutMillis(5_000).build();
WebClient.builder("h2c://127.0.0.1:" + port)
.responseTimeoutMillis(TimeUnit.SECONDS.toMillis(WAIT_SECONDS))

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we're bumping the client timeout and waits to 30s here (and in the other two tests below), but armeria's server request timeout is still the 10s default. if a slow machine stalls past 10s (including the 3s hold in the shutdown test), won't the server fail the request with 500 before our 30s wait finishes? could we set an explicit request timeout on these test servers and size the client timeout to cover the whole sequence, while keeping production defaults unchanged? also curious what caused the original startup delay.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[AI Assisted] Good catch: with only the client and waits raised, a request held past 10s gets a 500 from Armeria's default request timeout. I confirmed that with a throwaway probe: a 12s hold returned 500 by default and 200 with the timeout raised.

ArmeriaServerBuilder has no request-timeout setting, so rather than add one to production code for a test, each held request now raises its own timeout before it blocks (ServiceRequestContext.setRequestTimeout(TimeoutMode.SET_FROM_START, REQUEST_TIMEOUT) in the new hold helper). REQUEST_TIMEOUT is 90s, three times WAIT_SECONDS, which covers every wait a held request goes through in a test, and the clients' responseTimeoutMillis use the same value. Production defaults are unchanged.

On the original delay: the CI log does not say. The test was the first in the class and failed after 7.1s, of which 5s was waiting for the first request to reach the handler; there was no error, just slowness. The later tests in the class took about 2s each. My best guess is first-request warm-up (class loading under JaCoCo instrumentation) on a runner busy with other test JVMs, but I could not confirm it.


release.countDown();
assertThat(response.get(5, TimeUnit.SECONDS).status()).isEqualTo(HttpStatus.OK);
assertThat(response.get(WAIT_SECONDS, TimeUnit.SECONDS).status()).isEqualTo(HttpStatus.OK);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

waiting 30s for the response here won't help if the server still has its default 5s shutdown timeout. after stop() and the 3s wait there's only ~2s left before shutdown aborts the request, so could we set Property.SHUTDOWN_TIMEOUT explicitly in this test like UnityCatalogServerShutdownTest does?

+    Properties properties = new Properties();
+    properties.setProperty(
+        Property.SHUTDOWN_TIMEOUT.getKey(), "PT" + WAIT_SECONDS + "S");
     ArmeriaServerBuilder builder =
         new ArmeriaServerBuilder(
             findAvailablePort(),
             "/api/",
             "/control/",
-            new ServerProperties(new Properties()),
+            new ServerProperties(properties),
             blockingTaskExecutor);

yili-db added a commit that referenced this pull request Nov 30, 2026
…2167)

## 🥞 Stacked PR
Use this
[link](https://github.com/unitycatalog/unitycatalog/pull/2167/files) to
review incremental changes.
-
[stack/run_test_followups](#2167)
[[Files
changed](https://github.com/unitycatalog/unitycatalog/pull/2167/files)]

---------
- Stop `BaseCredRenewITTest` from starting two servers per test
- Its own `@BeforeEach beforeEach()` called `super.setUp()` after JUnit
had already run the inherited `setUp()`, and the first server was never
closed
  - Override `setUp()` instead
- `BaseServerTest.setUp()` now fails if a server is already running, so
the pattern cannot return silently; `UnityCatalogServerTest` checks that
- Drop `REPLACE_EXISTING` from the signing-key copy, which only
tolerated the second call
- Fail CI when tests write to `etc/conf`
- A server built without its own `configurationFolder` writes its
signing keys, `certs.json` and `token.txt` there; two tests added on
`main` while #2159 was open did exactly that
- `project/scripts/check_etc_conf.sh` fails if any `etc/conf` differs
from the checkout: a new file, ignored or not, or an edited or deleted
tracked one
- `run-uc-unit-tests` runs it after the tests, next to the
clean-checkout step from #2334, which skips ignored files such as the
generated keys; `upgrade-tests.yml` runs it after the upgrade tests
- A fresh CI checkout has only tracked files there, so a local server
cannot cause a false failure
- Give `migrate/TestServer`, used by `RealUpgradeTest` and
`SchemaGateTest`, its own `configurationFolder`
- Give the three server builds in the OPA tests of
`UnityCatalogServerTest` (#2078) their own `configurationFolder`; CI
failed this check on them
- `project/tests/test_check_etc_conf.py`, run in the "Build Test" job,
checks the script in a throwaway git repository, including a deleted
tracked file
- `dev/run-tests.py` watches every `etc/conf` locally, at the root and
in modules up to two levels deep, including hidden files and
subdirectories; `test_run_tests.py` checks it

Tested with `dev/run-tests.py` on `main` at #2357: 240 suites, 3971
tests, 0 failures; afterwards the checkout was clean and
`check_etc_conf.sh` found nothing.
`RealUpgradeTest.upgradesAndKeepsTheData` passed with
`UC_TEST_UPGRADES=true`. With the old `beforeEach()` pattern restored,
every `AwsCredRenewITTest` test fails with the new `setUp()` message.

The test timeout changes that were here moved to #2330.

Signed-off-by: Yi Li <[email protected]>

**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!
- [ ] If you've added or modified a feature, documentation in `docs` is
updated

**Description of changes**

<!-- Please state what you've changed and how it might affect the users.
-->

This pull request and its description were written by Isaac.

---------

Signed-off-by: Yi Li <[email protected]>
Co-authored-by: Isaac <[email protected]>
yili-db and others added 2 commits December 2, 2026 08:24
…waitForClockToPass`

- `EventLoopStallTest.stopWaitsForBlockedRequestAndExecutorRemainsActive` failed in CI because the first request took more than 5s to reach its handler
  - Wait up to 30s for things that should happen: a request reaching its handler, a response, an executor task, the overlapping stream
  - Keep the timings that are assertions: the 3s window in which `stop()` must still be waiting, and the 300ms client timeout that must fire
- `BaseModelCRUDTest.waitForClockToPass` fails after 5s instead of spinning forever if the clock never passes the timestamp

Co-authored-by: Isaac <[email protected]>
Signed-off-by: Yi Li <[email protected]>
…StallTest`

- Raise each held request's own timeout with `ServiceRequestContext.setRequestTimeout`.
  - Armeria's 10s default would otherwise fail a request held through the 30s waits.
  - Production defaults are unchanged.
- Size the clients' response timeout to the same `REQUEST_TIMEOUT`.
- Set `server.shutdown-timeout` in `stopWaitsForBlockedRequestAndExecutorRemainsActive`, so `stop()` outlasts the waits.
- Move the `waitForClockToPass` deadline in `BaseModelCRUDTest` to its own PR.

Co-authored-by: Isaac <[email protected]>
Signed-off-by: Yi Li <[email protected]>
@yili-db
yili-db force-pushed the stack/test_timeouts branch from ce71443 to a0b2339 Compare December 2, 2026 08:31
@yili-db yili-db changed the title [Server] Give EventLoopStallTest room on slow machines, and bound waitForClockToPass [Server] Give EventLoopStallTest room on slow machines Dec 2, 2026
@yili-db

yili-db commented Dec 2, 2026

Copy link
Copy Markdown
Collaborator Author

[AI Assisted] Split the BaseModelCRUDTest clock change into #2419, so this PR is now only EventLoopStallTest.

@yili-db
yili-db requested a review from timothyw553 December 2, 2026 08:33

@timothyw553 timothyw553 left a comment •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. thanks for splitting out #2419 and setting the shutdown timeout explicitly. nothing new from me, please just resolve any open threads.

@yili-db
yili-db merged commit ad792d5 into unitycatalog:main Dec 2, 2026
23 checks passed
yili-db added a commit that referenced this pull request Dec 2, 2026
…ds (#2419)

## 🥞 Stacked PR
Use this
[link](https://github.com/unitycatalog/unitycatalog/pull/2419/files) to
review incremental changes.
-
[stack/clock_deadline](#2419)
[[Files
changed](https://github.com/unitycatalog/unitycatalog/pull/2419/files)]

---------
- `BaseModelCRUDTest.waitForClockToPass` spins until
`System.currentTimeMillis()` passes a timestamp. If the wall clock steps
backwards (for example an NTP correction), it spins until the CI job
times out, with no hint of why.
- It now fails after 5s, naming the timestamp; the deadline uses
`System.nanoTime()`, which does not step.
- Split out of #2330 at review, to keep that PR to `EventLoopStallTest`.

Tested with `SdkModelCRUDTest` and `CliModelCRUDTest`.

Signed-off-by: Yi Li <[email protected]>

**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.
- [ ] 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**

<!-- Please state what you've changed and how it might affect the users.
-->

This pull request and its description were written by Isaac.

Signed-off-by: Yi Li <[email protected]>
Co-authored-by: Isaac <[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