Avoid random generator races in concurrent Storage tests - #7305
Merged
JinmingHu (Jinming-Hu) merged 2 commits intoAug 10, 2026
Conversation
Generate resource names on the test thread before launching async work so StorageTest's non-thread-safe random helpers are not called concurrently. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
Azure Pipelines: Successfully started running 1 pipeline(s). 9 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
JinmingHu (Jinming-Hu)
marked this pull request as ready for review
August 8, 2026 01:03
Member
Author
|
/azp run cpp - storage |
|
Azure Pipelines: Successfully started running 1 pipeline(s). 9 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
|
Azure Pipelines: Successfully started running 1 pipeline(s). |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates Azure Storage unit tests to avoid calling non-thread-safe StorageTest random helpers from concurrent worker threads, preventing filename/blob-name collisions and race conditions during stress/concurrency runs.
Changes:
- Pre-generate per-worker download-to-file temporary filenames on the main thread before launching
std::asyncworkers (Blobs, Data Lake, File Shares). - Pre-generate structured-message blob names before launching concurrent blob workers.
- Replace per-thread
RandomString()file naming with deterministicworkerIndex-fileIndexnaming in the disabled Data Lake pagination stress test.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| sdk/storage/azure-storage-files-shares/test/ut/share_file_client_test.cpp | Passes a pre-generated temp filename into the async download-to-file worker to avoid thread-unsafe random calls. |
| sdk/storage/azure-storage-files-datalake/test/ut/datalake_path_client_test.cpp | Uses deterministic per-worker/per-file names to avoid concurrent RandomString() usage in a disabled stress test. |
| sdk/storage/azure-storage-files-datalake/test/ut/datalake_file_client_test.cpp | Moves temp filename generation out of the async worker by passing it as an argument. |
| sdk/storage/azure-storage-blobs/test/ut/block_blob_client_test.cpp | Moves temp filename and structured-message blob-name generation out of concurrent workers to avoid random-helper races. |
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Anton Kolesnyk (antkmsft)
approved these changes
Aug 10, 2026
JinmingHu (Jinming-Hu)
deleted the
stgxx_fix_concurrent_test_random_races
branch
August 10, 2026 21:21
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.
Purpose
Avoid calling
StorageTestrandom helpers from concurrent test workers. These helpers are explicitly not thread-safe and can generate conflicting local filenames or resource names under load.Changes
Validation
azure-storage-blobs-test,azure-storage-files-datalake-test, andazure-storage-files-shares-testin Release.BlockBlobClientTest.ConcurrentDownload_LIVEONLY_BlockBlobClientTest.StructuredMessageTest_Concurrent_LIVEONLY_DataLakeFileClientTest.ConcurrentDownload_LIVEONLY_FileShareFileClientTest.ConcurrentDownload_LIVEONLY_