1ccacad63281094de8a3372d5a507d38f9969e5c
2
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
5399c33728 |
healthcheck, update and status find the running gateway by its own record (ljlwlcz on X)
The gateway now writes gateway.json (addr, pid, role, version) in magpie's config folder while it serves; healthcheck, update, status and the other CLI clients read it when MAGPIE_ADDR is unset, trusting it only if the pid on GET / matches. --addr overrides. New: magpie status [--json] for watchdogs (role, pid, listen address). Run: new gateway and cli tests on Windows via win-run (pass); broken by hand (record disabled): they go red; gofmt; vet windows and linux nogui. Not run: mote/Linux (SSH down, WSL broken), darwin vet, a real systemd service. TestEveryRouteHasACommandOrIsNamed is red on the base for two GUI routes, unrelated to this change. |
||
|
|
b18a6a080b |
gateway, cli: magpie goroutines writes the running magpie's goroutine stacks to a file (#3362)
#3362's second ask: an app stuck at something could only be read by killing it, which ends what was stuck. magpie heap and magpie cpu already ask the running gateway for a profile over loopback; magpie goroutines asks it for every goroutine's stack. That works on Windows too, where there is no SIGUSR1. GET /v1/magpie/goroutines (goroutines.go) answers the callers /v1/magpie/heap answers (profileRefused: a program on this computer over loopback, no browser mark, a loopback Host; a gateway key lets nothing else in) with runtime/pprof's goroutine profile at debug=2, the form a crash prints: each goroutine's state and wait ("[select, 4320 minutes]"), its frames with source lines, and who started it. It is text/plain and no-store, and X-Magpie-Goroutine-Stats names the process (pid, program, version, window, uptime, goroutine count). Arguments are words in hex, never what they point at, so the dump holds no keys, prompts or messages; it does name magpie's source files and the program's path, which the usage says. magpie goroutines [<file>] writes it to <file>, else magpie-goroutines-<date>-<time>.txt in this folder, 0600 and never over a file there, then prints the file and the process. --help, -h and help print the usage and ask nothing; a flag it doesn't take, "-", a blank name or a second file are refused before the gateway is asked. A magpie older than this one answers 404 and is told to update; with none answering, it says so. The refused callers TestHeapProfileOnlyToThisComputer listed move into profileCallersRefused, which the CPU test and the new one share. Run on |