Repository navigation
feat: collect the running instance's goroutine stacks in lich rage - #246
Merged
Merged
Conversation
A lich whose window stops updating while the process is still alive writes
nothing to lich.log: nothing panicked, nothing exited, and a panic already
reaches the log (debug.SetCrashOutput, v0.23.0). So a freeze report arrives
with no evidence in it at all.
The transport gains a token-gated /debug/goroutines serving
pprof.Lookup("goroutine") at debug level 2 — one dump of one thing, not
net/http/pprof's whole surface — and `lich rage` fetches it into the bundle
as goroutines.txt whenever an instance is answering. A five-second bound on
the fetch keeps the bundle finite; an instance that holds its port and will
not answer within it leaves that sentence in the file, which is itself the
finding.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Two Windows users report the same failure: lich freezes, the window stays on screen, the UI stops talking to the backend — and
lich.logholds nothing.Nothing is missing on the crash side.
debug.SetCrashOutputhas routed panics tolich.logsince v0.23.0 (#124, which was this exact shape on Windows), and there is norecover()anywhere, so any panic kills the process and leaves its trace in the log. An empty log therefore says the opposite of what it looks like: it probably did not panic. It hung, or it was killed without one.For that case lich collects nothing at all. Every diagnostic it has answers the question "is it running?" — none answers "what is it stuck on?".
What
internal/terminal/transport.go— a token-gatedGET /debug/goroutinesservingpprof.Lookup("goroutine").WriteTo(w, 2). Deliberately notnet/http/pprof: one dump of one thing, not a profiling surface registered on the default mux.internal/rage/rage.go—lich ragefetches it into the bundle asgoroutines.txtwhenever an instance is answering, masked by the same scrub the logs go through. The fetch is bounded at 5s, and a lich that holds its port but will not answer within it leaves that sentence in the file — which is the finding, not a failure of the bundle.Nothing else changes, and the endpoint costs nothing until someone asks for it.
Test plan
go test ./...— 1304 pass, including the new endpoint (200 with the stacks, 401 without the token) and the three rage cases (running, running-but-silent, not running).go test -race ./internal/rage/... ./internal/terminal/...gofmt -l .clean,go vet ./...clean.lich rage, readgoroutines.txtout of the archive.Frontend untouched, so its gate was not run.