Skip to content

[NativeAOT] Test_GetTotalAllocatedBytes test fails with OutOfMemoryException #119187

Closed as duplicate

Description

@jkotas
System.AggregateException: One or more errors occurred. (Insufficient memory to continue the execution of the program.)
 ---> System.OutOfMemoryException: Insufficient memory to continue the execution of the program.
   at System.Threading.Thread.StartCore() + 0xd5
   at Test_GetTotalAllocatedBytes.<>c__DisplayClass10_0.<TestAnotherThread>b__0() + 0x89
   at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread, ExecutionContext, ContextCallback, Object) + 0x8b

Build Information

Build: https://dev.azure.com/dnceng-public/cbb18261-c48f-4abb-8651-8cdcb5474649/_build/results?buildId=1133784
Build error leg or test failing: GC/API/GC/GetTotalAllocatedBytes/GetTotalAllocatedBytes.cmd
Pull request: #119167

Error Message

Fill the error message using step by step known issues guidance.

{
  "ErrorMessage": ["OutOfMemoryException","at Test_GetTotalAllocatedBytes"],
  "ErrorPattern": "",
  "BuildRetry": false,
  "ExcludeConsoleLog": false
}

Known issue validation

Build: 🔎 https://dev.azure.com/dnceng-public/public/_build/results?buildId=1133784
Error message validated: [OutOfMemoryException at Test_GetTotalAllocatedBytes]
Result validation: ✅ Known issue matched with the provided build.
Validation performed at: 8/28/2025 7:39:21 PM UTC

Report

Build Definition Test Pull Request
1298624 dotnet/runtime GC/API/GC/GetTotalAllocatedBytes/GetTotalAllocatedBytes.cmd

Summary

24-Hour Hit Count 7-Day Hit Count 1-Month Count
1 1 1

Activity

  1. added
    blocking-clean-ci
    Known Build Error
    on Aug 28, 2025
  2. added
    untriaged
    on Aug 28, 2025
  3. added
    needs-area-label
    on Aug 28, 2025
  4. jkotas commented on Aug 28, 2025

    @jkotas
    MemberAuthor

    The test is starting and joining threads in a tight loop:

    while (running)
    {
    Thread thd = new Thread(() => {
    lock (lck)
    {
    s_stash = new byte[1234];
    }
    });
    thd.Start();
    thd.Join();
    }
    . We may have a problem with cleaning up dead threads fast enough.

  5. removed
    needs-area-label
    on Aug 28, 2025
  6. changed the title [-]Test_GetTotalAllocatedBytes test fails with OutOfMemoryException[/-] [+][NativeAOT] Test_GetTotalAllocatedBytes test fails with OutOfMemoryException[/+] on Aug 28, 2025
  7. dotnet-policy-service commented on Aug 28, 2025

    @dotnet-policy-service
    Contributor

    Tagging subscribers to this area: @agocke, @MichalStrehovsky, @jkotas
    See info in area-owners.md if you want to be subscribed.

  8. added this to the 11.0.0 milestone on Oct 15, 2025
  9. removed
    untriaged
    on Oct 15, 2025
  10. agocke commented on Oct 15, 2025

    @agocke
    Member

    @VSadov Could you take a look?

  11. VSadov commented on Oct 15, 2025

    @VSadov
    Member

    We may have a problem with cleaning up dead threads fast enough.

    Very likely.

  12. self-assigned this
    on Oct 15, 2025
  13. VSadov commented on Nov 4, 2025

    @VSadov
    Member

    It is also an arm32 specific failures.

    This is unlikely to be a managed OOM. The code is allocating and would trigger GC. More likely we run out of 32-bit space or some other resource on OS side.

    I am not sure what the test is trying to achieve by creating this many threads. If creation of the threads starves the main thread (which is supposed to set a termination flag at some point), then thread creation could continue for quite a while.

  14. VSadov commented on Nov 4, 2025

    @VSadov
    Member

    Maybe we just need a cap on number of threads created by the test. creating/joining 1000 threads could be enough to see that GetTotalAllocatedBytes works in the presence of dying threads.

  15. added a commit that references this issue on Nov 11, 2025
    933d3f0
  16. locked and limited conversation to collaborators on Dec 11, 2025
  17. MichalStrehovsky commented on Feb 18, 2026

    @MichalStrehovsky
    Member

    This is still a regular occurrence in native AOT outerloops. JitStress runs also see this, so it may not be native AOT specific. However, I'm going to reopen this bug so that I can block this test on it.

  18. unlocked this conversation on Feb 18, 2026
  19. MichalStrehovsky commented on Feb 19, 2026

    @MichalStrehovsky
    Member

    Going to assume this is the same issue as seen in JitStress. Duplicate of #121482.

  20. locked and limited conversation to collaborators on Mar 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Known Build Errorarch-arm32area-NativeAOT-coreclrblocking-clean-cios-linux

Type

No type

Projects

  • Status
    No status

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions