Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WASM AOT compilation runs indefinitely and consumes all system memory with LanguageExt.Core #69166

Closed
Jack-Edwards opened this issue May 11, 2022 · 6 comments
Assignees
Labels
arch-wasm WebAssembly architecture area-Codegen-AOT-mono
Milestone

Comments

@Jack-Edwards
Copy link

Jack-Edwards commented May 11, 2022

Description

I am attempting to publish a Blazor WASM application with AOT compilation enabled. The step following the message AOT'ing ## assemblies will run indefinitely whenever the nuget package LanguageExt.Core is installed. Opening up Task Manager will reveal all available system memory (25 GB in my case) is being consumed by Visual Studio. In some cases, Task Manager will also report Disk Usage of 200+ MB/s.

Reproduction Steps

  1. Create a new Blazor WASM project using .NET 6.0.
  2. Add the nuget package LanguageExt.Core v4.1.0. You do not need to reference this project in any source files - just add the nuget.
  3. Publish the project with AOT compilation enabled.
  4. Observe, all available memory is consumed and the publish seems to run indefinitely.

Expected behavior

The publish should succeed or fail. The publish should consume a reasonable amount of memory.

Actual behavior

The publish appears to run indefinitely and consumes a crazy amount of system resources.

Regression?

I have used AOT compilation before in several projects. The issue only began to occur after incorporating this specific nuget package.

Known Workarounds

No response

Configuration

.NET SDK 6.0.300 (x64)
Visual Studio 2022 (64-bit) v17.2.0
Windows 10 Pro, v21H1, build 19043.1645

Other information

No response

@dotnet-issue-labeler
Copy link

I couldn't figure out the best area label to add to this issue. If you have write-permissions please help me learn by adding exactly one area label.

@ghost ghost added the untriaged New issue has not been triaged by the area owner label May 11, 2022
@radical radical added arch-wasm WebAssembly architecture area-Build-mono labels May 11, 2022
@ghost
Copy link

ghost commented May 11, 2022

Tagging subscribers to 'arch-wasm': @lewing
See info in area-owners.md if you want to be subscribed.

Issue Details

Description

I am attempting to publish a Blazor WASM application with AOT compilation enabled. The step following the message AOT'ing ## assemblies will run indefinitely whenever the nuget package LanguageExt.Core is installed. Opening up Task Manager will reveal all available system memory (25 GB in my case) is being consumed by Visual Studio. In some cases, Task Manager will also report Disk Usage of 200+ MB/s.

Reproduction Steps

  1. Create a new Blazor WASM project using .NET 6.0.
  2. Add the nuget package LanguageExt.Core v4.1.0. You do not need to reference this project in any source files - just add the nuget.
  3. Publish the project with AOT compilation enabled.
  4. Observe, all available memory is consumed and the publish seems to run indefinitely.

Expected behavior

The publish should succeed or fail. The publish should consume a reasonable amount of memory.

Actual behavior

The publish appears to run indefinitely and consumes a crazy amount of system resources.

Regression?

I have used AOT compilation before in several projects. The issue only began to occur after incorporating this specific nuget package.

Known Workarounds

No response

Configuration

.NET SDK 6.0.300 (x64)
Visual Studio 2022 (64-bit) v17.2.0
Windows 10 Pro, v21H1, build 19043.1645

Other information

No response

Author: Jack-Edwards
Assignees: -
Labels:

arch-wasm, untriaged, area-Build-mono

Milestone: -

@radical
Copy link
Member

radical commented May 11, 2022

mono-aot-cross is taking lot of time for LanguageExt.Core.dll, taking ~13G of resident memory.

cc @vargaz

@radical radical removed the untriaged New issue has not been triaged by the area owner label May 11, 2022
@vargaz vargaz self-assigned this May 11, 2022
@radical radical added this to the 7.0.0 milestone May 11, 2022
@vargaz
Copy link
Contributor

vargaz commented May 13, 2022

The input assembly has about 70k methods, makes heavy uses of generics and valuetypes, so the AOT compiler tries to generate too many generic instances, running out of memory.

I'd suggest not trying to use this assembly with wasm+aot, or wasm at all. Even if this problem is fixed, build speeds are still going to be very slow and the resulting app will going to be very large.

@Jack-Edwards
Copy link
Author

Understood. Thank you for looking into this. My main concern was the existence of a bug.

@radical
Copy link
Member

radical commented May 18, 2022

Please re-open if I closed this incorrectly.

@ghost ghost locked as resolved and limited conversation to collaborators Jun 17, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
arch-wasm WebAssembly architecture area-Codegen-AOT-mono
Projects
None yet
Development

No branches or pull requests

3 participants