Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-72613

Speed up taking core dumps with the hang analyzer

    • Fully Compatible
    • v6.2, v6.0, v5.0
    • Sharding NYC 2023-01-09, Sharding NYC 2023-01-23

      The hang analyzer uses the gcore command (aka generate-core-file) within a GDB session to generate a core dump. By default, GDB will load the debug symbols for the process when the attach command is run. The gcore script uses the --readnever option when invoking gdb to skip the expense of loading debug symbols before taking the core dump. This cost is amortized in the hang analyzer because it'll use a single GDB session for all processes of the same type (i.e. a single gdb process attaches to all mongod processes). However we can use --readnever in the hang analyzer when it does the first round of attach commands to only take core dumps and avoid the cost altogether.

      # `</dev/null' to avoid touching interactive terminal if it is
      # available but not accessible as GDB would get stopped on SIGTTIN.
      "$binary_path/@GDB_TRANSFORM_NAME@" </dev/null \
          --nx --batch --readnever \
          -ex "set pagination off" -ex "set height 0" -ex "set width 0" \
          "${dump_all_cmds[@]}" \
          -ex "attach $pid" -ex "gcore $prefix.$pid" -ex detach -ex quit
      

      https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=8a6a85134d78531c6adb72a888844f7cfa3a5c56

            Assignee:
            max.hirschhorn@mongodb.com Max Hirschhorn
            Reporter:
            max.hirschhorn@mongodb.com Max Hirschhorn
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: