Skip to content

tnet: keep udp poller active after send errors#34

Merged
WineChord merged 1 commit into
trpc-group:mainfrom
Rememorio:udp_write_error
Jun 22, 2026
Merged

tnet: keep udp poller active after send errors#34
WineChord merged 1 commit into
trpc-group:mainfrom
Rememorio:udp_write_error

Conversation

@Rememorio

Copy link
Copy Markdown
Contributor

Summary

  • keep UDP listener fds registered with the poller when a queued datagram fails with a non-retryable sendmmsg error
  • drop the failed UDP datagram and continue flushing later queued datagrams
  • add a Linux regression test covering a failed queued UDP packet followed by a valid packet

Root Cause

UDP async writes can enqueue packets in outBuffer and rely on poller write events to flush them. If sendmmsg returns a non-EAGAIN error for the queued head packet, udpOnWrite previously returned that error to the poller. The poller then detached the shared UDP listener fd, while the UDP connection object stayed active with writing held and queued packets left in outBuffer.

Validation

  • go test -run TestUDPConnWriteToDropsFailedPacketAndContinues -v -count=1
  • go test -run 'TestUDPConnWriteToDropsFailedPacketAndContinues|Test_netFD' -v -count=1
  • go test ./...

Fixes #26

@WineChord WineChord left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@WineChord WineChord merged commit af1ebf9 into trpc-group:main Jun 22, 2026
6 checks passed
@github-actions github-actions Bot locked and limited conversation to collaborators Jun 22, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

UDP写操作阻塞导致读操作停滞及内核接收缓冲区满溢

2 participants