fix(daemon): daemon stop reports a failed stop for a daemon that exits just before SIGTERM
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 68/100
Research direction
Start in internal/daemon/stop.go, in stopTargets, where the error from stopSignal is appended to the joined error. The POSIX sender is sendStop in internal/daemon/stop_posix.go. Decide whether an os.ErrProcessDone result counts as stopped or is skipped, then handle it with errors.Is. Done when a test that injects os.ErrProcessDone through the stopSignal seam shows no error from daemon stop.
Written by the indexing model from the issue text.
Description
Problem
stopTargets (internal/daemon/stop.go) checks each record with isStale, and then sends SIGTERM through stopSignal. On POSIX that is sendStop (internal/daemon/stop_posix.go): os.FindProcess(pid), then proc.Signal(syscall.SIGTERM).
A daemon can exit between the isStale check and the signal. proc.Signal then returns os.ErrProcessDone ("os: process already finished"), and stopTargets adds it to the joined error:
if err := stopSignal(rec.PID); err != nil {
errs = append(errs, fmt.Errorf("stopping pid %d: %w", rec.PID, err))
continue
}
So codegraph daemon stop exits 1 with stopping pid N: os: process already finished, although the daemon is gone, which is what the user asked for. With #179, a stop that stopped nothing and failed prints nothing on stdout, so the user sees only that error.
Evidence
- A scratch program in the suite review of #179 showed that SIGTERM to an exited pid returns
os.ErrProcessDone. - The race was not reproduced through the command itself. The window between
isStaleand the signal is short.
Possible direction
- In
stopTargets, handleerrors.Is(err, os.ErrProcessDone)without adding an error. - Decide whether such a record counts as stopped (the process is gone, so
stopped pid Nis true) or is skipped like a stale record. - Add a test through the
stopSignalseam that returnsos.ErrProcessDone.
Found by the silent-failure reviewer in the suite review of #179 (finding QUAL-4, PLAUSIBLE). The code predates #179.
🤖 Generated with Claude Code
- Dominant language
- Go
- Stars
- 0
- Forks
- 0
- Avg merge
- 5h 16m
- Merged PRs (30d)
- 107
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from seanb4t/codegraph-go
-
area:indexer bug needs-triage
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
seanb4t/codegraph-go#385 ·
Maintainers usually reply within 1 day
-
chore needs-triage
Difficulty 1/5 Under an hour Newbie friendliness 88/100
seanb4t/codegraph-go#380 ·
Maintainers usually reply within 1 day
-
chore needs-triage
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
seanb4t/codegraph-go#379 ·
Maintainers usually reply within 1 day
-
chore needs-triage
Difficulty 1/5 1-3 hours Newbie friendliness 84/100
seanb4t/codegraph-go#362 ·
Maintainers usually reply within 1 day
-
area:query bug priority:low spec-needed
Difficulty 2/5 1-3 hours Newbie friendliness 80/100
seanb4t/codegraph-go#355 ·
Maintainers usually reply within 1 day
All issues in seanb4t/codegraph-go
Similar issues
-
enhancement exporter/awskinesis needs triage
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
open-telemetry/opentelemetry-collector-contrib#53334 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
erigontech/erigon#26523 ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 83/100
SocialGouv/iterion#3376 ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 72/100
seaweedfs/seaweedfs#12740 · 2 comments ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
Maintainers usually reply within 1 day