Consider MacOS sigaltstack support

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Unresolved
    • Priority: Major - P3
    • 8.3.0-rc0
    • Affects Version/s: None
    • Component/s: None
    • None
    • Server Programmability
    • ALL
    • Programmability 2025-10-13
    • 200
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      Related error

      stacktrace_test.cpp uses sigaltstack, but there are some unknown issues when disabling the sigaltstack:

       

                  ...
                  {
                      stack_t ss;
                      ss.ss_sp = 0;
                      ss.ss_size = 0;
                      ss.ss_flags = SS_DISABLE;
                      if (int r = sigaltstack(&ss, nullptr); r < 0) {
                          perror("sigaltstack");
                      }
                  } 

      This code causes an "sigaltstack: Cannot allocate memory" error message, but the underlying cause is unknown.

       

      MacOS sigaltstack

      We don't currently support sigaltstack on mac (code here):

       

      #if defined(__linux__) || defined(__FreeBSD__)
      #define MONGO_HAS_SIGALTSTACK 1
      #else
      #define MONGO_HAS_SIGALTSTACK 0
      #endif 

      The stacktrace test guarding macro is less restrictive:

      #if !defined(_WIN32)
      #define HAVE_SIGALTSTACK
      #endif 

      This correctly includes macOS, which is posix compliant and implements sigaltstack.

      We should temporarily disable all stacktrace sigaltstack testing on macOS at least.

       

       

            Assignee:
            Alex Li
            Reporter:
            Alex Li
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: