-
Notifications
You must be signed in to change notification settings - Fork 30
fix: try to avoid memory exhaustion #979
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
Conversation
| )); | ||
| )) | ||
| ->orderBy('last_seen', 'DESC') // Use most recent data in case of limiting | ||
| ->setMaxResults(3_000); // More data will like exhaust memory |
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.
TIL about this notation :)
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.
I think they took inspiration from Rust :)
| if ($validationPositives->count() > self::MAX_SAMPLES_VALIDATE_POSITIVES) { | ||
| $threshold = (self::MAX_SAMPLES_VALIDATE_POSITIVES / $validationPositives->count()) * 100; | ||
| $validationPositives = $validationPositives->filter(fn () => random_int(0, 100) <= $threshold); | ||
| } |
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.
Probabilistic limit, nice!
Signed-off-by: Christoph Wurst <[email protected]>
8882f76 to
8a7d3cc
Compare
|
/backport to stable31 |
|
/backport to stable30 |
On medium and large installations there can be a lot of login data. Loading it can exhaust the available PHP memory.
This limits the impact in two steps
master: I was not able to run
occ suspiciouslogin:train --v6 --dry-run -vvvwith a memory limit of 512M (Nextcloud default)here: I can run
occ suspiciouslogin:train --v6 --dry-run -vvvsuccessfully with a memory limit of 256M