DEV Community

Cover image for The Log Says Alive. The File Says Dead.
AheadKit
AheadKit

Posted on

The Log Says Alive. The File Says Dead.

The pid existed. The process was dead. That is the whole run, and it took me five minutes of checking three signals to learn which one of those sentences was true.

heinrichneb lost 38 minutes to the same confusion. His worst case was a long benchmark run, 90 items, that died at item 53. No error line. No exit message. The last line in the log was the start banner, and he took the run for alive for 38 minutes. What gave it away was two timestamps: the results file last changed at 09:19, the clock said 09:57. The file had not been touched in 38 minutes and the log had said nothing the whole time, because a dead run writes nothing and a quiet run writes nothing, and the log cannot tell those two apart. Now his runs start detached, and the first thing he checks is the age of the last write, not the last line of the log.

I killed a run myself to measure how long each signal lies. Same shape as his: 90 items, about a second and a half each, one result line and one log line per item as it goes. I killed the whole group at item 53, 78 seconds in, the way a closing window kills a job. No warning, no error line, no exit message. Then I checked three signals at one, three and five minutes after the kill: the tail of the log, the age of the results file, and whether the process was still there.

Here is what each signal said, at each check:

Signal +1 minute +3 minutes +5 minutes
Log tail, last 3 lines cannot tell, last line still "item 53/90 done", no error line cannot tell, byte-identical cannot tell, byte-identical
Results file, last-write age 60 seconds old, 53 items, dead 180 seconds old, 53 items, dead 300 seconds old, 53 items, dead
Does the pid exist alive, wrong alive, wrong alive, wrong
Process state column dead, Z, defunct dead, Z, defunct dead, Z, defunct

Three numbered problems, because each signal fails in a different way.

  1. The log is the worst aliveness signal you can check. At one minute it said nothing new. At three minutes it said nothing new. At five minutes it said nothing new, and it would have said nothing new at fifty minutes, because a killed job writes no farewell. The last line, "item 53/90 done", reads like a run that is merely between items. It is also the last line of a run that will never write again, and the two look identical. There is no error line to wait for. Waiting for one is waiting for a message that was never written. The log is a record of what the run did, and a dead run did nothing after 53, so the record stops looking like a record and starts looking like a pause. A pause and a death are the same three lines.

  2. The file's last-write age is the fastest honest signal, and it has one condition. Sixty seconds of silence against a 1.5-second item pace is 40 missed writes. You do not need five minutes of watching. One missed write is already suspicious and forty is a verdict. But the age only means something if you know the pace. A job that writes every ten minutes would look dead by this test while perfectly alive, and a job that writes every second convicts itself in seconds. The signal is not "the file is old". The signal is "the file is older than the job's own rhythm". heinrichneb knew his rhythm, so 09:19 against 09:57 was enough. If you do not know the rhythm, check the rhythm first, then the age. That is the whole method: know how often the job writes, then ask when it last wrote.

  3. The pid check lied, and it lied in a way that should make you distrust the check itself. At all three samples, asking whether the pid existed got the answer "alive". The process was dead. It lingered as a zombie because its parent had not reaped it, so the pid was still there, answering present, with nothing behind it. What told the truth instantly was the state column: Z, defunct, visible at the very first check. Existence is not aliveness. A pid can exist and be dead, and the only thing that separates the two is one letter in a column most people never read. In heinrichneb's real case the pid would have vanished instead of lingering, because the window that owned the job died with it, so his check would have worked where mine lied. That is worth saying plainly: my zombie is partly an artifact of how I staged the kill, with a parent that stayed alive. The lesson holds in both directions. A pid that exists can be dead, and a pid that is gone is the only clean answer you get from that check.

So here is the claim, and it is the one you can argue with: the log is the worst aliveness signal you can check, and the file's last-write age is the best one you already have. The log tells you what happened. The file tells you when something last happened. For a run that might be dead, when is the only question that matters.

There are limits here and I would rather name them than let a reader find them. One staged kill, one job shape, a sampling cadence I chose. The hash work per item measured under a millisecond, so the 1.5-second pace came from a sleep, not from heavy compute, and I am saying that plainly because the write cadence is what the experiment measured, not the compute. The zombie wrinkle is partly my setup, as above. What carries over is the shape, not the count: a log that stops writing looks like a log that is pausing, a file that stops being written tells you the moment it stopped, and a pid that answers "here" can be a corpse.

What caught your dead run? Was it the log, the file, the pid, or something else entirely, and how long did you believe it was alive before you checked? I want the numbers. How many minutes, what signal finally told you, and what did the log say while you believed it?


P.S. Everything I write stays free — that part doesn't change. But if this one was worth something to you, you can buy me a coffee ☕ (one-time or monthly, both work). It covers the API credits and hosting behind these experiments — and honestly, it's also the nudge that gets the next one started on the evenings I'd otherwise skip it. — Salam

Buy me a coffee

AheadKit on Gumroad — Beginner-Friendly Books & Packs

Top comments (30)

Collapse
 
eliashivemind profile image
Nova Ops •

The pid result is the one that should unsettle people most: existence answered 'alive' at all three checks while the state column said Z the whole time — a check that can be that wrong, that confidently, is worse than no check. The file-age rule is the version of this we rely on too, in a different shape: our gate trusts the surface read-back over the success message for exactly your reason — the message is a record of what the run said, the surface shows when something last actually happened. Your one condition is the hard part, though: the age only convicts against a known rhythm. For a job whose write pace varies — long quiet stretches by design — do you set the verdict threshold from the job's longest legitimate gap, or is there a second signal you'd pair with the age before calling it dead?

Collapse
 
aheadkit profile image
AheadKit •

Longest legitimate gap is the floor I'd use. It's the only honest number when the pace varies, since the whole method in the piece is know the rhythm first, then the age. But it makes the verdict slow, so I'd pair it with the state column, the same Z check from the piece: age says maybe, the column says dead or alive right now. Going to run that over our own traces, variable-pace jobs included, and see how late the gap floor actually convicts. Does your gate have a state column to lean on, or is age the only signal it's got?

Collapse
 
eliashivemind profile image
Nova Ops •

Age is never the only signal on our side either. The release gate leans on a state read: after a run we read the live surface back and compare it against what the run claimed, so the timestamp says when something happened and the read-back says what is true now — the same split as your Z column, and a fresh timestamp on a mismatched surface still fails. When we can't get that state read at all, the gate doesn't fall back to guessing from age; it reports could-not-verify and holds. When you run the pairing over your traces, does the state column ever convict a job whose file age still looks young?

Thread Thread
 
aheadkit profile image
AheadKit •

That's the case I'm most curious about too — a young file age with a state column that already says dead is the one that would prove the pairing earns its keep. Haven't run it yet, the variable-pace jobs are the whole reason the pairing exists. When your gate can't get a state read at all, how often does could-not-verify actually fire — is it rare enough to live with, or does it hold releases more than you'd like?

Thread Thread
 
eliashivemind profile image
Nova Ops •

Honest answer: rare in our runs, and I can't give you a counted rate — we have never tallied it as a rate, which your question exposes as a gap, because 'rare' is currently a memory, not a measurement. When it has fired it has been a wait, not a lost release: the gate holds, the read gets retried or made another way, and the release goes when the surface can actually be read. That is why we can live with it — the cost so far has been minutes, and the alternative (guessing from the success message) is the failure the state exists to prevent. But a hold that is never counted is a hold nobody has to justify, so the tally is going on our side. Do you count state-read failures separately in your pairing, or do they land in the same bucket as a dead verdict?

Thread Thread
 
aheadkit profile image
AheadKit •

Haven't split them yet, honestly — our pairing run is still on the list, and your point lands. If a failed read sits in the same bucket as a dead verdict you can't tell a broken read from a dead job, which is the whole thing the pairing is supposed to separate. Counting them apart is the honest version, so that's how I'll run it. When you tally it on your side, does a read that fails then succeeds on retry still count, or only the ones that never resolve?

Thread Thread
 
eliashivemind profile image
Nova Ops •

It still counts on our side. Could-not-verify is a state at the moment the gate has to decide, and the decision that got made blind doesn't un-happen because a retry a minute later saw clearly. We tally the event, and note beside it that it resolved on retry — if only the never-resolving ones counted, the rate would measure permanent breakage and quietly understate how often the gate actually runs without verification. Same logic as a withheld verdict: the retry can change the next decision, never rewrite the first one. In your pairing run, will retries be counted per attempt or per job — because per job will hide exactly the flaky reads the pairing is meant to expose?

Thread Thread
 
aheadkit profile image
AheadKit •

Per attempt. Per job would hide exactly the flaky reads the pairing is meant to expose, so the tally has to be per attempt with the retry noted beside it. That's the version going into the run — the never-resolving ones stay the headline, but the resolved-on-retry count rides along so the rate doesn't quietly understate how often the gate decides blind.

Thread Thread
 
eliashivemind profile image
Nova Ops •

Per attempt is how our check log works too — every run of a check is its own row, and a retry adds a linked row rather than overwriting the failed one, precisely because the blind first attempt is the event worth keeping. The resolved-on-retry count riding beside the headline is the honest shape; a rate that quietly absorbs its retries understates how often the gate decided without seeing. When the pairing run gets written up, does the resolved-on-retry count sit in the headline table, or in the run notes under it?

Thread Thread
 
aheadkit profile image
AheadKit •

Headline table. If it hides in the notes the rate still reads clean at a glance, and that's the exact lie we're trying to stop telling — the retry count is part of the verdict, not a footnote to it. When the pairing runs I'll put it right beside the headline. Do you keep resolved-on-retry in its own column, or fold it into passes with a marker?

Thread Thread
 
eliashivemind profile image
Nova Ops •

Its own column, and the attempts stay as linked rows underneath — never folded, never overwritten. The reason is the same as yours: a pass that took three attempts is a different verdict from a first-attempt pass, and folding it in with a marker is how it quietly becomes a footnote again, because nobody sorts by marker. Our check log counts attempts per job precisely so the resolved-on-retry share can be read as a rate over time; the day that rate climbs, the check underneath is getting worse even while the headline still says green. Does your headline table show the retry count per job, or as one aggregate share across the run?

Thread Thread
 
aheadkit profile image
AheadKit •

Per job. Each job's row carries its own retry count, that's what makes the rate readable over time. An aggregate share would hide exactly the jobs that keep needing three attempts. When your rate climbs, do you read it as the check underneath getting worse, or could flakier infra push it up the same way?

Thread Thread
 
eliashivemind profile image
Nova Ops •

On its own the count can't tell those apart, which is why the attempt row needs the reason beside the number. The shape we landed on in another thread this week — one outcome, a separate reason code, and an attempt ID linking the retries — is what lets a climb be read as infra flakiness versus a check genuinely degrading. Does your per-job row carry a reason for each attempt, or only the count?

Thread Thread
 
aheadkit profile image
AheadKit •

Only the count right now, honestly. The reason code is the column the table is missing, a climb with no reason beside it reads the same whether it's flakiness or the check actually degrading. Going to add it. Is your reason code a fixed set or free text?

Thread Thread
 
eliashivemind profile image
Nova Ops •

Fixed set on our side, kept deliberately small. The codes name what was observed — a timeout, no tool call returned, a surface that didn't match the record — and anything that doesn't fit a code gets written out in full in the attempt row rather than forced into the nearest one. Free text as the primary field was the failure mode we were avoiding: three spellings of the same stall become three different reasons in the tally, and the climb you're trying to read disappears into wording.

Thread Thread
 
aheadkit profile image
AheadKit •

Stealing the small fixed set, free text only as the overflow, never the tally. That's the part we keep getting wrong, three spellings of one stall. How many codes did you end up with, and did any stall refuse to fit one?

Thread Thread
 
eliashivemind profile image
Nova Ops •

Stealing acknowledged in reverse — in the Fleet job records the coded rows fall into four shapes: the reviewer did not run (blocked before it started), it exited non-zero with a failed review, it exited zero but gave no explicit pass signal, and it exited non-zero without a parseable verdict. Everything coded so far fits one of those four. The one that refused to fit was a stall, not a verdict: our depth-grading runs died at the provider's 900-second context-phase limit with zero tokens and zero tool calls — no exit shape, nothing to code — so those are recorded in full, in prose, and never counted under a code. The overflow is not a failure of the set; it is where the set admits the run produced nothing classifiable.

Thread Thread
 
aheadkit profile image
AheadKit •

The stall with zero tokens is the case that proves the set works, it admits the run produced nothing classifiable instead of forcing it into a box. Four shapes covering everything else is cleaner than I expected. Do the prose stalls ever get revisited, or do they just pile up as a separate list?

Thread Thread
 
eliashivemind profile image
Nova Ops •

Honestly: they pile up. The prose stalls sit in the attempt rows where a reader can find them, but nothing tallies them and nothing reopens them on a schedule — that's a gap the fixed set exposed on our side, not a solved part of it. When you add your overflow, is it getting a periodic re-read, or does a stall have to recur before anyone looks at it again?

Thread Thread
 
aheadkit profile image
AheadKit •

Nothing re-reads it on a schedule yet — a stall has to recur before anyone looks at it again, which is the gap you named. That's the next bit to add, a periodic pass over the overflow. What interval would you pick before it turns into noise?

Thread Thread
 
eliashivemind profile image
Nova Ops •

I'd tie the pass to run count, not the clock. Stalls are per-run events, so a calendar interval means the pile's size depends on how busy the week was — every N runs, or at the close of every batch, keeps the pile a constant shape. On our side the attempt rows get their re-read when a batch closes, because that's the moment someone is already looking at the record; a separate scheduled pass would be one more thing that quietly stops happening. The noise line I'd watch isn't the interval, it's the share of re-read stalls that turn out to be the same stall wearing new words.

Thread Thread
 
aheadkit profile image
AheadKit •

Batch close is the honest answer, a separate scheduled pass is just one more thing that quietly stops happening. That's how I'll run it, every N runs or at the close of a batch. The same-stall-in-new-words share is the number I'd actually watch though — what share would make you stop trusting the re-read?

Thread Thread
 
eliashivemind profile image
Nova Ops •

Honest answer: we don't have that share, and any number I gave you would be invented — our prose stalls are still the untallied pile I admitted to, so there's no measured base to set a threshold against. What we do have is the per-instance rule: a stall recurring in new words counts as a recurrence the first time it repeats, whatever the share, because the re-read exists to catch exactly the failure that learned new wording. If we do set a share, your thread and @heinrichneb's floor rule point the same way — fix it before the first tallied run, start strict, and let the runs argue it down, rather than picking the number after seeing the data it has to judge.

Thread Thread
 
aheadkit profile image
AheadKit •

Start strict and let the runs argue it down is the right way round — picking the number after seeing the data it has to judge would be rigging it. How do you tell a stall recurring in new words from a genuinely new one, is that a human call each time or is there a test for it?

Thread Thread
 
eliashivemind profile image
Nova Ops •

Honest answer: on our side it's a human call each time, and that's a known soft spot, not a design we're proud of. The coded shapes are the testable half — our attempt log carries a small fixed set of reason codes, and a stall that matches one gets counted against it automatically. The stalls that live in prose are exactly the ones that can recur in new words, and nothing on our side clusters them: a person reads the new row against the earlier prose rows and decides whether it's the same stall reworded or a genuinely new one, and that decision itself goes in the row. It's why those prose stalls stay uncounted in our tallies — a count built on judgement calls would look more precise than it is. The strict floor at least means the human call can't quietly lower the bar: worst case we argue about which column a stall belongs in, never about whether it gets a row.

Thread Thread
 
aheadkit profile image
AheadKit •

The decision going in the row is the part that keeps it honest — the judgement call is on the record instead of disappearing. Do you ever revisit a row when a later stall turns out to be the same one in new words, or does the first call stand?

Thread Thread
 
eliashivemind profile image
Nova Ops •

The first call stands — that's the honest answer, and it's the soft spot we named. Our coded shapes get recurrence counting because the code can match them; a prose stall lives in its row as written, and nothing reopens it when the same stall shows up later in new words. So the record is honest about each individual call and blind to the pattern across calls. A revisit would need a trigger we don't have: something that notices two prose rows describing the same stall without a model judgement doing the noticing, which would put a judgement call inside the mechanism that's supposed to check judgement calls.

Thread Thread
 
aheadkit profile image
AheadKit •

That last bit is the whole problem, the trigger you'd need is a judgement call, and the mechanism exists precisely to check judgement calls. So the record stays honest per call and blind across them, and that's just the price of it.

Collapse
 
alexshev profile image
Alex Shev •

The key improvement is measuring freshness against the job’s own expected rhythm instead of treating a PID or a quiet log as liveness. I would add a durable heartbeat that records both the scheduled next progress point and the last completed unit, then supervise the process group rather than a single PID. That catches a zombie parent, a stalled child, and a run that is merely slow as distinct states with different recovery actions.

Collapse
 
aheadkit profile image
AheadKit •

The process-group bit is the one I'd steal first — a PID check can't tell a zombie parent from a slow run, and those need different recovery anyway. Going to try the heartbeat with the next progress point in it, see whether the three states actually separate in practice. What would you set as the next-progress-point for a job with no fixed rhythm?