You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Rust: Extract files in parallel following CODEQL_THREADS - #23324
↑ Source TRAP and archives byte-identical at --threads 1 vs 8 on hello-workspace, a broken/loose-file project and dependency-features. ↑ New parallel-extraction test: cross-file calls, macro expansion and extraction steps identical at 1 and 4 threads in a local replay; dependency-features also runs both. ↑ The 10,000-term deep input runs only at 2 threads, so it stays on 16 MiB workers and off the 1 MiB Windows main thread. ↑ Worker stack overflow reproduced and fixed; the unit test aborts with a 2 MiB stack or when a single-item batch runs inline. ↑ Extractor unit tests now run in the rust-code CI job. ↑ CI green at 87d0e8a, including integration tests on all platforms. ↓ CI pending at this head. Earlier heads failed because the call query also ran over the deep input; that input now has its own test directory. ↓ .expected files written from a manual replay, not the pytest harness. ↓ Abort on worker spawn failure untested; no per-layer timing.
Second layer of the Rust extractor performance stack (on top of #23323). Extracts files in parallel, following the CLI's --threads (CODEQL_THREADS).
Each worker thread has its own Extractor and Semantics over a clone of the loaded database. The VFS, archiver and TRAP provider are shared, and worker steps are merged into the main extractor.
Applies to both the per-workspace source/dependency loop and the dependency-feature selection loop. The feature-selection bookkeeping (has_alternative/extracted) stays on the main thread, and results come back in input order.
The thread count is parsed with the shared parse_codeql_threads. Unlike the extractor spec default of -1, extraction stays sequential when CODEQL_THREADS is unset or invalid. With one thread everything runs on the current thread.
Workers get a 16 MiB stack, as rust-analyzer does: the default 2 MiB overflows on deeply nested code.
Per-step telemetry durations are summed across threads, so they can exceed the total.
If a worker panics, the other workers stop taking new files and the panic is re-raised.
Input files are deduplicated, because TRAP and archive writes for the same file must not run concurrently.
Crate-graph TRAP is unchanged. Its cfg-option order varies between runs, even sequential ones.
Each worker uses its own `Semantics` over a clone of the loaded database.
Extraction stays sequential when `CODEQL_THREADS` is unset or invalid.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The default 2 MiB stack overflowed on deeply nested expressions that
extract fine on the main thread. Also test dependency features and a deep
expression with multiple threads, and make the panic test schedule-proof.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
Automated tests do not verify multi-file semantic results across thread counts or confirm that the deep-expression fixture is actually extracted using the worker stack.
No open issues 🎉
2 previously missed issues
In code that hasn't changed since last review
Test concurrent cross-file resolution and macro expansion
rust/extractor/src/main.rs:367
Please add an automated 1-versus-4-thread semantic-results test for a workspace with multiple source files. Each workspace in dependency-features has only one source file, so its source loop runs inline, while deep-expression checks only database creation. Consequently neither test checks cross-file resolution or macro expansion when source files are actually processed concurrently.
Assert deep workspace files are extracted by worker stack
This only checks that database creation succeeds, so it also passes if deep.rs is skipped or the workspace falls back to sequential extraction. Please assert that deep.rs and another file were loaded with semantics and extracted, for example via ExtractorStep query results, so the test actually exercises the worker stack.
Replace the deep-expression test with a workspace whose files call each
other and use a macro, comparing calls and extraction steps at 1 and 4
threads.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Run the deep-expression check in its own test at two threads, so it never
runs on the main thread (1 MiB on Windows), and so the call-parity query no
longer type-checks 10,000 additions.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Every query in a test directory runs for each test there, so the deep input
also went through the call query. Give it a directory with just the
extraction step query.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
A one-item batch was clamped to one thread and ran inline, missing the large
worker stack. Only run inline when one thread is requested.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
Human assessment is needed because the tests do not cover repeated or aliased input paths, leaving deduplication safeguards against concurrent output writes unverified.
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
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.
Agent assessment
Self-reported assessment, not an independent review.
Assessed revision:
592a6fb66a9f43655b98d91ba97c12422dc597e3--threads 1vs8on hello-workspace, a broken/loose-file project and dependency-features.↑ New
parallel-extractiontest: cross-file calls, macro expansion and extraction steps identical at 1 and 4 threads in a local replay; dependency-features also runs both.↑ The 10,000-term deep input runs only at 2 threads, so it stays on 16 MiB workers and off the 1 MiB Windows main thread.
↑ Worker stack overflow reproduced and fixed; the unit test aborts with a 2 MiB stack or when a single-item batch runs inline.
↑ Extractor unit tests now run in the
rust-codeCI job.↑ CI green at 87d0e8a, including integration tests on all platforms.
↓ CI pending at this head. Earlier heads failed because the call query also ran over the deep input; that input now has its own test directory.
↓
.expectedfiles written from a manual replay, not the pytest harness.↓ Abort on worker spawn failure untested; no per-layer timing.
Second layer of the Rust extractor performance stack (on top of #23323). Extracts files in parallel, following the CLI's
--threads(CODEQL_THREADS).ExtractorandSemanticsover a clone of the loaded database. The VFS, archiver and TRAP provider are shared, and worker steps are merged into the main extractor.has_alternative/extracted) stays on the main thread, and results come back in input order.parse_codeql_threads. Unlike the extractor spec default of-1, extraction stays sequential whenCODEQL_THREADSis unset or invalid. With one thread everything runs on the current thread.Crate-graph TRAP is unchanged. Its cfg-option order varies between runs, even sequential ones.