Conversation
Solution: remove each part only after a successful send and test retry behavior after EAGAIN, backpressure and EFSM. Fixes zeromq#659.
fhgffy
marked this pull request as ready for review
October 2, 2026 17:06
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.
Fixes #659.
Problem
multipart_t::send()removes a frame before attempting to send it. If the first send returns EAGAIN, the multipart loses that frame and a retry sends an incomplete message. A thrownzmq::error_talso destroys the removed frame. For example, sendingfirst,second,thirdthrough an inproc PUSH socket with no peer returns false and leaves onlysecond,third.Solution
Send the front frame in place and remove it only after the send succeeds. Successfully sent frames are still consumed; the failed frame and remaining suffix stay available. No copying, catch-all handler, or API change is needed.
Add deterministic inproc regression coverage for:
Validation
Tested on Linux x86_64, GCC 14.2, libzmq 4.3.5 (DRAFTS enabled, CURVE disabled), Catch2 3.5.3:
7f0530688804c2b5b6b0d985773405593fd25ca8and pass after the fix: 84 assertionsdetect_leaks=0git diff --checkpassesFull-suite limitations, reproduced on the same unmodified production header: C++14 has 157/177 passing tests after the fix versus 154/177 before; C++20 has 158/180 versus 155/180. The only removed failures are the three new regression cases. The remaining 20/22 tests abort when the container denies libzmq's
getifaddrscall with EPERM. Whole-file clang-format also reports existing static_assert formatting from #687 on both base and patched versions; those lines are unchanged. Other compilers, operating systems, libzmq versions, and leak checking remain unverified.