Page MenuHomeFreeBSD

Make sonewconn overflow messages have per-socket rate-limits and values
ClosedPublic

Authored by jtl on Apr 6 2020, 8:53 PM.
Tags
None
Referenced Files
Unknown Object (File)
Tue, Mar 26, 6:05 PM
Unknown Object (File)
Feb 26 2024, 6:42 AM
Unknown Object (File)
Feb 20 2024, 8:10 AM
Unknown Object (File)
Feb 10 2024, 1:06 AM
Unknown Object (File)
Jan 30 2024, 2:58 AM
Unknown Object (File)
Jan 30 2024, 2:58 AM
Unknown Object (File)
Jan 30 2024, 2:58 AM
Unknown Object (File)
Jan 29 2024, 9:18 PM

Details

Summary

sonewconn() logs messages when a listen socket's queue overflows. These messages can be helpful to systems administrators in determining when a user process is not able to keep up with its listen queue.

Currently, sonewconn() tracks overflows on a global basis. It will only log one message every 60 seconds, regardless of how many sockets experience overflows. And, when it next logs at the end of the 60 seconds, it records a single message referencing a single PCB with the total number of overflows across all sockets.

This change switches to per-socket overflow tracking. The code will now log one message every 60 seconds per socket. And, the code will provide per-socket queue length and overflow counts.

(Note that this change becomes much more useful when combined with D24272.)

Test Plan

I created multiple sockets and created overflows on them. I saw the messages were correctly rate-limited per-PCB, and the overflow counts were correct per-PCB.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 30457
Build 28214: arc lint + arc unit

Event Timeline

jhb added inline comments.
sys/kern/uipc_socket.c
590–591

BTW, you could consider making this a sysctl. I added a SYSCTL_TIMEVAL for the various crypto deprecation warnings that exposes the seconds portion as an integer value.

This revision is now accepted and ready to land.Apr 7 2020, 11:42 PM

Make the overflow rate-limit be controlled by a sysctl.

This revision now requires review to proceed.Apr 13 2020, 3:13 PM
jtl marked an inline comment as done.Apr 13 2020, 3:14 PM
jtl added inline comments.
sys/kern/uipc_socket.c
590–591

Thanks! I implemented this suggestion.

Language suggestion for the man page.

lib/libc/sys/listen.2
119

Use "specifies" here maybe?

jtl marked an inline comment as done.

Correct typo in the man page. (Thanks @bcr!)

jtl marked an inline comment as done.Apr 13 2020, 3:32 PM
jtl added inline comments.
lib/libc/sys/listen.2
119

Thanks for catching the typo! I've fixed it.

Great, thanks for the quick fix. The man page part is approved, then.

jtl marked an inline comment as done.

Rebase onto D24272.

This revision was not accepted when it landed; it landed in state Needs Review.Apr 14 2020, 3:38 PM
This revision was automatically updated to reflect the committed changes.

@jtl Please MFC this to stable/12 along with D24272

In D24316#639938, @brd wrote:

@jtl Please MFC this to stable/12 along with D24272

I'm open to doing this. However, does changing struct socket break the ABI?