-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
fix(dav): Reduce CalDAV backend memory footprint #40665
Conversation
/backport to stable26 |
/backport to stable27 |
@@ -2656,9 +2661,9 @@ public function getSchedulingObjects($principalUri) { | |||
->where($query->expr()->eq('principaluri', $query->createNamedParameter($principalUri))) | |||
->executeQuery(); | |||
|
|||
$result = []; | |||
foreach ($stmt->fetchAll() as $row) { |
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.
from prod:
{
"reqId": "abc123",
"level": 3,
"time": "2023-10-06T06:25:16+00:00",
"remoteAddr": "aaa:bbb:ccc::",
"user": "user123",
"app": "PHP",
"method": "REPORT",
"url": "/remote.php/dav/calendars/user123/inbox/",
"message": "Allowed memory size of 536870912 bytes exhausted (tried to allocate 135168 bytes) at /var/www/nextcloud/apps/dav/lib/CalDAV/CalDavBackend.php#2661",
"userAgent": "iOS/17.0.3 (21A360) dataaccessd/1.0",
"version": "27.1.2.1",
"data": {
"app": "PHP"
},
"id": "651faa6e0d5c0"
}
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.
yet this probably means memory was almost full before. those 135168 are just the tip of the iceberg.
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.
all the array_(map|filter|…) functions are also quite memory heavy – good to have them resolved.
fetchAll inflates memory. Fetching in a loop allows GC to run earlier and more often. Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
9daf8b2
to
91b31bf
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.
🏎️
/backport to stable27 |
It's there. |
Summary
fetchAll inflates memory. Fetching in a loop allows GC to run earlier and more often.
TODO
Checklist