Skip to content

tcp: skip zero-length iovecs in tcp_writev2#39

Open
anican wants to merge 1 commit intoshenango:devfrom
anican:tcp-zero-iov-fix
Open

tcp: skip zero-length iovecs in tcp_writev2#39
anican wants to merge 1 commit intoshenango:devfrom
anican:tcp-zero-iov-fix

Conversation

@anican
Copy link
Copy Markdown
Contributor

@anican anican commented Mar 30, 2026

This commit fixes a bug with tcp_writev2.

Applications, such as memcached, can pass iovecs with zero length into tcp_writev2. Then, the main writev loop passes these entries to tcp_tx_send(). If an early entry is zero-length, tcp_tx_send() returns 0 and tcp_writev2() breaks early instead of continuing to later non-empty iovecs.

This can cause applications to get stuck retrying sendmsg's that never make progress.

Skip iovecs with iov_len == 0 before calling tcp_tx_send(). This avoids premature termination of the main writev loop

This commit fixes a bug with tcp_writev2.

Applications, such as memcached, can pass iovecs with zero length into
tcp_writev2. Then, the main writev loop passes these entries to tcp_tx_send(). If
an early entry is zero-length, tcp_tx_send() returns 0 and tcp_writev2() breaks
early instead of continuing to later non-empty iovecs.

This can cause applications to get stuck retrying sendmsg's that never
make progress.

Skip iovecs with iov_len == 0 before calling tcp_tx_send(). This avoids
premature termination of the main writev loop
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant