Skip to content

Work around license scan timeout by scanning source-build-assets serially - #7626

Merged
mthalman merged 1 commit into
dotnet:mainfrom
mthalman:dev/mthalman/license-scan-mem-fix-main
Jul 9, 2026
Merged

mthalman merged 1 commit into
dotnet:mainfrom
mthalman:dev/mthalman/license-scan-mem-fix-main

Conversation

@mthalman

@mthalman mthalman commented Jul 9, 2026

Copy link
Copy Markdown
Member

The license scan pipeline has been failing frequently with a timeout. scancode deadlocks its multiprocessing pool at the end of a scan on the large, text-heavy source-build-assets content, causing the job to hang past its timeout.

Scan the affected content serially to avoid the deadlock:

  • Make the scancode --processes count pipeline-driven per matrix leg. An independent serialScanRepos list (source-build-assets) flows a process count of 0 through the matrix to the test, disabling scancode multiprocessing for those legs; all other repos use the test's default of 4.
  • Remove the --memory container cap in vmr-license-scan.yml so the scan is no longer memory-throttled.

Fixes dotnet/source-build#5470

…ally

The license scan pipeline has been failing frequently with a timeout.
scancode-toolkit 32.5.0 deadlocks its multiprocessing pool at the end of
a scan on the large, text-heavy source-build-assets content, causing the
job to hang past its timeout.

Scan the affected content serially to avoid the deadlock:
- Make the scancode --processes count pipeline-driven per matrix leg. An
  independent serialScanRepos list (source-build-assets) flows a process count
  of 0 through the matrix to the test, disabling scancode multiprocessing for
  those legs; all other repos use the test's default of 4.
- Remove the '--memory=12g' container cap in eng/pipelines/vmr-license-scan.yml
  so the scan is no longer throttled to 12 GB of host memory.

Co-authored-by: Copilot App <[email protected]>
Copilot AI review requested due to automatic review settings July 9, 2026 13:11
@mthalman
mthalman requested review from a team as code owners July 9, 2026 13:11

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adjusts the VMR license-scan pipeline and corresponding test harness to avoid scancode hangs/timeouts when scanning source-build-assets, by making scancode parallelism configurable per matrix leg and removing container memory throttling.

Changes:

  • Plumbs a pipeline-controlled LicenseScanProcessCount into Microsoft.DotNet.SourceBuild.Tests via runtime host configuration.
  • Updates LicenseScanTests to use a configurable scancode --processes value (defaulting to the prior behavior).
  • Removes the --memory=12g cap from the license-scan container and extends the matrix generation to carry per-repo process counts.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
test/Microsoft.DotNet.SourceBuild.Tests/Microsoft.DotNet.SourceBuild.Tests.csproj Adds a runtime config switch to pass the process count into tests.
test/Microsoft.DotNet.SourceBuild.Tests/LicenseScanTests.cs Uses the configured scancode process count when invoking scancode.
test/Microsoft.DotNet.SourceBuild.Tests/Config.cs Adds parsing for LicenseScanProcessCount from runtime config.
eng/pipelines/vmr-license-scan.yml Removes container memory limit option.
eng/pipelines/templates/stages/vmr-license-scan.yml Extends matrix to include per-repo process count and forwards it into dotnet test.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread test/Microsoft.DotNet.SourceBuild.Tests/LicenseScanTests.cs
Comment thread eng/pipelines/templates/stages/vmr-license-scan.yml

@ellahathaway ellahathaway left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Do you have a test pipeline run for these changes? I'm curious about how long scanning takes with this fix.

@mthalman

mthalman commented Jul 9, 2026

Copy link
Copy Markdown
Member Author

Do you have a test pipeline run for these changes? I'm curious about how long scanning takes with this fix.

https://dev.azure.com/dnceng/internal/_build/results?buildId=3017812&view=results

@mthalman
mthalman merged commit 331fbbd into dotnet:main Jul 9, 2026
11 checks passed
@mthalman
mthalman deleted the dev/mthalman/license-scan-mem-fix-main branch July 9, 2026 19:00
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.

License scanning timing out at 7 hrs for SBRP

3 participants