Skip to content

Commit b417321

Browse files
t3dotggclaude
andcommitted
docs(observability): check the server pid before sending SIGUSR2
server-runtime.json keeps its pid after a crash, and that pid can later belong to a different process that exits on SIGUSR2. The heap snapshot steps now show the process with ps before they send the signal. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
1 parent 1020597 commit b417321

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

‎docs/operations/observability.md‎

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -628,10 +628,18 @@ on macOS and Linux. Windows has no `SIGUSR2`.
628628
Send the signal to the server pid in `server-runtime.json`, which sits in the server's state dir
629629
next to the `logs` dir. For a dev server or a `--home-dir` launch, use that server's state dir from
630630
[Traces](#traces). Do not send it to the desktop app or the service launcher: a process without the
631-
handler exits on `SIGUSR2`.
631+
handler exits on `SIGUSR2`. After a crash the file can keep a stale pid that now belongs to a
632+
different process, so check the pid first.
632633

633634
```bash
634-
kill -USR2 "$(jq .pid "${T3CODE_HOME:-$HOME/.t3}/userdata/server-runtime.json")"
635+
pid="$(jq .pid "${T3CODE_HOME:-$HOME/.t3}/userdata/server-runtime.json")"
636+
ps -p "$pid" -o command=
637+
```
638+
639+
If `ps` shows the T3 Code server, send the signal:
640+
641+
```bash
642+
kill -USR2 "$pid"
635643
```
636644

637645
The file is `<logsDir>/server-<pid>-<timestamp>.heapsnapshot`, next to `server.trace.ndjson`. To

0 commit comments

Comments
 (0)