fix: retry Transceiver calls interrupted by EINTR#1299
Open
mx6436 wants to merge 3 commits intoMaaXYZ:mainfrom
Open
fix: retry Transceiver calls interrupted by EINTR#1299mx6436 wants to merge 3 commits intoMaaXYZ:mainfrom
mx6436 wants to merge 3 commits intoMaaXYZ:mainfrom
Conversation
Made-with: Cursor
Contributor
There was a problem hiding this comment.
Hey - 我在这里给出了一些总体反馈:
retry_on_eintr辅助函数在遇到反复出现的EINTR时会无限循环;建议增加一个最大重试次数或超时参数,以避免在病态场景下出现无界的忙等循环。- 为了一致性和可读性,你可能希望让
poll_item也使用retry_on_eintr(或类似的循环),而不是在遇到 EINTR 时特判并返回false,这样可以在 send/recv/poll 操作之间统一 EINTR 的处理语义。
给 AI Agent 的提示
Please address the comments from this code review:
## Overall Comments
- The `retry_on_eintr` helper loops indefinitely on repeated `EINTR`; consider adding a maximum retry count or timeout parameter so a pathological scenario doesn’t cause an unbounded tight loop.
- For consistency and clarity, you might want `poll_item` to also use `retry_on_eintr` (or a similar loop) rather than special-casing EINTR with a `false` return, so EINTR handling semantics are uniform across send/recv/poll operations.帮我变得更有用吧!请在每条评论上点 👍 或 👎,我会根据你的反馈改进之后的评审。
Original comment in English
Hey - I've left some high level feedback:
- The
retry_on_eintrhelper loops indefinitely on repeatedEINTR; consider adding a maximum retry count or timeout parameter so a pathological scenario doesn’t cause an unbounded tight loop. - For consistency and clarity, you might want
poll_itemto also useretry_on_eintr(or a similar loop) rather than special-casing EINTR with afalsereturn, so EINTR handling semantics are uniform across send/recv/poll operations.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- The `retry_on_eintr` helper loops indefinitely on repeated `EINTR`; consider adding a maximum retry count or timeout parameter so a pathological scenario doesn’t cause an unbounded tight loop.
- For consistency and clarity, you might want `poll_item` to also use `retry_on_eintr` (or a similar loop) rather than special-casing EINTR with a `false` return, so EINTR handling semantics are uniform across send/recv/poll operations.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
MistEO
reviewed
Apr 28, 2026
| template <typename Func> | ||
| static auto retry_on_eintr(std::string_view operation, Func&& func) | ||
| { | ||
| while (true) { |
MistEO
reviewed
Apr 28, 2026
| } | ||
| catch (const zmq::error_t& e) { | ||
| if (!is_eintr(e)) { | ||
| throw; |
MistEO
reviewed
Apr 28, 2026
| if (!is_eintr(e)) { | ||
| throw; | ||
| } | ||
| LogTrace << "retry after EINTR" << VAR(operation); |
Drop the try/catch helper and string-only-for-logging argument per review. Made-with: Cursor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
MaaEnd/MaaEnd#2539
Summary by Sourcery
错误修复:
Original summary in English
Summary by Sourcery
Bug Fixes: