Skip to content

Prove concurrent API reads with a barrier instead of timings - #435

Merged
nicosuave merged 2 commits into
mainfrom
concurrency-test-timing
Oct 20, 2026
Merged

nicosuave merged 2 commits into
mainfrom
concurrency-test-timing

Conversation

@nicosuave

@nicosuave nicosuave commented Oct 20, 2026 •

Copy link
Copy Markdown
Member

test_concurrent_reads_do_not_serialize asserted that 4 concurrent requests finished within 2.5x a single request's wall time. On loaded CI runners that ratio regularly blew past the bound even though reads were concurrent (e.g. 843ms vs a 250ms budget), so it failed in most recent runs.

The test now sends 4 concurrent /raw queries that call a DuckDB Python UDF which waits on a barrier until all 4 queries are executing inside DuckDB at once. Reads serialized anywhere (an app lock, a lock-wrapped cursor like the base adapter fallback, or one shared connection) can never all arrive, so the barrier times out and the test fails; concurrent reads pass regardless of runner speed.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 20, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-20T16:52:14.804039Z 38cd5e5 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 38cd5e5b1b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread tests/server/test_concurrency.py Outdated
self._barrier = barrier

def execute(self, *args, **kwargs):
self._barrier.wait()

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Move the barrier inside the serialization boundary

This rendezvous occurs before calling the real cursor's execute, so it only proves that four requests reached the proxy concurrently. If adapter.cursor() returns distinct cursor wrappers that serialize through a shared internal lock—as BaseDatabaseAdapter.cursor() does—all four calls pass this barrier, then execute one at a time; the identity assertion also passes because the wrappers are distinct. The test therefore accepts the exact shared-connection serialization regression it claims to detect.

Useful? React with 👍 / 👎.

@nicosuave
nicosuave merged commit ac92c34 into main Oct 20, 2026
27 checks passed
@nicosuave
nicosuave deleted the concurrency-test-timing branch October 20, 2026 18:12
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