epmd: a client that closes early crashes the server on the PORT_PLEASE2 and NAMES responses
维护者通常 3 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 新手友好度
- 78/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- erlang
- 领域
- backend
调研方向
阅读 libs/avm_network/src/epmd.erl,重点查看 process_req/3 中处理 ?PORT_PLEASE2_REQ 和 ?NAMES_REQ 的分支,并将它们的发送处理方式与 #2345 修改的 ALIVE2 分支进行比较。确认发送失败如何处理,以及服务器会保留已注册的节点;完成标准是任一响应发送失败都不会导致 epmd gen_server 崩溃。
由索引模型根据 Issue 内容生成。
描述
Affected: release-0.7 at ca1583068, libs/avm_network/src/epmd.erl,
process_req/3 for ?PORT_PLEASE2_REQ and ?NAMES_REQ.
#2345 fixes the same problem for the ALIVE2 response only.
What happens
The responses are sent with ok = socket:send(Socket, ...).
When the client has already closed the connection, socket:send/2 does not
return ok (on release-0.7 it returns {ok, Data} for a closed connection,
with #2345 it returns {error, closed} or {error, epipe}). The badmatch
crashes the epmd gen_server, and every registered node is forgotten.
How to reproduce
Start the epmd, then from any client:
{ok, S} = socket:open(inet, stream, tcp),
ok = socket:setopt(S, {socket, linger}, #{onoff => true, linger => 0}),
ok = socket:connect(S, #{family => inet, addr => loopback, port => 4369}),
ok = socket:send(S, <<2:16, 122, "x">>), % PORT_PLEASE2_REQ for node "x"
ok = socket:close(S). % reset, no reply is read
The server's reply fails and the epmd process crashes. The race is easiest to
hit with a slow server, for example under valgrind.
Suggested fix
Handle {error, _} like the ALIVE2 branch does after #2345: close the socket
and keep the state.
- 主要语言
- Erlang
- 星标
- 2.3k
- 派生
- 171
- 平均合并
- 4 天 11 小时
- 30 天内合并 PR
- 20
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
atomvm/AtomVM 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 3 天内回复
-
lwIP sockets: a failed listen or connect leaves the socket lock held, a later close hangs forever未关闭
难度 2/5 1-3 小时 新手友好度 84/100
维护者通常 3 天内回复
-
难度 2/5 1-3 小时 新手友好度 76/100
维护者通常 3 天内回复
-
难度 2/5 1-3 小时 新手友好度 75/100
维护者通常 3 天内回复
-
难度 2/5 1-3 小时 新手友好度 77/100
维护者通常 3 天内回复
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 82/100
btclib-org/btclib-wallet#872 ·
维护者通常 1 天内回复
-
[Bug]: Scheduled returns scan all accepted minion keys causing extreme load可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭bug needs-triage
难度 2/5 1-3 小时 新手友好度 76/100
saltstack/salt#70789 · 1 条评论 ·
维护者通常 3 天内回复
-
难度 2/5 1-3 小时 新手友好度 87/100
btclib-org/btclib#3093 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 76/100
stellar/rs-stellar-xdr#621 ·
维护者通常 1 天内回复
-
good first issue
难度 2/5 1-3 小时 新手友好度 88/100
patrickballard/wheelgap#268 ·