Skip to content

GenerateDepsFile allocates 25GB of heap on large project #48814

@pavelsavara

Description

@pavelsavara
Member

When building dotnet runtime on CI, we run OOM on WASM legs.

Top offenders are

  • GenerateDepsFile is at 25GB over 1056 runs on the same build. 😮
  • ValidateAssembliesTask 0.5GB over 59 runs
  • ResolveRuntimePackAssets 0.4GB over 451 runs

The issue was identified by using new MSBuild telemetry

It would be good to fix the root cause (memory consumption) in those Tasks.
I believe that customers with large solutions could suffer with the same problems.

Workaround

We applied workaround to run those tasks out-of-process for WASM leg.

See https://github.com/dotnet/runtime/blob/43955cb086eb88dbe78f1764c21dd3362a2427ee/src/mono/browser/build/WasmApp.InTree.CI.targets#L3-L5

Activity

dotnet-policy-service

dotnet-policy-service commented on May 5, 2025

@dotnet-policy-service
Contributor

Thanks for creating this issue! We believe this issue is related to NuGet tooling, which is maintained by the NuGet team. Thus, we closed this one and encourage you to raise this issue in the NuGet repository instead. Don’t forget to check out NuGet’s contributing guide before submitting an issue!

If you believe this issue was closed out of error, please comment to let us know.

Happy Coding!

baronfel

baronfel commented on May 5, 2025

@baronfel
Member

Bad bot.

added this to the 10.0.1xx milestone on May 6, 2025
Forgind

Forgind commented on May 7, 2025

@Forgind
Contributor

@pavelsavara, are there logs I can look at telling me where in GenerateDepsFile the 25GB were allocated?

pavelsavara

pavelsavara commented on May 7, 2025

@pavelsavara
MemberAuthor

@Forgind you can delete workarounds/overrides in src/mono/browser/build/WasmApp.InTree.CI.targets of the runtime repo and run the same that the CI pipeline does for WASM on linux.

build.sh -ci -arch wasm -os browser  -s mono+libs+host+packs+libs.tests -c Release /p:ArchiveTests=true /p:MonoEnableAssertMessages=true /p:BrowserHost=linux /p:RunSmokeTestsOnly=False /p:InstallChromeForTests=true /p:InstallFirefoxForTests=true  /maxcpucount:1 /p:AotHostArchitecture=x64 /p:AotHostOS=linux

I think that the binlong would not be much different from this random one from yesterday.

There is nothing specific in the binlog, unless you also enable the new telemetry. And that only marks the Task as the guilty party.

We don't know what's the allocation distribution either. Is that one/few specific projects which cause that ? Or that's evenly distributed problem ?

I think the next step is to do GC heap dump on the msbuild before and after running GenerateDepsFile once.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

    Development

    Participants

    @pavelsavara@baronfel@marcpopMSFT@Forgind

    Issue actions

      GenerateDepsFile allocates 25GB of heap on large project · Issue #48814 · dotnet/sdk