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


            max.hirschhorn@mongodb.com Max Hirschhorn
            max.hirschhorn@mongodb.com Max Hirschhorn
            0 Vote for this issue
            4 Start watching this issue