microsoft / microsoft/component-detection

CondaLock: Stack overflow issue in github actions

Open
#1,334 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C#
Stars
553
Forks
135
Avg merge
20h 58m
Merged PRs (30d)
6

Description

Summary:

A stack overflow occurs in the Microsoft.ComponentDetection.Detectors.CondaLock.CondaDependencyResolver module when processing conda-lock.yml file

Steps to Reproduce

  • In github actions, generate "conda-lock.yml" file
    conda-lock lock --file ./environment.yml --lockfile conda-lock.yml

  • Run component detection

      - name: Component detection
        uses: advanced-security/component-detection-dependency-submission-action@v0.0.4
        with:
          detectorArgs: CondaLock=EnableIfDefaultOff

Observed Error:

Running component-detection
/runner/_work/xyz/component-detection scan --SourceDirectory . --ManifestFile ./output.json --DetectorArgs CondaLock=EnableIfDefaultOff
[16:59:01 INF] Finding components...
[16:59:01 INF] No instructions received to scan docker images.
[16:59:01 INF] PipReport: No pip found on system. Pip installation report detection will not run.
[16:59:01 INF] Starting enumeration of /runner/_work/xyz/
[16:59:01 INF] Enumerated 173 files and 36 directories in 00:00:00.01[7](https://github.com/xyz/abc-/actions/runs/1248432454641/job/3484154561922#step:5:8)0189
Stack overflow.
   at System.Collections.Concurrent.ConcurrentDictionary`2[[System.__Canon, System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec[8](https://github.com/trdc/12484324641/actions/runs/1248432464ss1/job/34841561922#step:5:9)5d7bea7798e],[System.Byte, System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea77[9](https://github.com/edsx/sss-rrr/actions/runs/1248434524641/job/3484321561922#step:5:10)8e]]..ctor(Int32, Int32, Boolean, System.Collections.Generic.IEqualityComparer`1<System.__Canon>)
   at Microsoft.ComponentDetection.Contracts.DetectedComponent..ctor(Microsoft.ComponentDetection.Contracts.TypedComponent.TypedComponent, Microsoft.ComponentDetection.Contracts.IComponentDetector, System.Nullable`1<Int32>, System.Nullable`1<Int32>)
   at Microsoft.ComponentDetection.Detectors.CondaLock.CondaDependencyResolver.RegisterPackageWithDependencies(Microsoft.ComponentDetection.Detectors.CondaLock.Contracts.CondaPackage, System.String, Microsoft.ComponentDetection.Detectors.CondaLock.Contracts.CondaLock, Microsoft.ComponentDetection.Contracts.ISingleFileComponentRecorder)
   at Microsoft.ComponentDetection.Detectors.CondaLock.CondaDependencyResolver+<>c__DisplayClass2_0.<RegisterPackageWithDependencies>b__0(System.String)
   at System.Collections.Generic.List`1[[System.__Canon, System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].ForEach(System.Action`1<System.__Canon>)
   at Microsoft.ComponentDetection.Detectors.CondaLock.CondaDependencyResolver.RegisterPackageWithDependencies(Microsoft.ComponentDetection.Detectors.CondaLock.Contracts.CondaPackage, System.String, Microsoft.ComponentDetection.Detectors.CondaLock.Contracts.CondaLock, Microsoft.ComponentDetection.Contracts.ISingleFileComponentRecorder)
   at Microsoft.ComponentDetection.Detectors.CondaLock.CondaDependencyResolver+<>c__DisplayClass2_0.<RegisterPackageWithDependencies>b__0(System.String)
   at System.Collections.Generic.List`1[[System.__Canon, System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].ForEach(System.Action`1<System.__Canon>)
   at Microsoft.ComponentDetection.Detectors.CondaLock.CondaDependencyResolver.RegisterPackageWithDependencies(Microsoft.ComponentDetection.Detectors.CondaLock.Contracts.CondaPackage, System.String, Microsoft.ComponentDetection.Detectors.CondaLock.Contracts.CondaLock, Microsoft.ComponentDetection.Contracts.ISingleFileComponentRecorder)
   at Microsoft.ComponentDetection.Detectors.CondaLock.CondaDependencyResolver+<>c__DisplayClass2_0.<RegisterPackageWithDependencies>b__0(System.String)
   at System.Collections.Generic.List`1[[System.__Canon, System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].ForEach(System.Action`1<System.__Canon>)
   at Microsoft.ComponentDetection.Detectors.CondaLock.CondaDependencyResolver.RegisterPackageWithDependencies(Microsoft.ComponentDetection.Detectors.CondaLock.Contracts.CondaPackage, System.String, Microsoft.ComponentDetection.Detectors.CondaLock.Contracts.CondaLock, Microsoft.ComponentDetection.Contracts.ISingleFileComponentRecorder)
   at Microsoft.ComponentDetection.Detectors.CondaLock.CondaDependencyResolver+<>c__DisplayClass2_0.<RegisterPackageWithDependencies>b__0(System.String)
   at System.Collections.Generic.List`1[[System.__Canon, System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].ForEach(System.Action`1<System.__Canon>)`

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with CondaDependencyResolver.RegisterPackageWithDependencies, the recursive entry point named in the stack trace, and reproduce the failure using the supplied conda-lock.yml generation and GitHub Actions component-detection steps. Trace how package dependencies are registered and verify that scanning the lockfile completes without a stack overflow.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, github-actions
Domain
ci-cd, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.