Replies: 1 comment
|
The rc.7 JSONL scanner supports one narrow crash case: That makes the backwards Useful regression gates for a fix: two processes cannot append to one session; the loser fails before writing; torn-tail recovery remains limited to the uncommitted tail; committed sequences stay contiguous after restart; errors identify the session without exposing message content. I mapped this signature separately from Zstandard framing and client-side tool-ID collisions here: https://sandbaseai.github.io/deepseek-harness-handbook/session-history-recovery.html Disclosure: independent SandBase community handbook, not official DeepSeek documentation. |
Uh oh!
There was an error while loading. Please reload this page.
[Bug] Concurrent writing to the same session log corrupts seq (error:
corrupt session log: seq gap in committed region)Summary
When two DSH instances write to the same session at the same time (e.g. the web instance on :3080 and a desktop/client instance), the session log's
seqcounter races and can go backwards, producing:Newer builds validate the committed region strictly and refuse to load the whole session history once this happens, so the affected conversation becomes unreadable.
Environment
0.1.0-rc.7(/opt/homebrew/bin/dsh, managed by PM2)v26.3.0Root cause (observed evidence)
The corrupt session
session.jsonl.zstdcontains a seq that jumps backwards (not the normal forward gaps caused byassistant/chunkstreaming):Line 9 should continue from
seq=6(i.e.7, 8, 9, …) but was written starting again fromseq=4. The timestamp gap (~36 minutes) and the duplicated4,5,6sequence indicate two instances were appending to the same file concurrently, each unaware of the other's counter.I repaired it locally by re-numbering every
seqfrom line 9 onward by+3, which restores strict monotonic increase and recovers the history without dropping any content. But this is a data-corruption bug — the writer should make per-session seq allocation atomic / single-writer.Related issue
A separate symptom of the same concurrency situation: when the process is restarted under PM2 while the previous
dshprocess hasn't released port 3080 yet, the new instance crashes withlisten EADDRINUSE: address already in use 127.0.0.1:3080, and PM2 enters a crash-restart loop (observed 431 restarts). It eventually self-resolves once a process wins the port, but the port-bind error / restart loop may deserve a look too.Suggestion
seqallocation single-writer (e.g. a session-level append lock, or derive seq from a shared counter) so concurrent instances can't race.committed regionvalidation to tolerate (and maybe auto-repair) a small backwards gap instead of making the whole history unreadable, or at least surface a clearer recovery path.Thanks for the great tool!
All reactions