Refs #984: sendpacket bounded EAGAIN/ENOBUFS retry (merges #986 + fixups)#996
Merged
fklassen merged 1 commit intoJul 16, 2026
Conversation
…loop Merges PR #986 (Yaroslav / d3156) which fixed sendpacket() spinning forever on transient EAGAIN/ENOBUFS under sustained buffer pressure, plus review fixups: - usleep(0) doesn't actually sleep on any target libc; use a real 100us backoff between retries (matches src/common/txring.c's existing usleep(100) convention) so the bound also curbs CPU/kernel load, not just loop count. - Set an explicit error message via sendpacket_seterr() when the retry cap is hit, so callers reading sendpacket_geterr() get an accurate reason instead of a stale/empty errbuf. - Fix EXIT_MAX_RETRIES label indentation to match the existing TRY_SEND_AGAIN label, and drop the trailing-whitespace blank line. Refs #984. Co-Authored-By: Yaroslav <d3156@users.noreply.github.com> Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
fklassen
changed the base branch from
Bug_#984_endless_retries_on_ENOBUFS_EAGAIN
to
v4.5.3-beta1
July 16, 2026 18:24
fklassen
marked this pull request as ready for review
July 16, 2026 18:25
fklassen
changed the base branch from
v4.5.3-beta1
to
Bug_#984_endless_retries_on_ENOBUFS_EAGAIN
July 16, 2026 18:31
fklassen
merged commit Jul 16, 2026
426706a
into
Bug_#984_endless_retries_on_ENOBUFS_EAGAIN
2 checks passed
This was referenced Jul 16, 2026
Closed
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.
Summary
sendpacket()'s EAGAIN/ENOBUFS retry loop to stop the endless-retry / 100% CPU hang described in [Bug] Tcpreplay try to send the same packet continuously after it failed when use -2 parameter #984.usleep(0)is a no-op on any target libc — replaced with a realusleep(100)backoff between retries, matching the existing convention insrc/common/txring.c.sendpacket_seterr()sosendpacket_geterr()returns an accurate reason instead of a stale/empty error buffer.EXIT_MAX_RETRIESlabel indentation (was misaligned vs. the existingTRY_SEND_AGAINlabel) and removed a trailing-whitespace blank line.docs/CHANGELOGanddocs/CREDITto credit @d3156's contribution.Known follow-up (not addressed here)
The retry bound is shared by every backend that jumps to
TRY_SEND_AGAIN, including netmap's ring-full retry signal (retcode == -2), which is a legitimate/expected condition rather than a true error and could plausibly need more than 100 spins under bursty load. Flagging for maintainers to decide whether netmap needs its own/larger limit — out of scope for this PR, which targets the PF_PACKET/general EAGAIN/ENOBUFS hang from #984.Test plan
../autogen.sh && ../configure --disable-local-libopts --enable-debug && make— builds clean, no warnings, out-of-tree on macOS (BPF backend).test/regression case for the retry cap — none exists yet; not added here.🤖 Generated with Claude Code