Skip to content

Secondary frame stackoverflow test failure on linux #107226

Closed

Description

@am11

This test:

public static void TestStackOverflowSmallFrameSecondaryThread()

is failing in runtime-coreclr superpmi-collect-test pipeline on linux x64, arm64 and arm:

Running stackoverflow test(largeframe main)
"Stack overflow."
"Repeated 42 times:"
"--------------------------------"
"   at TestStackOverflow.Program.InfiniteRecursionB2()"
"   at TestStackOverflow.Program.InfiniteRecursionA2()"
"   at TestStackOverflow.Program.InfiniteRecursionC2()"
"--------------------------------"
"   at TestStackOverflow.Program.InfiniteRecursionB2()"
"   at TestStackOverflow.Program.InfiniteRecursionA2()"
"   at TestStackOverflow.Program.Test(Boolean)"
"   at TestStackOverflow.Program.Main(System.String[])"
""
Running stackoverflow test(smallframe secondary)
"Stack overflow."
"Stack overflow."
""
System.Exception: Missing "TestStackOverflow.Program.Test" method frame
   at TestStackOverflow.Program.TestStackOverflowSmallFrameSecondaryThread()
   at __GeneratedMainWrapper.Main()
Expected: 100
Actual: 101
END EXECUTION - FAILED

cc @janvorli

Activity

  1. added
    os-linux
    area-ExceptionHandling-coreclr
    on Aug 31, 2024
  2. added
    untriaged
    on Aug 31, 2024
  3. janvorli commented on Sep 2, 2024

    @janvorli
    Member

    The problem is due to the superpmi libsuperpmi-shim-collector.so sigsegv handler being called as the first one and the GetCurrentPalThread returning NULL in this dll, because the PAL threads were created by the libcoreclr.so. That results in the sigsegv_handler printing "Stack overflow" and calling PROCAbort.
    I am testing a fix that just calls the previous signal handler when GetCurrentPalThread returns NULL.

  4. janvorli commented on Sep 2, 2024

    @janvorli
    Member

    It is actually a bit more involved. The GetCurrentPalThread sometimes returns non-NULL even when called from the libsuperpmi-shim-collector.so SIGSEGV handler. That happens when the superpmi stuff ended up being called on that thread before the crash occurs. Which means we have jitted something on that thread. Then the PAL thread instance gets created also in the context of the libsuperpmi-shim-collector.so.
    Nevertheless, it doesn't change the way to fix that I've mentioned above. I just wanted to share the full story here. If the PAL thread got registered, we still end up falling back to the SIGSEGV handler in the libcoreclr.so, because the superpmi doesn't implement hardware exception handling callbacks that could handle the stack overflow.

  5. added
    in-pr
    on Sep 2, 2024
  6. removed
    untriaged
    on Sep 3, 2024
  7. added this to the 10.0.0 milestone on Sep 3, 2024
  8. locked and limited conversation to collaborators on Oct 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-ExceptionHandling-coreclrin-pros-linux

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions