-
-
Notifications
You must be signed in to change notification settings - Fork 49
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
control: Limit memory use by control connections. #208
Conversation
The idea is not to reject commands if the buffer is too full, but to stop receiving them until the buffer has had a chance to reduce. That would be done by disabling the read watch (IN_EVENTS) in the This solution as written doesn't actually address the problem that the TODO note is concerned with, which is that a malicious or badly-written client could keep stuffing the output buffer causing it to consume an excessive amount of memory. I.e. this solution requires that the buffer management is performed by the client itself, which doesn't help. (Note that in practice a malicious client already needs to be root to be able to send commands via the control socket, so this is mostly a theoretical concern). Just FYI there's also an error in your implementation that means it always returns
... is checking the size of the |
Btw. If you'd like to implementing as I've suggested please feel free to re-open this PR or create a new one - I'm just closing it for now because it's definitely not the right fix at the moment. |
9d68673
to
7d491be
Compare
I updated it to disable |
a9273a0
to
50d64e4
Compare
Checking its size with Also, as I mentioned earlier:
|
50d64e4
to
acbd941
Compare
f818f4a
to
d89965d
Compare
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.
This is on the right track.
Can you please also use a named constant (a constexpr int
at the top of the file is fine) for the buffer watermark value rather than using a literal 1000
. Also, 1000 is way too low. Maybe 16kb (16*1024) is reasonable.
d89965d
to
8ea1bff
Compare
72e76f2
to
e8f89c5
Compare
Signed-off-by: Mobin "Hojjat" Aydinfar <mobin@mobintestserver.ir> Reviewed-by: Davin McCall <EMAIL HIDDEN>
bc479ee
to
4289d16
Compare
and It's done! I'm very excited for new 0.17 release and new episode of "Escape from System D" :) |
There are a few other changes to go in yet! But yes it is one step closer. 🚀 |
Hi.
I working on this PR for resolving one of the last blockers for 0.17 release:
dinit/TODO
Lines 3 to 5 in 7d491be
Signed-off-by: Mobin "Hojjat' Aydinfar <mobin@mobintestserver.ir>