Repository navigation
Description
Is there an existing issue for the same bug?
- I have checked the existing issues.
Repository searches for Tan EOF and getEntries found no matching issues. Broader recovery searches found logtail/snapshot-retention issues with different mechanisms.
Branch Name
main; also reproduced with the official v4.2.5 binary.
Commit ID
Actually built and executed main: c3c458159523242bf84e3249ef8c28f22b631d9b.
Official release: 1a44f3db3056e32975fde86ca0ab69a094996a3f.
Tan dependency in release: github.com/matrixorigin/dragonboat/[email protected].
Tan dependency in tested main: github.com/matrixorigin/dragonboat/[email protected].
Other Environment Information
- Ubuntu 24.04.3 LTS, x86_64; independently owned local LogService,
GOMAXPROCS=4,GOMEMLIMIT=6GiB. - Release executable SHA256:
5d136df6fab5e7a5bdf4ba3e678470d898c8d681f3fdae99095ecd9c4205d2ed; verified against the official v4.2.5 archive SHA256a0e0aad81a914d6cd7081f68bbfb7695cba20544ca4c8f37358f4005067b8da1. - Tested main executable SHA256:
28bfb7a2238a7373e880c17aa992f78fe1559018c3dd84c649dd2da0a9e95093. Officialbuild-with-prebuilt-nativetarget succeeded; all 11,193 source archive members checked unchanged. Matching native inputs were reused from a successful official native build; no production patch. - Every service test used a new, SHA256-verified copy of a protected release-origin snapshot. Originals remained unchanged. The main copy was permanently marked main-owned before launch; no main-to-release execution occurred.
- The standalone LogService comparisons ran after business workloads and compilation stopped. No TN/CN or SQL traffic was used in these component comparisons.
Actual Behavior
Precondition: the retained LogDB is already inconsistent: a persisted index refers to a log record at/beyond EOF. This report concerns the reader's failure to reject that condition and make progress. How the original log/index divergence was produced remains under investigation. This is not a claim that every normal release restart corrupts data.
In both the official release and current tested main, Tan repeatedly opens/seeks the same log/index entry instead of returning an unavailable/corruption error. The Raft step worker cannot finish recovery; subsequent shard-readiness checks fail. Shutdown also waits on this worker.
Independent, read-only decoding of the published Tan chunk/update/index formats, with the implementation's actual 32-bit xxhash checksum, found:
| Retained scene | Indexed missing range | Referenced log | First invalid offset | Actual log size |
|---|---|---|---|---|
| Original clean-stop scene | 151200–151201 | 000015.log | 67102599 (0x3ffe787) |
67102599 |
| Earlier SIGKILL scene | 39978–40077 | 000003.log | 66788935 (0x3fb1e47) |
66788935 |
For the first scene, the last complete entry decoded from log 15 is 151199; log 16 starts at 151202. The first missing entry is after the Raft snapshot index 135713 and inside the persisted committed range ending at 193906. The remaining complete chunks decode/checksum successfully. No file was truncated, patched, or index-deleted by this investigation.
Actual official-binary tests:
- Full
-launchrelease tests on fresh copies of both protected scenes self-exited with code 2 after approximately 34/33 seconds, atwaitAnyShardReady's 30-second deadline. - Release LogService-only test, eliminating that launch deadline and all TN/CN clients: observed 120.232 s. Goroutine snapshots at 5/30/60/110 seconds stayed in
tan.(*db).readLog/getEntriesat index 151200, file 15, offset0x3ffe787. - Tested main LogService-only, equivalent fresh input copy and configuration: observed 120.551 s, same persisted entry and offset at all four snapshots. The stacks resolve to
abc3d2fce5a6/internal/tan/db.go, not a model harness. - CPU profiles show the Raft entry-loading path repeatedly opening/seeking/allocating; the release component averaged roughly 1.48 CPU cores over the observation. Both standalone tests required harness SIGKILL after SIGINT/SIGTERM shutdown deadlines; exit
-9is harness cleanup, not spontaneous failure or successful recovery.
Expected Behavior
An index range that cannot be read must produce a specific storage-integrity/unavailable error without an unbounded no-progress loop. Service shutdown should be able to terminate the reader. Missing committed records must not be silently skipped or fabricated to obtain a successful startup.
Steps to Reproduce
-
Use a retained inconsistent release-origin fixture containing the complete original LogService directory and launch configuration. The exact original bytes and full diagnostic copies are preserved in
matrixone425-business-stability.zipandmatrixone425-restart-debug-20261014-2330.zip; the reporter can provide them. They were not created by manually truncating a valid store for this investigation. -
Copy the entire source directory to a new destination and verify its complete SHA256 manifest before launch. Rebase all configuration paths into that copy, preserving service UUID, explicit hostname, and storage format.
-
Launch the official v4.2.5 binary as LogService only, bypassing the local cluster launcher:
/path/to/official-v4.2.5/mo-service -cfg /path/to/copy/log.toml -debug-http 127.0.0.1:7088
-
Capture
/debug/pprof/goroutine?debug=2at 5/30/60/110 seconds and a short CPU profile. Observe the unchangedreadLogentry/offset. Do not reset WAL, remove indexes, or treat absent SQL readiness as an audit pass. -
Stop the task-owned component, recording bounded shutdown and any escalation. Preserve the changed copy and keep the original immutable.
-
Starting again from the release original, create a second fresh copy and run tested main with its matching libraries and the same LogService configuration. Do not open any main-used copy with the release. The tested main comparison above reproduced the same entry-loading loop.
Additional information
Observed main stack includes:
tan.(*db).readLog(..., {0x24ea0, 0x24ea0, 0xf, 0x3ffe787, 0x0}, ...)
tan.(*db).getEntries(...)
tan.(*LogDB).IterateEntries(...)
logdb.(*LogReader).entriesLocked(...)
raft.(*entryLog).getEntriesToApply(...)
dragonboat.(*engine).stepWorkerMain(...)
The no-progress mechanism is localized in internal/tan/db.go in both exact dependency versions:
readLogconvertsrr.next()returningio.EOFinto a nil error.getEntriesadvancespassedonly when its callback sees saved entries. At EOF that callback is never invoked.- The outer loop has neither a no-progress guard nor a cancellation check, so it invokes
readLog(ies[passed], ...)again with the same entry indefinitely. Itserr == io.EOFbranch cannot help whenreadLoghas already returned nil.
This source explanation is corroborated by unchanged runtime arguments across four time points in both actual binaries. It is distinct from CDC catalog migration issue #30215.
Usage controls: release-origin stores were verified against saved byte manifests; no downgrade, manual storage edit, reset, or live-copy operation was performed by the diagnostic runs. A healthy release control has zero EOF index violations and completed a further 904.748 s mixed workload plus clean restart/audits. Two new release controls also passed 12,000 changing-payload updates and three clean restarts each. Those successful controls do not recover the protected failed stores or identify the earlier divergence's cause. A separate one-off prepared-update audit anomaly remains unconfirmed and is not part of this issue.
Activity
XuPeng-SH commentedon Oct 15, 2026
Revalidated on 2026-10-15 against freshly fetched/built main
17a6200f59e764729e5544908fffd5480ae88279(actual executable SHA256778bf2982bd0e5a7637d8dddfb2d2e60d5dfd82d09154d11a1d95dfb9147e9f0). All 11,209 tracked source files remained unchanged. The known native-provenance failure (#30235) was retained; the officialbuild-with-prebuilt-nativetarget completed using native libraries built in that same checkout.On one new, full SHA256-verified copy of the protected release-origin
active-datafixture, actual LogService-only execution still reproduces this issue. Main ownership was recorded before launch; the copy was never reopened with 4.2.5. No TN/CN/SQL clients or launcher shard-readiness deadline were involved.readLogindex arguments: start/end 151200, file 15, offset 67102599 (0x3ffe787). Independent read-only index/checksum/bounds auditing of the unchanged original again identifies the two EOF-referencing index entries.v4.0.0-20261006150417-abc3d2fce5a6.This reconfirms the already-inconsistent-input reader/shutdown no-progress defect, not the origin of the missing log bytes and not a claim that ordinary 4.2.5/main restarts generally fail. Complete component logs, four stacks, CPU profile, changed diagnostic-copy bytes, build receipt and reproducible scripts are retained in the continuation evidence. No missing entries were skipped, fabricated or repaired.
LeftHandCold commentedon Oct 15, 2026
#30219 根因、最小修复与 50 验证
日期:2026-10-15。主机:host-10-222-1-50。
结论与交付
已确定并复现的是 Tan 在索引位置读到 EOF 后不前进的死循环。不是仅凭 CPU 高、超时或调用栈相似推断。修复后会明确返回存储错误,进入现有 Raft 失败退出路径,不会把缺失日志当作成功恢复。
MatrixOne Draft 暂时锁定个人 fork 的不可变 SHA,仅用于复现与 CI。必须先合并 Dragonboat #19,再切回官方 matrixorigin/dragonboat 版本,核对源码差异并复验后才能合并。不能直接把个人 fork 留作正式生产依赖。
1. 故障证据与本次验证边界
Issue 报告中,持久化索引要求读取 151200–151201,位置是 000015.log 的 67102599;这个位置恰好等于文件大小。最后完整记录为 151199,下一日志从 151202 开始。多次 goroutine 采样都停在同一索引/文件/offset,Standalone LogService 超过 120 秒仍不能恢复或正常响应停止。
本次独立核对了代码、调用链和提交历史,并在小型持久化/重开 fixture 中确定性复现了同一条件。没有重放 Issue 中的原始多 GB 压缩包,不能把原始文件的独立解码算作本次重新完成的工作。
2. 完整代码因果链
db.getEntries从索引取得固定的ies和当前位置passed。readLog到指定文件/offset 读取;rr.next()的 EOF 被转换为nil,这对普通整文件扫描本来是合法的。passed。原代码的
if err == io.EOF分支无效:正常 next EOF 已被下层吞掉;即使 seek 返回非 nil EOF,也已在前面的if err != nil返回了。错误返回链已核对:
Tan.getEntries → LogDB.IterateEntries → LogReader.Entries → entryLog/Peer → node.stepNode → engine.processSteps → stepWorkerMain.panicNow现有策略是遇到存储错误 fail-stop。补丁不会引入新的静默重试、跳过日志或自动重建副本逻辑,也不承诺损坏存储能继续启动。
3. 引入时间与尚未确定的问题
死循环结构在 Dragonboat 提交
9ef6a64061dadddfdcb9b80082fe6ae1c31421b3(2022-11-15,优化日志顺序扫描)中引入。该提交加入了passed外层循环,却没有在 readLog 返回后保证 cursor 前进。因此,这是旧读路径遇到异常持久化状态时的既有缺陷,不能把循环本身归因于最近某个 Main PR。
为什么原始日志记录缺失,仍未确定。 本补丁不修改写入、同步、轮转、重建或日志格式;没有证据支持“修复此循环就消除了日志缺失原因”。缺失字节来源需要保留原始 fixture 继续独立调查。
4. 最小修复
Dragonboat 仅修改
internal/tan/db.go的一次扫描后处理:记录扫描前的 cursor;正常 size cap 返回优先;扫描未消费任何索引 entry 时,返回包含 shard/replica/index/log/offset 的明确错误。刻意不全局改变
readLog的 EOF 行为,否则可能破坏正常轮转、扫描结束和索引重建。正常路径只增加几个标量赋值与一个比较;没有新的 goroutine、timer、全局状态或持久化字段。MatrixOne 仅修改依赖版本/checksum,并增加一个通过实际
getNodeHostConfig的 LogDB Factory 运行的反例测试。5. 本地证据
Dragonboat base
18a1f46a2ea64eb42a2b330ef98d662ca68a1365与当前 Main pinabc3d2fce5a6的完整源码树一致。修复 SHA 为ca11de296963e7f10269654476aab1b88d81cb7e。MatrixOne base
461bc8e34920959e5fc141e3d1b37673a90894e1;接入提交4235bf05d9c12816bdd11a70287242878bc06a7d。PR 创建后 Mergify 自动合入 Main,Head 变为
bd9c69f8fcff893bc23c029149f8d915cef11191。新增差异仅为 Fulltext planner/BVT 的回退;已通过go list -deps -test确认该 planner 不在 LogService 测试依赖闭包中,native、模块及 LogService 文件未变,因此完整包/race 证据仍有效。最新 Head 的新增反例也重新运行通过。Dragonboat 使用 Go 1.24.0;MatrixOne 使用 Go 1.27.1。均为 Linux amd64、GOMAXPROCS=4。MatrixOne native 库在独立 worktree 执行顶层
make -j8 cgo编译,没有复用来源不明的旧库,没有修改模块缓存。测试用文件打开次数上限做旧代码的失败保护,不依赖 sleep、调度概率或留下一个永不退出的测试 goroutine。
本次没有 SQL 行为变更,不添加无关 SQL BVT;对应公共边界验证为 Tan、LogReader 与 MatrixOne 实际配置的 LogDB Factory。没有启动 TKE Job,也没有触碰现存稳定性环境。
6. 不开心路径复审
7. 合并顺序
原始日志缺失原因仍保留为未闭环事项,不应因为防卡死测试通过就宣布其已解决。
XuPeng-SH commentedon Oct 17, 2026
验证通过,转测 @Ariznawlll。
本轮复核关联 PR #30288,实测 main 提交
aa4b6eddfdad54d11be6fd75a5675eb9801f6690(Linux/amd64、Go 1.27.1;使用对应 native 构建)。TestTanIndexedEOFReturnsError 通过,并通过定向 race:使用实际配置的 LogDB factory,先写/读真实 entry,再让已索引位置读到 EOF;只打开一次即返回 no-progress 错误,恢复正常读取后原 entry 仍完整。转测范围是 EOF 非前进循环,不是自动恢复缺失的 committed log,也未确定原始 log/index 分歧的来源。此结论针对 main 的官方 Dragonboat 新 pin,不表示已发布旧二进制改变。
本次保持 OPEN,请测试侧在目标交付版本完成验收后决定关闭。
Ariznawlll commentedon Oct 26, 2026
@LeftHandCold @XuPeng-SH,准备对 #30288 的修复做原始故障现场复验。Issue 提到保留了
matrixone425-business-stability.zip和matrixone425-restart-debug-20261014-2330.zip,但当前测试环境没有找到归档或获取地址。请问能否提供这两份归档的只读获取方式、对应的正常停机/SIGKILL 现场映射、SHA256 校验清单,以及配套的原始log.toml(或说明配置是否已包含在归档中)?如果归档含敏感数据,请不要直接公开上传到 Issue;请告知项目认可的安全共享方式。拿到后我会从原始字节制作隔离副本,在修复已合入的目标版本上复验 LogService 的 EOF 无进展路径和关停行为。当前定向 UT/race 结果不代替原始现场复验。
Ariznawlll commentedon Nov 6, 2026
测试版本
MatrixOne 官方 main
65b721e1b93c6b9e05db2063b220e0c35916b335,本机 macOS/arm64。使用该版本 Go 源码、本地已有 CGo 依赖及 Dragonboat 模块构建定向 LogService 测试;并非发布二进制或原故障归档。原问题验证
运行
pkg/logservice的TestTanIndexedEOFReturnsError:通过实际配置的 LogDB factory 写入并正常读取已提交 entry,再让已索引位置的文件读取返回 EOF。普通测试 3/3、-race3/3 均通过:读取返回包含no progress的错误,确认同一索引位置只打开一次,返回的 entry 为空、size 为 0,没有进入无限重开循环。Happy Path 覆盖
注入前正常读回 entry;取消 EOF 注入后再次读回完整相同 entry,证明这组失败读取不会跳过或改写测试记录。普通和 race 两组均重复 3 次。
Unhappy Path 覆盖
对索引指向已有条目的文件注入 EOF;验证有界返回错误和无重试循环。本轮使用测试内存文件系统模拟读取 EOF,没有使用原始损坏文件、重放生产故障或在多节点集群中注入存储损坏。
白盒验证
检查测试通过 LogDB factory 的实际入口写/读数据,并使用注入 FS 的 open 次数与错误结果作为断言。该证据只覆盖 EOF 无进展读取保护,不证明源端为何形成 log/index 不一致,也不证明缺失的 committed log 自动恢复。
回归测试
执行现有
TestTanIndexedEOFReturnsError普通及-race各 3 次,无新增 MatrixOne 主库 PR;没有运行完整 LogService 包、完整 CI 或重启集成套件。测试证据
本地
test30219.log和test30219-race.log均记录 3 个 PASS 及 Go 包成功。原 issue 提及的matrixone425-business-stability.zip和matrixone425-restart-debug-20261014-2330.zip当前未取得;此前已在本 issue 请求安全的只读来源、校验清单及配置。测试结论
当前 main 定向 EOF 保护及 race 通过;原始现场字节、重启恢复和关停流程尚未复验,保持 Open,不能把单元测试作为完整现场验收通过。
Ariznawlll commentedon Dec 1, 2026
结论
未完成验收,保持开放。 本轮在最新 main 补充真实磁盘上的 Tan EOF 读故障注入,三轮 race 测试均通过:遇到无法前进的 indexed EOF 会有界返回错误,没有重复打开同一位置死循环;解除注入后,原已提交记录以及再次重开后的记录保持一致。但这不等于已经恢复原现场缺失的 raft record,也未覆盖原损坏日志下独立 LogService/TN 的完整恢复和关停。
关键证据
32ffdd4ac2722972be184af63906c8f23901e323;含相关修复 fix(logservice): fail non-progressing Tan EOF reads #30288。只验证 main,不据此给其他分支结论。vfs.Default真实磁盘文件系统;不是纯内存文件系统。未访问 129,没有修改已有集群数据。复现步骤和断言
Index=1, Term=1, Cmd="durable entry",State Commit=1。正常读取必须与完整 Entry 相等。[1,2)。no progress的错误,entries=nil、size=0;目标位置 Open 次数严格为 1。若重新进入同一位置循环、返回部分成功或无错误,断言直接失败。执行命令:
三轮均 PASS,退出码 0;无测试跳过。证据保存在 128 的
/root/qa-30219-20261202/disk.jsonl、disk.err和disk.exit。回归
已加入现有 MOTR main PR #404,提交
881d6ca259df051d169a1f3870803ba1b245ec10,没有主库测试 PR。.github/qa/issue_30219_disk_eof_test.go。.github/workflows/qa-32426-30219.yml,PR/manual 运行三轮 race 并严格核对 PASS 数量。补充当前 main 的包级复核:在
ec945a6323d4e505a8445bfd129f02a70073c301上,Linux 隔离网络命名空间执行go test -race -count=1 -p=1 -timeout=35m ./pkg/logservice,整包 444 个根测试 PASS、0 FAIL、0 SKIP。这次整包运行不包含额外磁盘 EOF overlay;该 overlay 的结果仍以先前定向运行和 MOTR CI 为准。这里是补充组件覆盖,不改变上面原 32ff 定向测试的版本,也不能替代原始损坏 zip 的独立 LogService 恢复/关停验收。待解决点
原现场
matrixone425-business-stability.zip/matrixone425-restart-debug-20261014-2330.zip尚未在本轮可访问工作目录中找到。没有把“健康磁盘+注入 EOF”冒充原损坏档案恢复,也没有把有界返回错误当成能补回已缺失的 committed record。仍需原档案或等价可证明的不一致磁盘状态,完成独立 LogService/TN 的启动、错误传播、退出/关停验收。最终结论:未完成验收。 本次通过的是实际磁盘的 EOF 有界错误返回、解除注入后数据完整性及两次重开;未完成项:原故障档案恢复、完整服务生命周期;对应组件 CI 已通过,Issue 保持开放。