-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
riot is now OOMing on launch #6212
Comments
looking at memory-infra in chrome://tracing/, looks like we are running out of heap space and GCing to death. During startup (whilst the spinner is going) it has 1.3GB on the v8 heap (1.9GB of memory total), which is enough to grind to a halt. so the question is: what is this taking up all the heap? |
So it looks like during the spinner (whilst it's going through slowly saying Then on snapshotting almost immediately after 'MatrixClient sync state => PREPARED', i caught it with 1.0GB of heap. There are now 8280 Promises, but the memory is instead all retained by MatrixEvents and RoomMembers as we'd expect. I wonder if there's some overlap phase between the two regimes where we can try to allocate 2x700MB temporarily, which will be enough to nuke it. |
The 1650 Promises which hold onto 700MB of heap during spinner are all pending activities from the RemoteIndexedDBStoreBackend worker, apparently. Meanwhile there are a ton (1.2 million) of plain old Objects which retain most of the RAM: It looks like it might somehow be a raw JS struct representation of the full accumulated sync response? So perhaps the problem is that we end up holding both this and the resulting MatrixEvents and RoomMembers etc created from it at the same time... |
(this is obviously related to the overall 'running out of heap' bug over at #3307) |
i'm wondering if one can do something really naive here like null out the bits of the sync accumulator response once you've parsed them so the GC can go and do its thing... |
by deleting fields from /sync responses as you emit them into events, to avoid wasting RAM when parsing the enormous accumulated sync response from indexeddb on launch
I've been looking at this for a while and all I can conclude is that the object graph that gets sent over from the worker process to the main one is ended up a lot larger than in the main proc than it was in the worker. The extra seems to be Only thing I can think of doing to mitigate this is opening the indexedb in the main process to pull the sync data out, then leaving the writes to be done in the worker? |
i profiled earlier via chrome://tracing (given heap snapshots seem to kill my browser solid) and it seemed pretty sane - max heap was 800MB and dropped to 600MB after launch. It'd be nice if we can avoid the hidden classes by doing this in the main process, but in practice I'm not sure we consider this a blocker for 0.14 and perhaps deprioritise it from this milestone. |
So something is definitely screwed here. I couldn't load my Riot/Web yesterday until i turned off sandboxing - however i caught a 1.6GB heap in the act (when Chrome paused because it realised it was about to OOM).
...but more worryingly:
Where on earth has it got 728K RoomMembers from!?!?!? https://github.com/matrix-org/riot-web-rageshakes/issues/712 is the rageshake. |
(Erik was also having problems) |
I just caught this in the act again. It looks like I've ended up with duplicates of all my Rooms at the very list - and on comparing my two copies of HQ in the heap dump, it even looks like I have two IndexedDBStores; one owned by the main matrixclient; the other seems to be mainly retained by React components (e.g. RoomList's _visibleRooms?!). I've captured the heap, and I'm leaving Chrome running (breakpointed) in an effort to try to work out wtf has happened. |
there looks to be a smoking gun at:
...the duplicated log lines look like there may be two indexeddb stores right from the outset? I don't understand why the log locations don't match. |
Circumstantially (from the two rageshakes I have of this happening), it looks a bit like we're okay if the ordering of indexeddb startup is:
...but badness happens if it's...
|
The other weird thing is that according to the heap I even have two MatrixClientPegs; both stored in a field called mxMatrixClientPeg on the Window object - except only one Window is the current live one; the other seems to be old and retained only by chunks of DOM? I loaded this particular instance by either hitting Cmd-R or the reload-to-latest-app button - i wonder if the whole stale previous version of the app is still hanging around somehow?! |
right, from counting the objects on the heap, this seems to be the case. we have two of everything other than some components like MessageComposer which only exist from being kept alive by stale DOM references. Perhaps it's even possible that the duplicate log lines from indexeddb is because we've ended up with two workers picking up the same postMessages? (although only one worker shows up in the heap profiler dropdown). In case this is idiocy caused by |
I've also pushed matrix-org/matrix-js-sdk@beafd59 just in case we're somehow managing to get the same indexeddb worker process to connect twice. |
Just got it again; precisely the same behaviour of hitting the 'update' button from the 'recent updates' dialog box, despite the tweaks above. Again, two MatrixClients - one owned by the active Window; the other owned by random stale react components from the DOM from god knows where. |
I think our only recourse now might be to try to get React & the service worker to do an orderly shutdown before calling |
One difference this time is that we don't see duplicate logging from index workers any more. Also, it takes 3 minutes to load the sync response from LocalIndexedDBStoreBackend??
|
our best theory right now is that this isn't caused by clicking the 'update' button, but possibly due to chrome dev tools keeping the old v8 data around if its open? (That said, i had an Aw Snap yesterday during launch irrespective of that) |
This stopped happening. I reckon it was a Chrome bug causing Chrome to not flush its DOM correctly when you call |
* Sanitize untrusted variables from message previews before translation Fixes element-hq#18314 * Fix editing of `<sub>` & `<sup`> & `<u>` [\element-hq#6469](matrix-org/matrix-react-sdk#6469) Fixes element-hq#18211 * Zoom images in lightbox to where the cursor points [\element-hq#6418](matrix-org/matrix-react-sdk#6418) Fixes element-hq#17870 * Avoid hitting the settings store from TextForEvent [\element-hq#6205](matrix-org/matrix-react-sdk#6205) Fixes element-hq#17650 * Initial MSC3083 + MSC3244 support [\element-hq#6212](matrix-org/matrix-react-sdk#6212) Fixes element-hq#17686 and element-hq#17661 * Navigate to the first room with notifications when clicked on space notification dot [\element-hq#5974](matrix-org/matrix-react-sdk#5974) * Add matrix: to the list of permitted URL schemes [\element-hq#6388](matrix-org/matrix-react-sdk#6388) * Add "Copy Link" to room context menu [\element-hq#6374](matrix-org/matrix-react-sdk#6374) * 💭 Message bubble layout [\element-hq#6291](matrix-org/matrix-react-sdk#6291) Fixes element-hq#4635, element-hq#17773 element-hq#16220 and element-hq#7687 * Play only one audio file at a time [\#6417](matrix-org/matrix-react-sdk#6417) Fixes element-hq#17439 * Move download button for media to the action bar [\element-hq#6386](matrix-org/matrix-react-sdk#6386) Fixes element-hq#17943 * Improved display of one-to-one call history with summary boxes for each call [\element-hq#6121](matrix-org/matrix-react-sdk#6121) Fixes element-hq#16409 * Notification settings UI refresh [\element-hq#6352](matrix-org/matrix-react-sdk#6352) Fixes element-hq#17782 * Fix EventIndex double handling events and erroring [\element-hq#6385](matrix-org/matrix-react-sdk#6385) Fixes element-hq#18008 * Improve reply rendering [\element-hq#3553](matrix-org/matrix-react-sdk#3553) Fixes element-hq#9217, element-hq#7633, element-hq#7530, element-hq#7169, element-hq#7151, element-hq#6692 element-hq#6579 and element-hq#17440 * Improve performance of room name calculation [\element-hq#1801](matrix-org/matrix-js-sdk#1801) * Fix browser history getting stuck looping back to the same room [\element-hq#18053](element-hq#18053) * Fix space shortcuts on layouts with non-English keys in the places of numbers [\element-hq#17780](element-hq#17780) Fixes element-hq#17776 * Fix CreateRoomDialog exploding when making public room outside of a space [\element-hq#6493](matrix-org/matrix-react-sdk#6493) * Fix regression where registration would soft-crash on captcha [\element-hq#6505](matrix-org/matrix-react-sdk#6505) Fixes element-hq#18284 * only send join rule event if we have a join rule to put in it [\element-hq#6517](matrix-org/matrix-react-sdk#6517) * Improve the new download button's discoverability and interactions. [\element-hq#6510](matrix-org/matrix-react-sdk#6510) * Fix voice recording UI looking broken while microphone permissions are being requested. [\element-hq#6479](matrix-org/matrix-react-sdk#6479) Fixes element-hq#18223 * Match colors of room and user avatars in DMs [\element-hq#6393](matrix-org/matrix-react-sdk#6393) Fixes element-hq#2449 * Fix onPaste handler to work with copying files from Finder [\element-hq#5389](matrix-org/matrix-react-sdk#5389) Fixes element-hq#15536 and element-hq#16255 * Fix infinite pagination loop when offline [\element-hq#6478](matrix-org/matrix-react-sdk#6478) Fixes element-hq#18242 * Fix blurhash rounded corners missing regression [\element-hq#6467](matrix-org/matrix-react-sdk#6467) Fixes element-hq#18110 * Fix position of the space hierarchy spinner [\element-hq#6462](matrix-org/matrix-react-sdk#6462) Fixes element-hq#18182 * Fix display of image messages that lack thumbnails [\element-hq#6456](matrix-org/matrix-react-sdk#6456) Fixes element-hq#18175 * Fix crash with large audio files. [\element-hq#6436](matrix-org/matrix-react-sdk#6436) Fixes element-hq#18149 * Make diff colors in codeblocks more pleasant [\element-hq#6355](matrix-org/matrix-react-sdk#6355) Fixes element-hq#17939 * Show the correct audio file duration while loading the file. [\element-hq#6435](matrix-org/matrix-react-sdk#6435) Fixes element-hq#18160 * Fix various timeline settings not applying immediately. [\element-hq#6261](matrix-org/matrix-react-sdk#6261) Fixes element-hq#17748 * Fix issues with room list duplication [\element-hq#6391](matrix-org/matrix-react-sdk#6391) Fixes element-hq#14508 * Fix grecaptcha throwing useless error sometimes [\element-hq#6401](matrix-org/matrix-react-sdk#6401) Fixes element-hq#15142 * Update Emojibase and Twemoji and switch to IamCal (Slack-style) shortcodes [\element-hq#6347](matrix-org/matrix-react-sdk#6347) Fixes element-hq#13857 and element-hq#13334 * Respect compound emojis in default avatar initial generation [\element-hq#6397](matrix-org/matrix-react-sdk#6397) Fixes element-hq#18040 * Fix bug where the 'other homeserver' field in the server selection dialog would become briefly focus and then unfocus when clicked. [\element-hq#6394](matrix-org/matrix-react-sdk#6394) Fixes element-hq#18031 * Standardise spelling and casing of homeserver, identity server, and integration manager [\element-hq#6365](matrix-org/matrix-react-sdk#6365) * Fix widgets not receiving decrypted events when they have permission. [\element-hq#6371](matrix-org/matrix-react-sdk#6371) Fixes element-hq#17615 * Prevent client hangs when calculating blurhashes [\element-hq#6366](matrix-org/matrix-react-sdk#6366) Fixes element-hq#17945 * Exclude state events from widgets reading room events [\element-hq#6378](matrix-org/matrix-react-sdk#6378) * Cache feature_spaces\* flags to improve performance [\element-hq#6381](matrix-org/matrix-react-sdk#6381)
* Sanitize untrusted variables from message previews before translation Fixes element-hq#18314 * Fix editing of `<sub>` & `<sup`> & `<u>` [\element-hq#6469](matrix-org/matrix-react-sdk#6469) Fixes element-hq#18211 * Zoom images in lightbox to where the cursor points [\element-hq#6418](matrix-org/matrix-react-sdk#6418) Fixes element-hq#17870 * Avoid hitting the settings store from TextForEvent [\element-hq#6205](matrix-org/matrix-react-sdk#6205) Fixes element-hq#17650 * Initial MSC3083 + MSC3244 support [\element-hq#6212](matrix-org/matrix-react-sdk#6212) Fixes element-hq#17686 and element-hq#17661 * Navigate to the first room with notifications when clicked on space notification dot [\element-hq#5974](matrix-org/matrix-react-sdk#5974) * Add matrix: to the list of permitted URL schemes [\element-hq#6388](matrix-org/matrix-react-sdk#6388) * Add "Copy Link" to room context menu [\element-hq#6374](matrix-org/matrix-react-sdk#6374) * 💭 Message bubble layout [\element-hq#6291](matrix-org/matrix-react-sdk#6291) Fixes element-hq#4635, element-hq#17773 element-hq#16220 and element-hq#7687 * Play only one audio file at a time [\#6417](matrix-org/matrix-react-sdk#6417) Fixes element-hq#17439 * Move download button for media to the action bar [\element-hq#6386](matrix-org/matrix-react-sdk#6386) Fixes element-hq#17943 * Improved display of one-to-one call history with summary boxes for each call [\element-hq#6121](matrix-org/matrix-react-sdk#6121) Fixes element-hq#16409 * Notification settings UI refresh [\element-hq#6352](matrix-org/matrix-react-sdk#6352) Fixes element-hq#17782 * Fix EventIndex double handling events and erroring [\element-hq#6385](matrix-org/matrix-react-sdk#6385) Fixes element-hq#18008 * Improve reply rendering [\element-hq#3553](matrix-org/matrix-react-sdk#3553) Fixes element-hq#9217, element-hq#7633, element-hq#7530, element-hq#7169, element-hq#7151, element-hq#6692 element-hq#6579 and element-hq#17440 * Improve performance of room name calculation [\element-hq#1801](matrix-org/matrix-js-sdk#1801) * Fix browser history getting stuck looping back to the same room [\element-hq#18053](element-hq#18053) * Fix space shortcuts on layouts with non-English keys in the places of numbers [\element-hq#17780](element-hq#17780) Fixes element-hq#17776 * Fix CreateRoomDialog exploding when making public room outside of a space [\element-hq#6493](matrix-org/matrix-react-sdk#6493) * Fix regression where registration would soft-crash on captcha [\element-hq#6505](matrix-org/matrix-react-sdk#6505) Fixes element-hq#18284 * only send join rule event if we have a join rule to put in it [\element-hq#6517](matrix-org/matrix-react-sdk#6517) * Improve the new download button's discoverability and interactions. [\element-hq#6510](matrix-org/matrix-react-sdk#6510) * Fix voice recording UI looking broken while microphone permissions are being requested. [\element-hq#6479](matrix-org/matrix-react-sdk#6479) Fixes element-hq#18223 * Match colors of room and user avatars in DMs [\element-hq#6393](matrix-org/matrix-react-sdk#6393) Fixes element-hq#2449 * Fix onPaste handler to work with copying files from Finder [\element-hq#5389](matrix-org/matrix-react-sdk#5389) Fixes element-hq#15536 and element-hq#16255 * Fix infinite pagination loop when offline [\element-hq#6478](matrix-org/matrix-react-sdk#6478) Fixes element-hq#18242 * Fix blurhash rounded corners missing regression [\element-hq#6467](matrix-org/matrix-react-sdk#6467) Fixes element-hq#18110 * Fix position of the space hierarchy spinner [\element-hq#6462](matrix-org/matrix-react-sdk#6462) Fixes element-hq#18182 * Fix display of image messages that lack thumbnails [\element-hq#6456](matrix-org/matrix-react-sdk#6456) Fixes element-hq#18175 * Fix crash with large audio files. [\element-hq#6436](matrix-org/matrix-react-sdk#6436) Fixes element-hq#18149 * Make diff colors in codeblocks more pleasant [\element-hq#6355](matrix-org/matrix-react-sdk#6355) Fixes element-hq#17939 * Show the correct audio file duration while loading the file. [\element-hq#6435](matrix-org/matrix-react-sdk#6435) Fixes element-hq#18160 * Fix various timeline settings not applying immediately. [\element-hq#6261](matrix-org/matrix-react-sdk#6261) Fixes element-hq#17748 * Fix issues with room list duplication [\element-hq#6391](matrix-org/matrix-react-sdk#6391) Fixes element-hq#14508 * Fix grecaptcha throwing useless error sometimes [\element-hq#6401](matrix-org/matrix-react-sdk#6401) Fixes element-hq#15142 * Update Emojibase and Twemoji and switch to IamCal (Slack-style) shortcodes [\element-hq#6347](matrix-org/matrix-react-sdk#6347) Fixes element-hq#13857 and element-hq#13334 * Respect compound emojis in default avatar initial generation [\element-hq#6397](matrix-org/matrix-react-sdk#6397) Fixes element-hq#18040 * Fix bug where the 'other homeserver' field in the server selection dialog would become briefly focus and then unfocus when clicked. [\element-hq#6394](matrix-org/matrix-react-sdk#6394) Fixes element-hq#18031 * Standardise spelling and casing of homeserver, identity server, and integration manager [\element-hq#6365](matrix-org/matrix-react-sdk#6365) * Fix widgets not receiving decrypted events when they have permission. [\element-hq#6371](matrix-org/matrix-react-sdk#6371) Fixes element-hq#17615 * Prevent client hangs when calculating blurhashes [\element-hq#6366](matrix-org/matrix-react-sdk#6366) Fixes element-hq#17945 * Exclude state events from widgets reading room events [\element-hq#6378](matrix-org/matrix-react-sdk#6378) * Cache feature_spaces\* flags to improve performance [\element-hq#6381](matrix-org/matrix-react-sdk#6381)
we are using ~2x less heap, but something seems to have changed in the memory allocation patterns such that we are now at much higher risk of OOMing at startup than before
The text was updated successfully, but these errors were encountered: