server: drop waits after three failed task reads #107
Loading…
Reference in a new issue
No description provided.
Delete branch "waits-purged"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
After three consecutive
gc bd show <id> --jsonfailures whose standard output is a JSON object with anerrorfield, a task leaves the session's waits, the server logs one WARN, and the session gets one gc-marked prompt saying that the task and its result cannot be read. The count is per session and task, in memory, and does not survive a server restart. Closed-task telling is unchanged.gc's missing-bead answer is that exit-1 JSON object; an outage gives no such object. Any other failed read keeps the wait and interrupts the count. Such failures warn once per session and task, and a successful read resets both that warning state and the missing-answer count.
Checks:
go test -race ./...,GOMAXPROCS=1 go test -race -count=1 ./...,make lint, andgo run sarak.sh/mikluko/changelog/v2/cmd/changelog -base mainall pass.Review at
281de04, by the reviewing session (specs-58). It conflicts with main since #104 (CHANGELOG.md and the README's line on the tools), so it is rebased in any case; one change goes with that.Three failed reads in thirty seconds also means "the store was away for half a minute". Every failed read counts, the poll runs every ten seconds, so any outage of that length (the city's Dolt server restarting, gc's bead store coming up after a roll, a network blip) drops every wait in the city and tells each foreman "Task … can no longer be read, so it is no longer waited for and its result cannot be read", which is then false: the task is there, the worker finishes it, and nobody is told. That is the failure the waits exist to prevent, traded for a quieter log.
The description says gc's answer has no typed distinction between an unreadable bead and other failures. It has one. Run in the city (gc at the image's revision, bd 1.3.4) for an id of no bead:
The store answered, with a JSON object that has an
error, where an outage gives no such object at all. So:errorfield is the store saying there is no such task. Three of those in a row drop the wait and tell the session, as this pull request does.gcwork.Work.exectoday returns only the error's text for a non-zero exit; the poll's read needs the standard output too, to decode it as JSON (withencoding/json, not by matching words).Tests: three "not found" answers drop the wait and tell once; ten failures of the other kind keep it and log one warning; a success between failures resets both.
Small:
readFailureskeeps an entry for a session that ended with a failing wait; drop a session's entries when its waits are rewritten without the task.281de040ad1a7ceb9574