Skip to content

Commit 680199b

Browse files
committed
Update diagnostic-port details
- Include the diagnostic-port option for dotnet-gcdump which previously lacked it - Give a bit more detail about how diagnostic-port should be specified for all the tools that currently support it - Move the warnings about sharing the TMPDIR to the specific --name and --process-id arguments because it shouldn't be a requirement when specifying a full path using --diagnostic-port
1 parent 4fc7600 commit 680199b

File tree

3 files changed

+50
-11
lines changed

3 files changed

+50
-11
lines changed

docs/core/diagnostics/dotnet-counters.md

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -79,13 +79,28 @@ dotnet-counters collect [-h|--help] [-p|--process-id] [-n|--name] [--diagnostic-
7979

8080
The ID of the process to collect counter data from.
8181

82+
> [!NOTE]
83+
> On Linux and macOS, using this option requires the target application and `dotnet-counters` to share the same `TMPDIR` environment variable. Otherwise, the command will time out.
84+
8285
- **`-n|--name <name>`**
8386

8487
The name of the process to collect counter data from.
8588

86-
- **`--diagnostic-port`**
89+
> [!NOTE]
90+
> On Linux and macOS, using this option requires the target application and `dotnet-counters` to share the same `TMPDIR` environment variable. Otherwise, the command will time out.
8791
88-
The name of the diagnostic port to create. See [using diagnostic port](#using-diagnostic-port) for how to use this option to start monitoring counters from app startup.
92+
- **`--diagnostic-port <port-address[,(listen|connect)]>`**
93+
94+
Sets the [diagnostic port](diagnostic-port.md) used to communicate with the process to be monitored. dotnet-counters and the .NET runtime inside the target process must agree on the port-address with one listening and the other connecting. dotnet-counters will automatically determine the correct port when attaching using the `--process-id` or `--name` options, or when launching a process using the `-- <command>` option. Specifying the port explicitly is usually only necessary when waiting for a process that will start in the future or communicating to a process that is running inside a container that isn't part of the current process namespace.
95+
96+
The `port-address` differs by OS:
97+
- Linux and macOS - path to a Unix domain socket such as `/foo/tool1.socket`
98+
- Windows - a path to a named pipe such as `\\.\pipe\my_diag_port1`
99+
- Android, iOS, and tvOS - an IP:port such as `127.0.0.1:9000`.
100+
101+
By default dotnet-counters will listen at the specified address. You may request dotnet-counters to connect instead by appending `,connect` after the address. For example `--diagnostic-port /foo/tool1.socket,connect` will connect to a .NET runtime process that is listening to the `/foo/tool1.socket` unix domain socket.
102+
103+
See [using diagnostic port](#using-diagnostic-port) for how to use this option to start monitoring counters from app startup.
89104

90105
- **`--refresh-interval <SECONDS>`**
91106

@@ -113,9 +128,6 @@ dotnet-counters collect [-h|--help] [-p|--process-id] [-n|--name] [--diagnostic-
113128
> [!NOTE]
114129
> Launching a .NET executable via dotnet-counters will redirect its input/output and you won't be able to interact with its stdin/stdout. Exiting the tool via CTRL+C or SIGTERM will safely end both the tool and the child process. If the child process exits before the tool, the tool will exit as well. If you need to use stdin/stdout, you can use the `--diagnostic-port` option. See [Using diagnostic port](#using-diagnostic-port) for more information.
115130
116-
> [!NOTE]
117-
> On Linux and macOS, this command expects the target application and `dotnet-counters` to share the same `TMPDIR` environment variable. Otherwise, the command will time out.
118-
119131
> [!NOTE]
120132
> To collect metrics using `dotnet-counters`, 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.
121133

docs/core/diagnostics/dotnet-gcdump.md

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,9 @@ dotnet-gcdump collect [-h|--help] [-p|--process-id <pid>] [-o|--output <gcdump-f
9393

9494
The process ID to collect the GC dump from.
9595

96+
> [!NOTE]
97+
> On Linux and macOS, using this option requires the target application and `dotnet-gcdump` to share the same `TMPDIR` environment variable. Otherwise, the command will time out.
98+
9699
- **`-o|--output <gcdump-file-path>`**
97100

98101
The path where collected GC dumps should be written. Defaults to *.\\YYYYMMDD\_HHMMSS\_\<pid>.gcdump*.
@@ -109,8 +112,19 @@ dotnet-gcdump collect [-h|--help] [-p|--process-id <pid>] [-o|--output <gcdump-f
109112

110113
The name of the process to collect the GC dump from.
111114

112-
> [!NOTE]
113-
> On Linux and macOS, this command expects the target application and `dotnet-gcdump` to share the same `TMPDIR` environment variable. Otherwise, the command will time out.
115+
> [!NOTE]
116+
> On Linux and macOS, using this option requires the target application and `dotnet-gcdump` to share the same `TMPDIR` environment variable. Otherwise, the command will time out.
117+
118+
- **`--diagnostic-port <port-address[,(listen|connect)]>`**
119+
120+
Sets the [diagnostic port](diagnostic-port.md) used to communicate with the process to be dumped. dotnet-gcdump and the .NET runtime inside the target process must agree on the port-address with one listening and the other connecting. dotnet-gcdump will automatically determine the correct port when attaching using the `--process-id` or `--name` options. Specifying the port explicitly is usually only necessary when communicating to a process that is running inside a container that isn't part of the current process namespace.
121+
122+
The `port-address` differs by OS:
123+
- Linux and macOS - path to a Unix domain socket such as `/foo/tool1.socket`
124+
- Windows - a path to a named pipe such as `\\.\pipe\my_diag_port1`
125+
- Android, iOS, and tvOS - an IP:port such as `127.0.0.1:9000`.
126+
127+
By default dotnet-gcdump will listen at the specified address. You may request dotnet-gcdump to connect instead by appending `,connect` after the address. For example `--diagnostic-port /foo/tool1.socket,connect` will connect to a .NET runtime process that is listening to the `/foo/tool1.socket` unix domain socket.
114128

115129
> [!NOTE]
116130
> To collect a GC dump using `dotnet-gcdump`, 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.

docs/core/diagnostics/dotnet-trace.md

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -161,9 +161,21 @@ dotnet-trace collect [--buffersize <size>] [--clreventlevel <clreventlevel>] [--
161161

162162
The name of the process to collect the trace from.
163163

164-
- **`--diagnostic-port <path-to-port>`**
164+
> [!NOTE]
165+
> On Linux and macOS, using this option requires the target application and `dotnet-trace` to share the same `TMPDIR` environment variable. Otherwise, the command will time out.
166+
167+
- **`--diagnostic-port <port-address[,(listen|connect)]>`**
165168

166-
The name of the diagnostic port to create. See [Use diagnostic port to collect a trace from app startup](#use-diagnostic-port-to-collect-a-trace-from-app-startup) to learn how to use this option to collect a trace from app startup.
169+
Sets the [diagnostic port](diagnostic-port.md) used to communicate with the process to be traced. dotnet-trace and the .NET runtime inside the target process must agree on the port-address with one listening and the other connecting. dotnet-trace will automatically determine the correct port when attaching using the `--process-id` or `--name` options, or when launching a process using the `-- <command>` option. Specifying the port explicitly is usually only necessary when waiting for a process that will start in the future or communicating to a process that is running inside a container that isn't part of the current process namespace.
170+
171+
The `port-address` differs by OS:
172+
- Linux and macOS - path to a Unix domain socket such as `/foo/tool1.socket`
173+
- Windows - a path to a named pipe such as `\\.\pipe\my_diag_port1`
174+
- Android, iOS, and tvOS - an IP:port such as `127.0.0.1:9000`.
175+
176+
By default dotnet-trace will listen at the specified address. You may request dotnet-trace to connect instead by appending `,connect` after the address. For example `--diagnostic-port /foo/tool1.socket,connect` will connect to a .NET runtime process that is listening to the `/foo/tool1.socket` unix domain socket.
177+
178+
See [Use diagnostic port to collect a trace from app startup](#use-diagnostic-port-to-collect-a-trace-from-app-startup) to learn how to use this option to collect a trace from app startup.
167179

168180
- **`--duration <time-to-run>`**
169181

@@ -177,6 +189,9 @@ dotnet-trace collect [--buffersize <size>] [--clreventlevel <clreventlevel>] [--
177189

178190
The process ID to collect the trace from.
179191

192+
> [!NOTE]
193+
> On Linux and macOS, using this option requires the target application and `dotnet-trace` to share the same `TMPDIR` environment variable. Otherwise, the command will time out.
194+
180195
- **`--profile <profile-name>`**
181196

182197
A named pre-defined set of provider configurations that allows common tracing scenarios to be specified succinctly. The following profiles are available:
@@ -230,8 +245,6 @@ dotnet-trace collect [--buffersize <size>] [--clreventlevel <clreventlevel>] [--
230245
231246
> - Stopping the trace may take a long time (up to minutes) for large applications. The runtime needs to send over the type cache for all managed code that was captured in the trace.
232247
233-
> - On Linux and macOS, this command expects the target application and `dotnet-trace` to share the same `TMPDIR` environment variable. Otherwise, the command will time out.
234-
235248
> - To collect a trace using `dotnet-trace`, it needs to be run as the same user as the user running the target process or as root. Otherwise, the tool will fail to establish a connection with the target process.
236249
237250
> - If you experience an unhandled exception while running `dotnet-trace collect`, this results in an incomplete trace. If finding the root cause of the exception is your priority, navigate to [Collect dumps on crash](collect-dumps-crash.md). As a result of the unhandled exception, the trace is truncated when the runtime shuts down to prevent other undesired behavior such as a hang or data corruption. Even though the trace is incomplete, you can still open it to see what happened leading up to the failure. However, it will be missing Rundown information (this happens at the end of a trace) so stacks might be unresolved (depending on what providers were turned on). Open the trace by executing PerfView with the `/ContinueOnError` flag at the command line. The logs will also contain the location the exception was fired.

0 commit comments

Comments
 (0)