- Configure memory dump files for Server Core installation
- Step 1: Disable the automatic system page file management
- Step 2: Configure the destination path for a memory dump
- Step 3: Set the type of memory dump
- Step 4: Configure the server to restart automatically after generating a memory dump
- Step 5: Configure the server to overwrite the existing memory dump file
- Step 6: Set an administrative alert
- Step 7: Set the memory dump’s page file size
- Step 8: Configure the server to generate a manual memory dump
- Step 9: Verify that memory dump files are being created correctly
- Программа для сбора и анализа дампов (dotnet-dump) Dump collection and analysis utility (dotnet-dump)
- Установка Install
- Краткий обзор Synopsis
- Описание Description
- Параметры Options
- Команды Commands
- dotnet-dump collect dotnet-dump collect
- Краткий обзор Synopsis
- Параметры Options
- dotnet-dump analyze dotnet-dump analyze
- Краткий обзор Synopsis
- Аргументы Arguments
- Параметры Options
- Анализ команд SOS Analyze SOS commands
- Использование dotnet-dump Using dotnet-dump
- Особые инструкции для Docker Special instructions for Docker
Configure memory dump files for Server Core installation
Applies to: Windows Server 2019, Windows Server 2016, and Windows Server (Semi-Annual Channel)
Use the following steps to configure a memory dump for your Server Core installation.
Step 1: Disable the automatic system page file management
The first step is to manually configure your system failure and recovery options. This is required to complete the remaining steps.
Run the following command:
Step 2: Configure the destination path for a memory dump
You don’t have to have the page file on the partition where the operating system is installed. To put the page file on another partition, you must create a new registry entry named DedicatedDumpFile. You can define the size of the paging file by using the DumpFileSize registry entry. To create the DedicatedDumpFile and DumpFileSize registry entries, follow these steps:
At the command prompt, run the regedit command to open the Registry Editor.
Locate and then click the following registry subkey: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\CrashControl
Click Edit > New > String Value.
Name the new value DedicatedDumpFile, and then press ENTER.
Right-click DedicatedDumpFile, and then click Modify.
In Value data type :\ , and then click OK.
Replace with a drive that has enough disk space for the paging file, and replace with the full path to the dedicated file.
Click Edit > New > DWORD Value.
Type DumpFileSize, and then press ENTER.
Right-click DumpFileSize, and then click Modify.
In Edit DWORD Value, under Base, click Decimal.
In Value data, type the appropriate value, and then click OK.
The size of the dump file is in megabytes (MB).
Exit the Registry Editor.
After you determine the partition location of the memory dump, configure the destination path for the page file. To view the current destination path for the page file, run the following command:
The default destination for DebugFilePath is %systemroot%\memory.dmp. To change the current destination path, run the following command:
Set to the destination path. For example, the following command sets the memory dump destination path to C:\WINDOWS\MEMORY.DMP:
Step 3: Set the type of memory dump
Determine the type of memory dump to configure for your server. To view the current memory dump type, run the following command:
To change the current memory dump type, run the following command:
can be 0, 1, 2, or 3, as defined below.
- 0: Disable the removal of a memory dump.
- 1: Full memory dump. Records all of the contents of system memory when your computer stops unexpectedly. A full memory dump may contain data from processes that were running when the memory dump was collected.
- 2: Kernel memory dump (default). Records only the kernel memory. This speeds up the process of recording information in a log file when your computer stops unexpectedly.
- 3: Small memory dump. Records the smallest set of useful information that may help identify why your computer stopped unexpectedly.
Step 4: Configure the server to restart automatically after generating a memory dump
By default, the server automatically restarts after it generates a memory dump. To view the current configuration, run the following command:
If the value for AutoReboot is TRUE, the server will restart automatically after generating a memory dump. No configuration is needed and you can proceed to the next step.
If the value for AutoReboot is FALSE, the server will not restart automatically. Run the following command to change the value:
Step 5: Configure the server to overwrite the existing memory dump file
By default, the server overwrites the existing memory dump file when a new one is created. To determine if existing memory dump files are already configured to be overwritten, run the following command:
If the value is 1, the server will overwrite the existing memory dump file. No configuration is needed, and you can proceed to the next step.
If the value is 0, the server won’t overwrite the existing memory dump file. Run the following command to change the value:
Step 6: Set an administrative alert
Determine whether an administrative alert is appropriate and set SendAdminAlert accordingly. To view the current value for SendAdminAlert, run the following command:
The possible values for SendAdminAlert are TRUE or FALSE. To modify the existing SendAdminAlert value to true, run the following command:
Step 7: Set the memory dump’s page file size
To check the current page file settings, run one of the following commands:
For example, run the following command to configure the initial and maximum sizes of your page file:
Step 8: Configure the server to generate a manual memory dump
You can manually generate a memory dump by using a PS/2 keyboard. This feature is disabled by default, and it is not available for Universal Serial Bus (USB) keyboards.
To enable manual memory dumps by using a PS/2 keyboard, run the following command:
To determine if the feature has been enabled properly, run the following command:
You must restart the server for the changes to take effect. You can restart the server by running the following command:
You can generate manual memory dumps with a PS/2 keyboard that is connected to your server by holding the RIGHT CTRL key while pressing the SCROLL LOCK key two times. This makes the computer bug check with error code 0xE2. After you restart the server, a new dump file appears in the destination path that you established in step 2.
Step 9: Verify that memory dump files are being created correctly
You can use the dumpchk.exe utlity to verify that the memory dump files are being created correctly. The dumpchk.exe utility isn’t installed with the Server Core installation option, so you’ll have to run it from a server with the Desktop Experience or from Windows 10. Additionally, the debugging tools for Windows products must be installed.
The dumpchk.exe utility lets you transfer the memory dump file from your Server Core installation of Windows Server 2008 to the other computer by using the medium of your choice.
Page files can be very large, so carefully consider the transfer method and the resources that method requires.
For general information about using memory dump files, see Overview of memory dump file options for Windows.
Программа для сбора и анализа дампов (dotnet-dump) Dump collection and analysis utility (dotnet-dump)
Эта статья относится к следующему. ✔️ SDK для .NET Core 3.0 и более поздних версий This article applies to: ✔️ .NET Core 3.0 SDK and later versions
dotnet-dump для macOS поддерживается только в .NET 5.0 и более поздних версиях. dotnet-dump for macOS is only supported with .NET 5.0 and later versions.
Установка Install
Есть два способа загрузки и установки dotnet-dump : There are two ways to download and install dotnet-dump :
Средство dotnet global: dotnet global tool:
Чтобы установить последнюю версию пакета NuGet dotnet-dump , используйте команду dotnet tool install. To install the latest release version of the dotnet-dump NuGet package, use the dotnet tool install command:
Прямое скачивание: Direct download:
скачайте исполняемый файл средства, соответствующий вашей платформе: Download the tool executable that matches your platform:
OS OS | Платформа Platform |
---|---|
Windows Windows | x86 | x64 | arm | arm-x64x86 | x64 | arm | arm-x64 |
macOS macOS | x64 x64 |
Linux Linux | x64 | arm | arm64 | musl-x64 | musl-arm64x64 | arm | arm64 | musl-x64 | musl-arm64 |
Для использования dotnet-dump в приложении x86 необходима соответствующая версия средства для архитектуры x86. To use dotnet-dump on an x86 app, you need a corresponding x86 version of the tool.
Краткий обзор Synopsis
Описание Description
dotnet-dump — это средство сбора и анализа дампов в Windows и Linux, которое не задействует собственный отладчик системы (как, например, lldb в Linux). The dotnet-dump global tool is a way to collect and analyze Windows and Linux dumps without any native debugger involved like lldb on Linux. Это средство имеет важное значение на таких платформах, как Alpine Linux, где отсутствует полноценно работающее средство lldb . This tool is important on platforms like Alpine Linux where a fully working lldb isn’t available. Средство dotnet-dump позволяет выполнять команды SOS для анализа сбоев и сборщика мусора (GC), но не поддерживает некоторые функции, как, например, отображение собственных кадров стека, потому что не является встроенным отладчиком. The dotnet-dump tool allows you to run SOS commands to analyze crashes and the garbage collector (GC), but it isn’t a native debugger so things like displaying native stack frames aren’t supported.
Параметры Options
—version
Отображение версии служебной программы dotnet-dump. Displays the version of the dotnet-dump utility.
-h|—help
Отображение справки в командной строке. Shows command-line help.
Команды Commands
dotnet-dump collect dotnet-dump collect
Записывает дамп из процесса. Captures a dump from a process.
Краткий обзор Synopsis
Параметры Options
-h|—help
Отображение справки в командной строке. Shows command-line help.
Указывает идентификатор процесса, из которого нужно собрать дамп. Specifies the process ID number to collect a dump from.
-n|—name
Имя процесса, из которого нужно получить дамп. Specifies the name of the process to collect a dump from.
—type
Указывает тип дампа, который определяет типы собираемых из процесса данных. Specifies the dump type, which determines the kinds of information that are collected from the process. Здесь возможны три варианта: There are three types:
- Full — самый крупный дамп, содержащий всю память, включая образы модулей. Full — The largest dump containing all memory including the module images.
- Heap — большой и сравнительно подробный дамп, который содержит списки модулей, списки потоков, все стеки, сведения об исключениях, сведения об обработке и всю память, за исключением сопоставленных образов. Heap — A large and relatively comprehensive dump containing module lists, thread lists, all stacks, exception information, handle information, and all memory except for mapped images.
- Mini — небольшой дамп, который содержит списки модулей, списки потоков, сведения об исключениях и все стеки. Mini — A small dump containing module lists, thread lists, exception information, and all stacks.
Если тип не указан, по умолчанию используется вариант Full . If not specified, Full is the default.
-o|—output
Полный путь и имя файла, в который будет записан собранный дамп. The full path and file name where the collected dump should be written.
Если значение не указано, используются следующие: If not specified:
- .\dump_YYYYMMDD_HHMMSS.dmp в ОС Windows; Defaults to .\dump_YYYYMMDD_HHMMSS.dmp on Windows.
- ./core_YYYYMMDD_HHMMSS в ОС Linux. Defaults to ./core_YYYYMMDD_HHMMSS on Linux.
YYYYMMDD обозначает формат «год/месяц/день», а HHMMSS — формат «час/минута/секунда». YYYYMMDD is Year/Month/Day and HHMMSS is Hour/Minute/Second.
—diag
Включает ведение журнала диагностики для сбора дампов. Enables dump collection diagnostic logging.
В Linux и macOS эта команда ожидает, что целевое приложение и dotnet-dump будут совместно использовать одну и ту же переменную среды TMPDIR . On Linux and macOS, this command expects the target application and dotnet-dump to share the same TMPDIR environment variable. В противном случае время ожидания команды истечет. Otherwise, the command will time out.
Чтобы собрать дамп с помощью dotnet-dump , ее необходимо запустить от имени пользователя, запустившего целевой процесс, или от имени привилегированного пользователя. To collect a dump using dotnet-dump , it needs to be run as the same user as the user running target process or as root. В противном случае средство не сможет установить соединение с целевым процессом. Otherwise, the tool will fail to establish a connection with the target process.
dotnet-dump analyze dotnet-dump analyze
Запускает интерактивную оболочку для просмотра дампа. Starts an interactive shell to explore a dump. Эта оболочка принимает различные команды SOS. The shell accepts various SOS commands.
Краткий обзор Synopsis
Аргументы Arguments
Указывает путь к анализируемому файлу дампа. Specifies the path to the dump file to analyze.
Параметры Options
-c|—command
Указывает команду, которую нужно выполнить при запуске оболочки. Specifies the command to run in the shell on start.
Анализ команд SOS Analyze SOS commands
Команда Command | Функция Function |
---|---|
soshelp | Отображение всех доступных команд. Displays all available commands |
soshelp|help | Отображение сведений об указанной команде. Displays the specified command. |
exit|quit | Выход из интерактивного режима. Exits interactive mode. |
clrstack | Обеспечивает трассировку стека только для управляемого кода. Provides a stack trace of managed code only. |
clrthreads | Перечисление всех выполняемых управляемых потоков. Lists the managed threads running. |
dumpasync | Отображение информации о машинах асинхронной обработки для кучи со сборкой мусора. Displays information about async state machines on the garbage-collected heap. |
dumpassembly | Отображение сведений о сборке, находящейся по указанному адресу. Displays details about the assembly at the specified address. |
dumpclass | Отображение сведений о структуре EEClass , находящейся по указанному адресу. Displays information about the EEClass structure at the specified address. |
dumpdelegate | Отображение сведений о делегате, находящемся по указанному адресу. Displays information about the delegate at the specified address. |
dumpdomain | Отображение сведений обо всех доменах приложений и всех сборках в указанных доменах. Displays information all the AppDomains and all assemblies within the specified domain. |
dumpheap | Отображение сведений о куче со сборкой мусора и статистики сборки мусора по объектам. Displays info about the garbage-collected heap and collection statistics about objects. |
dumpil | Отображает язык CIL, связанный с управляемым методом. Displays the Microsoft intermediate language (MSIL) that is associated with a managed method. |
dumplog | Записывает в указанный файл содержимое журнала нагрузок, хранящегося в памяти. Writes the contents of an in-memory stress log to the specified file. |
dumpmd | Отображение сведений о структуре MethodDesc , находящейся по указанному адресу. Displays information about the MethodDesc structure at the specified address. |
dumpmodule | Отображение сведений о модуле, находящемся по указанному адресу. Displays information about the module at the specified address. |
dumpmt | Отображение сведений об объекте MethodTable , находящемся по указанному адресу. Displays information about the MethodTable at the specified address. |
dumpobj | Отображение сведений об объекте, находящемся по указанному адресу. Displays info about the object at the specified address. |
dso|dumpstackobjects | Отображает все управляемые объекты, обнаруженные в пределах границ текущего стека. Displays all managed objects found within the bounds of the current stack. |
eeheap | Отображение сведений о памяти процессов, занятой внутренними структурами данных среды выполнения. Displays info about process memory consumed by internal runtime data structures. |
finalizequeue | Отображает все объекты, зарегистрированные для заключительной обработки. Displays all objects registered for finalization. |
gcroot | Отображение сведений о ссылках (или корневых элементах) объекта, который расположен по указанному адресу. Displays info about references (or roots) to the object at the specified address. |
gcwhere | Отображение расположения переданного аргумента в куче со сборкой мусора. Displays the location in the GC heap of the argument passed in. |
ip2md | Отображение структуры MethodDesc , которая расположена по указанному адресу в JIT-коде. Displays the MethodDesc structure at the specified address in JIT code. |
histclear | Освобождает все ресурсы, используемые семейством команд hist* . Releases any resources used by the family of hist* commands. |
histinit | Инициализирует структуры SOS из журнала нагрузки, сохраненного в отлаживаемом объекте. Initializes the SOS structures from the stress log saved in the debuggee. |
histobj | Отображение перераспределений журнала нагрузок для сборки мусора, связанных с . Displays the garbage collection stress log relocations related to . |
histobjfind | Отображение всех записей журнала, ссылающихся на объект по указанному адресу. Displays all the log entries that reference the object at the specified address. |
histroot | Отображает сведения о повышениях и перемещениях указанного корневого элемента. Displays information related to both promotions and relocations of the specified root. |
lm|modules | Отображение выполняемых собственных модулей. Displays the native modules in the process. |
name2ee | Отображение структур MethodTable и EEClass для . Displays the MethodTable and EEClass structures for the . |
pe|printexception | Отображение любого производного от класса Exception объекта для . Displays any object derived from the Exception class for the . |
setsymbolserver | Включение поддержки сервера символов Enables the symbol server support |
syncblk | Отображение сведений о заполнителе SyncBlock. Displays the SyncBlock holder info. |
threads|setthread | Отображение или изменение идентификатора текущего потока для команд SOS. Sets or displays the current thread ID for the SOS commands. |
Дополнительные сведения см. в разделе Расширение отладки SOS для .NET. Additional details can be found in SOS Debugging Extension for .NET.
Использование dotnet-dump Using dotnet-dump
Первым шагом является сборка дампа. The first step is to collect a dump. Этот шаг можно пропустить, если уже создан основной дамп. This step can be skipped if a core dump has already been generated. Основные дампы могут создавать как операционная система, так и встроенная в среду выполнения .NET Core функция создания дампа. The operating system or the .NET Core runtime’s built-in dump generation feature can each create core dumps.
Теперь запустите анализ основного дампа с помощью команды analyze : Now analyze the core dump with the analyze command:
Это действие открывает интерактивный сеанс, который принимает команды следующего вида: This action brings up an interactive session that accepts commands like:
Чтобы получить сведения о необработанном исключении, которое привело к сбою приложения, выполните: To see an unhandled exception that killed your app:
Особые инструкции для Docker Special instructions for Docker
Если вы используете Docker, для сбора дампа требуются возможности SYS_PTRACE ( —cap-add=SYS_PTRACE или —privileged ). If you’re running under Docker, dump collection requires SYS_PTRACE capabilities ( —cap-add=SYS_PTRACE or —privileged ).
В образах Docker с Linux и пакетом SDK для Microsoft .NET Core некоторые команды dotnet-dump могут вызвать следующее исключение: On Microsoft .NET Core SDK Linux Docker images, some dotnet-dump commands can throw the following exception:
Unhandled exception: System.DllNotFoundException: Unable to load shared library ‘libdl.so’ or one of its dependencies’ exception. (Необработанное исключение: System.DllNotFoundException: Не удалось загрузить общую библиотеку libdl.so или одну из ее зависимостей.) Unhandled exception: System.DllNotFoundException: Unable to load shared library ‘libdl.so’ or one of its dependencies’ exception.
Чтобы обойти эту проблему, установите пакет libc6-dev. To work around this problem, install the «libc6-dev» package.