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)
Mon, Dec 9, 7:31 PM
Unknown Object (File)
Thu, Dec 5, 9:00 AM
Unknown Object (File)
Wed, Nov 27, 1:05 PM
Unknown Object (File)
Thu, Nov 21, 8:03 AM
Unknown Object (File)
Wed, Nov 20, 9:59 PM
Unknown Object (File)
Nov 10 2024, 10:36 AM
Unknown Object (File)
Nov 10 2024, 8:09 AM
Unknown Object (File)
Oct 21 2024, 7:36 AM

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 Not Applicable
Unit
Tests Not Applicable

Event Timeline

jhb added inline comments.
sys/kern/uipc_socket.c
586 ↗(On Diff #70271)

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
586 ↗(On Diff #70271)

Thanks! I implemented this suggestion.

Language suggestion for the man page.

lib/libc/sys/listen.2
119 ↗(On Diff #70495)

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 ↗(On Diff #70495)

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?