Skip to content

nextest: run test_many_concurrent alone - #65

Open
mostafa-yassine wants to merge 1 commit into
v0.9.30-shopify-patchesfrom
mostafayassine/nextest-isolate-test-many-concurrent
Open

mostafa-yassine wants to merge 1 commit into
v0.9.30-shopify-patchesfrom
mostafayassine/nextest-isolate-test-many-concurrent

Conversation

@mostafa-yassine

Copy link
Copy Markdown

Context

libsql-server connection::connection_core::test::test_many_concurrent runs 3 tasks x 1000 BEGIN IMMEDIATE transactions. Under cfg(test), TXN_TIMEOUT is 100 ms (libsql-server/src/connection/mod.rs:39) and libsql-sys sets a 100 ms SQLite busy timeout (libsql-sys/src/connection.rs:269). The test's own doc comment says: "If this test becomes flaky check out the lock stealing code."

Problem

The test fails with SqliteFailure(DatabaseBusy, "database is locked") at connection_core.rs:676, or times out at 60 s, whenever other test binaries compete for the runner's CPUs. nextest's schedule is deterministic for a given set of tests, so adding tests anywhere in the workspace can move it into a contended slot and make it fail on every retry.

Evidence from #62, which adds two unit tests to the libsql crate and touches nothing in libsql-server:

Solution

Add a nextest override that reserves all CPUs for this test (threads-required = 'num-cpus'). nextest then runs it with nothing else in flight. No change to the test or to lock stealing.

Testing

CI on this PR. After merge, #62 rebases onto it.

Under cfg(test) libsql-server sets TXN_TIMEOUT to 100 ms and libsql-sys sets
a 100 ms busy timeout. test_many_concurrent runs 3 tasks x 1000 BEGIN IMMEDIATE
against those limits, so it fails with DatabaseBusy whenever other test
binaries compete for CPU. nextest's schedule is deterministic for a given
test set, so adding any test elsewhere in the workspace can shift it into a
contended slot and make it fail on every retry (#62: 8 of 8 tries).

Reserve all CPUs for it so it never shares the runner.
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.

1 participant