Repository navigation
test(python): give each RFC-0003 concurrency worker its own client - #392
Merged
Merged
Conversation
The four RFC-0003 §4 stress tests drive the server from 50 threads through the session-scoped boto3 client. A boto3 client is not safe for concurrent use: two threads interleaving on one of its TLS connections corrupt the record stream, and the request fails with botocore.exceptions.SSLError: SSL validation failed ... [SSL: TLSV1_ALERT_DECODE_ERROR] tlsv1 alert decode error which looks like a server fault and is not. It fired on the MongoDB leg of #382, a pull request that touches only the PostgreSQL transaction path; the rerun passed. The client construction moves from the conftest fixture into `helpers.make_dynamodb_client`, the fixture calls it, and the four tests take a `thread_client` fixture that builds one client per worker thread, lazily, in a `threading.local`. Setup and verification on the main thread keep using the session client. Run three times against a PostgreSQL server built from main: 4 passed each time. Signed-off-by: Scott Robinson <robinnsc@amazon.com>
robinnsc
requested review from
LeeroyHannigan,
amrith,
c33howard,
jcshepherd,
pdf-amzn and
yesyayen
as code owners
October 7, 2026 03:01
jcshepherd
approved these changes
Oct 8, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
The four RFC-0003 §4 stress tests in
tests/python/test_rfc0003_concurrency.pydrove the server from 50 threads through the session-scoped boto3 client. Each worker thread now builds its own client, lazily, through a newthread_clientfixture backed by athreading.local. Setup and verification on the main thread keep using the session client.The client construction moves from the
dynamodb_clientfixture intests/python/conftest.pyintohelpers.make_dynamodb_client; the fixture calls it, so the per-thread clients are configured identically (no SDK retries, same endpoint and CA handling).Why
No issue filed. A boto3 client is not safe for concurrent use: two threads interleaving on one of its TLS connections corrupt the record stream, and the request fails with
which looks like a server fault and is not. It fired on the MongoDB leg of #382 (run 37561439534,
test_all_increments_apply), a pull request that touches only the PostgreSQL transaction path; the rerun passed. The repo's other thread-pool test,tests/test_concurrency.py, already uses a per-thread_make_client()for this reason.Testing done
Against a PostgreSQL server built from main,
tests/python/test_rfc0003_concurrency.pyrun three times: 4 passed each time. Collection withDYNAMODB_ENDPOINTset succeeds (thehelpersimport path is the one the file already used;from conftest importwould have resolved totests/conftest.pyfrom the repo root).No Rust change; no cargo commands apply.
Checklist
cargo test --workspace) — n/a, Python test change onlycargo fmt --check) — n/acargo clippy -- -W clippy::pedantic) — n/aStoragetrait, auth model, on-disk format, or public CLI surface, an RFC has been accepted or is linked below. Otherwise, an ADR captures the decision (link below).ADR / RFC: n/a. Test-only change.
Breaking changes
None.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache License 2.0 and I agree to the Developer Certificate of Origin (DCO). See CONTRIBUTING.md for details.