-
-
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-web is very greedy on RAM (and can make chrome crash) #3307
Comments
(Chrome 55.0 on linux) |
If it's actually a segfault, that should probably be reported upstream to Chromium. |
Attempting to send a rageshake is particularly likely to cause a crash, ironically. strace says the chrome process gets a sigill. |
Seems to be something to do with memory usage. #3311 may help. |
mine crashes on pretty much every time i unsleep my comp - it's like #2951 but worse. unclear if it's the rageshaking or the new sync stuff leaking. |
ftr #3311 helped but didn't solve this |
I briefly profiled it yesterday, and saw 110K RoomMembers being allocated in the space of 20 minutes. As Chrome Debug Tools has no API, it's hard to do a stats analysis to see where these are coming from; kegan suggested we may be allocating new RoomMember objects on each and every event we're receiving. |
I'm operating under the assumption this is an OOM.
Tested locally and I see no evidence of this (both on sent messages and received messages). Did a heap snapshot of my Riot. I have a 435MB heap, of which:
The low-hanging fruit superficially looks to be |
So the
Note how this set of channels doesn't include high traffic rooms like
So making
Superficially, it appears that V8 does not just store pointers to the same repeated string (room IDs, user IDs), but instead stores the entire string again. This is why the maps appear to be so large. The
Reducing the number of maps we have may go a long way to help here, or somehow coercing V8 to store pointers to strings instead (e.g via |
I had an epiphany on the way in today. What happens to the
and I thought there was significance to the "unsleep" part. What the JS SDK does is it will preserve where it got up to (room state and all) then create a new copy of the room state for the new data (so each dis-contiguous timeline corresponds to 2 This scales extremely poorly when 1x |
It's worth noting that the indexeddb stuff may have exacerbated this. The store is synced every 5 minutes. If there is enough traffic in a room (strictly speaking >20 messages within 5 mins: hi2u freenode channels) then on reload of the page it will get a |
Current status: @kegsay fixed the main mem leak here (due to old state hanging around), however @richvdh and @erikjohnston are still seeing random crashes even immediately after boot. They also can't even do a heap snapshot immediately after boot, which sounds like their heap is mysteriously full of something or other. @kegsay hypothesises that this might be a bad extension, as nobody else has this problem apart from rich & erik who are both running an Adblock of some kind. Next step to get erik to disable his adblock and see if everything gets fixed. |
I disabled all extensions and still can't snapshot unless I ldpreload a library disabling setrlimit.
…On 27 March 2017 11:16:54 BST, Matthew Hodgson ***@***.***> wrote:
Current status: @kegsay fixed the main mem leak here (due to old state
hanging around), however @richvdh and @erikjohnston are still seeing
random crashes even immediately after boot. They also can't even do a
heap snapshot immediately after boot, which sounds like their heap is
mysteriously full of something or other. @kegsay hypothesises that
this might be a bad extension, as nobody else has this problem apart
from rich & erik who are both running an Adblock of some kind. Next
step to get erik to disable his adblock and see if everything gets
fixed.
--
You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub:
#3307 (comment)
--
Sent from my Android device with K-9 Mail. Please excuse my brevity.
|
so what does the snapshot show if you disable setrlimit?
|
Nothing exciting. He has a 410MB heap on startup (I have 380MB on startup and have no trouble snapshotting). No explosion of RoomState objects either. The only thing which looked odd was some things have references to |
react dev tools are certainly a memory and cpu sink once they are active, but I rather thought they didn't do much until the react dev tools tab was opened. I've got a few snapshots from Friday and today, which I can share if it is of interest, but I didn't see a smoking gun. Whilst extensions don't seem to make the difference between being able to snapshot and not, perhaps they do make the difference between the tab crashing under normal use and not. I have everything disabled for now; will keep using the session for a while and see what occurs. |
@richvdh has it gone bang yet? might be worth running in safe mode as well as disabling all extensions? |
Sorry. Yes, disabling extensions didn't help - it still goes bang after a few hours. I haven't tried just leaving Riot running, but I also can't take a heap snapshot in safe mode, nor in a chrome instance in a completely new profile, nor under chromium. I was able to take a heap snapshot on @kegsay's machine having logged in with my account, so this appears to be specific to my machine rather than my account. |
We think the recent webworker-for-indexeddb improvements have resolved this, so closing. |
There is very little in the logs at that time tbh. |
I'm experiencing similar behaviour in Chrome Version 61.0.3163.100 (Official Build) (64-bit), on both /app and /develop. No sudden crashes though, just absurdly high memory usage which seems strongly correlated with rooms and the size of them. Not sure how to provide any useful data for analysis, but if you need me to do anything I'm happy to oblige. |
I've been seeing this getting much worse in the last few weeks; every time I unsleep Riot after overnight i get a flurry of unresponsive warnings. I'll take a look. |
what's the logic behind thinking that an unresponsive warning is the same problem as an excess of VmData? |
So I did a bunch of memory profiling last week - the summary from https://matrix.to/#/!DdJkzRliezrwpNebLk:matrix.org/$1518745116614283uoTaQ:matrix.org was:
Filing this here for ease of reference and to track the bits which @dbkr has been attacking. |
Data points on how much the above has improved matters: My test account on Chrome on an ubuntu VM: (Edit: for comparison, v0.13.5 has 965000KB live and 1200000KB total... so actually higher than both) Travis: "Memory usage is down to just under 2gb, so about 500-600mb savings" (https://matrix.to/#/!DdJkzRliezrwpNebLk:matrix.org/$15191517123083TkBgH:t2l.io) Matthew: "dave: my heap is now 775MB (down from 1.2GB when this began :D)" (https://matrix.to/#/!DdJkzRliezrwpNebLk:matrix.org/$1519152400200168zKZpA:matrix.org) So based on those rough numbers, a saving of somewhere around the 20-25% mark. |
I've also done the 'be more aggressive on interning' thing: matrix-org/matrix-js-sdk#615 |
since dave's work in feb we seem to be just about okay again, so dropping prio |
I'm no longer seeing frequent crashes. (It still happens occasionally, but...) I'm not really sure there's any value in a "Riot uses too much memory" bug - that's kindof a given - unless we want to address a specific cause or set of symptoms. Is this open because the checklist at #3307 (comment) still has outstanding items? If so, it might be worth moving them to a new bug - I think they are going to get lost among the other noise here. |
lazy loading should have effectively fixed this for good. have split out the other two issues for posterity. |
(where crash = sad folder of segfaultyness)
The text was updated successfully, but these errors were encountered: