loopd: shutdown hangs when lnd goes away
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 3/5
- 预计耗时
- 半天
- 新手友好度
- 45/100
- Issue 类型
- 缺陷
- 描述清晰度
- 基本清楚
- 活跃度
- 活跃
- 技术栈
- go
调研方向
Start in loopd/daemon.go: the internalErrChan buffer size where it is created, the swap client send near line 854, the static address loop-in manager send near line 1048, and Daemon.stop near line 1164. Reproduce by stopping and restarting lnd under a running loopd and watching for the hang after 'Runtime error in daemon, shutting down'. Done when shutdown completes, the macaroon db is released, and a new loopd can start.
由索引模型根据 Issue 内容生成。
描述
When lnd stops or restarts under a running loopd, the daemon starts to shut down and then hangs. The process stays alive, the RPC port is closed, and the macaroon database stays locked, so a new loopd fails with "unable to open macaroon db: timeout".
Cause
internalErrChan has room for four errors (make(chan error, 4) in loopd/daemon.go) and is read once. After that read the daemon calls stop(), which waits for the wait group. When lnd goes away, more goroutines report an error than the channel can hold. The rest block on the send, inside goroutines the wait group is waiting for.
The comment at the swap client's send says "We don't have to worry about blocking as the internal error channel is sufficiently buffered", which no longer holds with the number of managers that now send to it.
Goroutine dump from a hung daemon on master (b41a3a32):
goroutine 114 [chan send]: loopd/daemon.go:854 (swap client)
goroutine 218 [chan send]: loopd/daemon.go:1048 (static address loop-in manager)
goroutine 364 [sync.WaitGroup.Wait]: loopd/daemon.go:1164 (*Daemon).stop
Steps
- Run
loopdagainst lnd on regtest, with experimental features on. - Restart lnd.
loopdlogs "Runtime error in daemon, shutting down" and never logs "Daemon exited".
Reproduced three times in three tries.
Possible fix
Send to internalErrChan without blocking (a select with d.quit, or a default case), or keep draining the channel while stop() runs.
- 主要语言
- Go
- 星标
- 593
- 派生
- 139
- 平均合并
- 2 天 8 小时
- 30 天内合并 PR
- 21
环境准备
- 提供 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 没有贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
lightninglabs/loop 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 78/100
lightninglabs/loop#1246 ·
维护者通常 1 天内回复
-
staticaddr: a deposit unlocked between the refresh and the lookup can be quoted or selected可能已有人在做 @claravanstaden 于 18 天前认领。 未关闭static-loop-in
难度 3/5 1-2 天 新手友好度 52/100
lightninglabs/loop#1289 · 已指派 1 人 ·
维护者通常 1 天内回复
-
难度 3/5 1-2 天 新手友好度 49/100
lightninglabs/loop#1276 · 1 条评论 ·
维护者通常 1 天内回复
-
难度 4/5 3-5 天 新手友好度 15/100
lightninglabs/loop#1274 ·
维护者通常 1 天内回复
-
难度 4/5 3-5 天 新手友好度 50/100
lightninglabs/loop#1208 · 1 条评论 ·
维护者通常 1 天内回复
查看 lightninglabs/loop 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 82/100
Cojekt/LibreDental#258 ·
维护者通常 1 天内回复
-
go good first issue help wanted
难度 2/5 1-3 小时 新手友好度 88/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
opensro-dev/opensro#4949 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 82/100
维护者通常 3 天内回复
-
agent-execution/02 row 4: consumers Verify row lacks delivery/base binding, cannot pass post-merge未关闭bug effort:s impact:low raised-by:verifier risk:low
难度 2/5 1-3 小时 新手友好度 74/100
medici-finance/assay#7946 · 1 条评论 ·
维护者通常 1 天内回复