New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixes for socket buffer size #16982
Fixes for socket buffer size #16982
Conversation
r = setsockopt_int(fd, SOL_SOCKET, SO_RCVBUFFORCE, n); | ||
if (r < 0) | ||
return r; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto
|
||
return 0; | ||
return fd_inc_rcvbuf(m->sock, size); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so, hmm, is this right? fd_inc_recvbuf() only increases the socket buffer, while the pre-existing code might also lower it if the caller asks for it. Is this an intentional change? I guess in most cases this is called to increase the buffer, but do we want to encode that it can only be used for that?
} | ||
r = fd_inc_rcvbuf(fd, s->receive_buffer); | ||
if (r < 0) | ||
log_unit_warning_errno(UNIT(s), r, "SO_RCVBUF/SO_RCVBUFFORCE failed: %m"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as above, previous code could also lower buffer size, new code only increases.
8fcc033
to
d400038
Compare
@poettering Thank you for your review. Updated. I hope all comments are addressed. PTAL. @keszybz I think it is worth to backport this to some stable branches. |
d400038
to
550ac69
Compare
…ger than the kernel limit The commit 10ce2e0 inverts the order of SO_{RCV,SND}BUFFORCE and SO_{RCV,SND}BUF. However, setting buffer size with SO_{RCV,SND}BUF does not fail even if the requested size is larger than the kernel limit. Hence, SO_{RCV,SND}BUFFORCE will not use anymore and the buffer size is always limited by the kernel limit even if we have the priviledge to ignore the limit. This makes the buffer size is checked after configuring it with SO_{RCV,SND}BUF, and if it is still not sufficient, then try to set it with FORCE command. With this commit, if we have enough priviledge, the requested buffer size is correctly set. Hopefully fixes systemd#14417.
If networkd creates huge amount of netdevs, then the buffer of device monitor becomes easily flowed. Hopefully fixes systemd#16865.
550ac69
to
e77f52e
Compare
Is there a chance this could be included in a stable systemd release or do you think this is too big of a change for the current stable version? |
Note. If this will be backported to a stable repository, then please do not forget to include 4934ba2. |
The issue seems already fixed by PR systemd#16982 and its follow-up commit 4934ba2.
This will be included in systemd-246.5. |
The issue seems already fixed by PR systemd#16982 and its follow-up commit 4934ba2. (cherry picked from commit 766f8f3)
The issue seems already fixed by PR systemd#16982 and its follow-up commit 4934ba2.
The issue seems already fixed by PR systemd#16982 and its follow-up commit 4934ba2.
Hopefully fixes #14417.
Hopefully fixes #16865.