fix(dav): Reduce CalDAV backend memory footprint#40665
Merged
ChristophWurst merged 1 commit intomasterfrom Nov 2, 2023
Merged
Conversation
miaulalala
approved these changes
Sep 27, 2023
Member
Author
|
/backport to stable26 |
Member
Author
|
/backport to stable27 |
ChristophWurst
commented
Oct 6, 2023
| ->executeQuery(); | ||
|
|
||
| $result = []; | ||
| foreach ($stmt->fetchAll() as $row) { |
Member
Author
There was a problem hiding this comment.
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"
}
Member
Author
There was a problem hiding this comment.
yet this probably means memory was almost full before. those 135168 are just the tip of the iceberg.
Member
There was a problem hiding this comment.
all the array_(map|filter|…) functions are also quite memory heavy – good to have them resolved.
blizzz
approved these changes
Oct 6, 2023
Merged
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
Member
Author
|
/backport to stable27 |
Member
Author
|
It's there. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
fetchAll inflates memory. Fetching in a loop allows GC to run earlier and more often.
TODO
Checklist