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
Prevent instability and crash due to message flood #3510
Conversation
|
@davidebeatrici May I ask what priority/P0 entails? |
|
From https://wiki.mumble.info/wiki/Issue_Priorities:
|
|
@davidebeatrici How may I understand this? Is it my patch that "MUST be fixed ASAP" or does the patch fix something that "MUST be fixed ASAP"? |
|
The patch fixes something that "MUST be fixed ASAP". |
|
Qt 4 builds failing because: In file included from /usr/include/c++/4.8/chrono:35:0,
from ./ServerUser.h:17,
from ../ACL.cpp:14:
/usr/include/c++/4.8/bits/c++0x_warning.h:32:2: error: #error This file requires compiler and library support for the ISO C++ 2011 standard. This support is currently experimental, and must be enabled with the -std=c++11 or -std=gnu++11 compiler options.
#error This file requires compiler and library support for the \
^MinGW builds failing because: ServerUser.h:106:36: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
bool limit = this->currentTokens > (MAX_TOKENS - tokens);
^ |
|
Alright, I can work with that. The first problem should be fixable by relying on pre-C++11 means to measure time if the software is not build using at least a C++11 compiler, unless we can have this as a requirement for building. The second problem I didn't have, but it is easily fixable. |
|
After landing we should also put this into 1.2. |
|
I think that we shouldn't create another 1.2.x release. |
|
This edit to the patch should allow for pre-C++11 builds and fixes the warning with the unsigned signed comparison. Edit: Is it normal that the CI job is pending for such a long time? It seems to be finished according to the "Details" link. |
1b106c9
to
9ef8fb1
Compare
|
I hope you don't mind that I squashed them, so the history looks nicer. |
|
No problem, we usually prefer commits to be squashed if they're all related. |
|
Perfect. Now do the last changes solve the problems you mentioned early? I'm sadly not able to easily try compiling it with Qt4 or MinGW. |
|
Builds succeeded. Feel free to review my changes and squash the commits. |
This patch adds a rate limiting to selected patches. The underlying rate limiter used is the Leaky-Bucket algorithm. It allows for a burst of messages, but limits them after a specified amount of messages within a time frame.
f7274d9
to
0daec57
Compare
|
I separated the now and millisecondsBetween methods from the LeakyBucket class, as they were neither operating directly on the object nor public. And I added static inline to each to encourage the compile to inline them. Also I moved a comment. Please look at it again to see if you're okay with that. |
|
Thank you very much for your contribution! |
This patch adds a rate limiting to selected patches. The underlying rate limiter
used is the Leaky-Bucket algorithm. It allows for a burst of messages, but
limits them after a specified amount of messages within a time frame.
If the ratelimit hits the messages are simply ignored.
For now its set to a burst of 30 allowed messages and a subsequent limit of 4 messages per second, which seems to do the trick without inconveniencing normal users.
It should to some extend prevent the recent issues with bots decribed in #3505.
What was tested with the patch:
I'm thanking the Zom.bi community for testing and @Natenom for some insight into the problem.
I'm open to any suggestions.