Skip to content

[wasm][aot] Link step failing for Microsoft.Extensions.Logging.Generators.Roslyn3.11.Tests - wasm-opt getting killed #51961

Description

@radical

System.Text.Json.Tests

Microsoft.Extensions.Logging.Generators.Roslyn3.11.Tests, log

emcc : error : '/datadisks/disk1/work/B7A309CE/p/build/emsdk/upstream/bin/wasm-opt --post-emscripten --no-exit-runtime -O2 --low-memory-unused --zero-filled-memory --strip-producers /datadisks/disk1/work/B7A309CE/w/B09909A9/e/wasm_build/obj/wasm/for-build/dotnet.wasm -o /datadisks/disk1/work/B7A309CE/w/B09909A9/e/wasm_build/obj/wasm/for-build/dotnet.wasm -g --mvp-features --enable-mutable-globals'
   failed (received SIGKILL (-9)) [/datadisks/disk1/work/B7A309CE/w/B09909A9/e/publish/ProxyProjectForAOTOnHelix.proj]
[ 2582.708542] oom-kill:constraint=CONSTRAINT_NONE,nodemask=(null),cpuset=/,mems_allowed=0,global_oom,task_memcg=/system.slice/helix.service,task=wasm-opt,pid=19587,uid=1000
[ 2582.708558] Out of memory: Killed process 19587 (wasm-opt) total-vm:7377176kB, anon-rss:7254096kB, file-rss:0kB, shmem-rss:0kB, UID:1000 pgtables:14340kB oom_score_adj:0
[ 2582.925546] oom_reaper: reaped process 19587 (wasm-opt), now anon-rss:0kB, file-rss:0kB, shmem-rss:0kB

The binlog should have details of why this failed. The binlog is included in the helix data.

Activity

  1. ghost added
    untriagedNew issue has not been triaged by the area owner
    on Apr 27, 2021
  2. removed
    untriagedNew issue has not been triaged by the area owner
    on Apr 28, 2021
  3. added this to the 6.0.0 milestone on Apr 28, 2021
  4. vargaz commented on May 6, 2021

    @vargaz
    Contributor

    This probably happens because the code is just too big.

  5. radical commented on Jun 10, 2021

    @radical
    MemberAuthor

    The current failure:

             cache:INFO:  - ok
              "/datadisks/disk1/work/A6A60972/p/build/emsdk/upstream/bin/wasm-ld" @/datadisks/disk1/work/A6A60972/t/emscripten_fqv4w7nk.rsp
         1>emcc : error : '/datadisks/disk1/work/A6A60972/p/build/emsdk/upstream/bin/wasm-ld @/datadisks/disk1/work/A6A60972/t/emscripten_fqv4w7nk.rsp' failed (-9) [/datadisks/disk1/work/A6A60972/w/A34508DD/e/publish/AOTTestProjectForHelix.proj]
         1>/datadisks/disk1/work/A6A60972/p/build/wasm/WasmApp.Native.targets(278,5): error MSB3073: The command "emcc "@/datadisks/disk1/work/A6A60972/p/build/microsoft.netcore.app.runtime.browser-wasm/runtimes/browser-wasm/native/src/emcc-default.rsp" "@/datadisks/disk1/work/A6A60972/w/A34508DD/e/wasm_build/obj/wasm/emcc-link.rsp"" exited with code 1. [/datadisks/disk1/work/A6A60972/w/A34508DD/e/publish/AOTTestProjectForHelix.proj]
         1>Done Building Project "/datadisks/disk1/work/A6A60972/w/A34508DD/e/publish/AOTTestProjectForHelix.proj" (default targets) -- FAILED.
    
  6. changed the title [-][wasm][aot] `wasm-opt` fails for `System.Text.Json.Tests`[/-] [+][wasm][aot] `wasm-ld` fails for `System.Text.Json.Tests`[/+] on Jun 15, 2021
  7. lewing commented on Jun 28, 2021

    @lewing
    Member

    This should be fixed by #53603 and the flto changes

  8. ghost locked as resolved and limited conversation to collaborators on Jul 28, 2021
  9. 27 remaining items

  10. directhex commented on Jan 20, 2022

    @directhex
    Contributor

    Okay. Findings:

    • The job in question runs on Helix on a bare D2a_v4 Azure VM (2 cores of AMD Epyc, 8GB RAM)
    • Serializing the build, and using a less-memory-intensive compiler optimization level are about the best we can do to reduce the memory usage, and we already do them
    • The Clang compile stage requires 7.8 gig of RAM. If it's failing on the clang step in CI, then other basic OS stuff on the VM is likely using enough RAM that Clang can't get the 7.8 gig it wants
    • The final step of the build, the call to wasm-opt, requires more memory than Clang - 8.5 gig.
    • Swap exists 😬
  11. vargaz commented on Jan 20, 2022

    @vargaz
    Contributor

    The problem is AOTing roslyn, a linked Microsoft.CodeAnalysis.CSharp.dll still contains 30k methods, AOT creates 80k methods out of this because roslyn contains a lot of valuetypes causing a lot of generic instances to be added, running the aot compiler on this assembly alone takes 40 seconds, the .bc -> .o step takes 10 minutes (!).

  12. vargaz commented on Jan 20, 2022

    @vargaz
    Contributor

    We might want to add some functionality to the build system to exclude certain assemblies like roslyn from AOTing.

  13. radical commented on Jan 20, 2022

    @radical
    MemberAuthor

    We might want to add some functionality to the build system to exclude certain assemblies like roslyn from AOTing.

    We do have that, as a hack (https://github.com/dotnet/runtime/blob/main/src/tasks/AotCompilerTask/MonoAOTCompiler.cs#L488-L489).

  14. directhex commented on Jan 20, 2022

    @directhex
    Contributor

    So what's the play, try to shoehorn the test as-is onto Helix, or try to wire up the AOT skip?

  15. vargaz commented on Jan 20, 2022

    @vargaz
    Contributor

    I'd suggest skipping AOTing for these assemblies, they take forever to AOT which also impacts CI performance even if it works.

  16. self-assigned this
    on Jan 21, 2022
  17. directhex commented on Jan 21, 2022

    @directhex
    Contributor

    Failure is at

    if (amodule->out_of_date) {
    mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_AOT, "AOT: Module %s is unusable because a dependency is out-of-date.", assembly->image->name);
    if (mono_aot_only)
    g_error ("Failed to load AOT module '%s' while running in aot-only mode because a dependency cannot be found or it is out of date.\n", found_aot_name);
    which makes sense

  18. vargaz commented on Jan 24, 2022

    @vargaz
    Contributor

    Is there a PR which skips the AOT step for these assemblies ?

  19. vargaz commented on Jan 24, 2022

    @vargaz
    Contributor

    An alternative would be compiling with O1, i.e.:

        <EmccLinkOptimizationFlag>-O1</EmccLinkOptimizationFlag>
    

    Running with this reduced the total runtime from 16 minutes to 11 minutes on my machine, it might solve the OOM problem as well.

  20. directhex commented on Jan 24, 2022

    @directhex
    Contributor
  21. vargaz commented on Jan 25, 2022

    @vargaz
    Contributor
  22. elinor-fung commented on Feb 17, 2022

    @elinor-fung
    Member

    @directhex @radical - the latest rolling build (which has #63958) still hit this.

    Still looks to be an OOM, but I don't know how to get more information about the exact cause.

    emcc : error : '/datadisks/disk1/work/A50F091E/p/build/emsdk/upstream/bin/wasm-emscripten-finalize --minimize-wasm-changes -g --dyncalls-i64 --dwarf /datadisks/disk1/work/A50F091E/w/B308094D/e/wasm_build/obj/wasm/for-build/dotnet.wasm -o /datadisks/disk1/work/A50F091E/w/B308094D/e/wasm_build/obj/wasm/for-build/dotnet.wasm --detect-features' failed (received SIGKILL (-9)) [/datadisks/disk1/work/A50F091E/w/B308094D/e/publish/ProxyProjectForAOTOnHelix.proj]
    /datadisks/disk1/work/A50F091E/p/build/wasm/WasmApp.Native.targets(404,5): error MSB3073: The command "emcc "@/datadisks/disk1/work/A50F091E/p/build/microsoft.netcore.app.runtime.browser-wasm/runtimes/browser-wasm/native/src/emcc-default.rsp" "@/datadisks/disk1/work/A50F091E/p/build/microsoft.netcore.app.runtime.browser-wasm/runtimes/browser-wasm/native/src/emcc-link.rsp" "@/datadisks/disk1/work/A50F091E/w/B308094D/e/wasm_build/obj/wasm/for-build/emcc-link.rsp"" exited with code 1. [/datadisks/disk1/work/A50F091E/w/B308094D/e/publish/ProxyProjectForAOTOnHelix.proj]
    
    [ 5962.061349] oom-kill:constraint=CONSTRAINT_NONE,nodemask=(null),cpuset=/,mems_allowed=0,global_oom,task_memcg=/system.slice/helix.service,task=wasm-emscripten,pid=23875,uid=1000
    [ 5962.061364] Out of memory: Killed process 23875 (wasm-emscripten) total-vm:5798616kB, anon-rss:5590440kB, file-rss:0kB, shmem-rss:0kB, UID:1000 pgtables:11100kB oom_score_adj:0
    [ 5962.258803] oom_reaper: reaped process 23875 (wasm-emscripten), now anon-rss:0kB, file-rss:0kB, shmem-rss:0kB
    
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

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions