-
Notifications
You must be signed in to change notification settings - Fork 12
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
Filter out flood of member & hidden event spam when we detect the scrollback is full of it #1339
Comments
Re-opening here as we're seeing this in the case of Gitter rooms where I synced the room membership. Giant blocks of membership that are impossible to paginate past. My original proposal still seems reasonable to me but this is really just tracking the problem with one potential solution of many. In the last issue, @t3chguy noted some caveats with historical profiles not working correctly if we skip fetching membership events. And also affects push rules since historical profiles are needed to evaluate if a given message pings. These seem minor in comparison to the room being unnavigable though. And are technical problems we can overcome like with using MSC3952 for intentional mentions or just ignore the problem since the chance of changing your profile (and receiving a notification) in a scenario like this is probably very small so you probably won't miss any notifications anyway. Related:
|
This also impacts things such as live location sharing. In that case, however, the events are in the timeline and possibly encrypted. It would be nice if we could handle these cases with the same approach but I think the |
Not entirely sure, if what I'm seeing is covered by this issue here (see also element-hq/roadmap#26 (comment)) - but even with the setting mentioned in the description of this issue here toggled, element is maxing out at 100% CPU usage remaining pretty much unusable after the mass joining of gitter users in a large gitter channel I'm using (https://gitter.im/ethereum/solidity / https://matrix.to/#/#ethereum_solidity:gitter.im). I got multiple people to confirm this using element desktop and element web. I.e. ever since the mass joining of gitter users, the room remains pretty much unusable via element. |
This is having an impact on the Gitter migration, so might need prioritising @daniellekirkwood @Johennes |
@ekpyron Please note that the setting mentioned in the issue won't help at all. As mentioned in the description "[that setting] just affects the display of the event. It doesn't help with filtering them out of the |
Investigating this today. The first thing is to establish the behaviour, since we thought there might be a bug where we don't actually keep back-paginating when we should. I've created a room on my local synapse with 10000 hidden events followed by some chat messages. When Element Web tries to display the room, it does keep making requests to the Looking at the actual requests from my Synapse, according to Firefox they are taking ~9ms consistently, so the slowdown is in the client. |
When I set the limit to 2000 instead of 20, I got responses of size 1000, presumably due to a Synapse limit. |
Running it through the Firefox profiler, I see almost all the time is spent inside |
Without encryption, Element Web appears to be loading the hidden event at a rate of 1000 per 7 seconds, which is more reasonable (if not great). |
Although having said that, even when its count of events has reached 10K, it's still processing very heavily and mostly unusable for several minutes. Trying to get a profile. |
It appears to be calling Profile is here: https://share.firefox.dev/3JWEZ7b |
5-10 minutes later it's still unresponsive. |
Nope, I misread the profile. It's spending a lot of time inside doSync, but not (necessarily) calling it a lot. |
|
Something is happening repeatedly for all 10K events whenever we re-render. In |
I have a test that crashes node: In
crashes with:
This seems bad :-) |
Adjusting the 10000 above to 1000 passes the test but it runs in 1395 ms which seems slow, so I can investigate from here. |
If I replace |
If I replace |
Removing the slice didn't help, so I'll have to think more deeply :-( |
We are re-running |
That has helped a lot, but it still looks like we are calling sync 10K times, or maybe many more times than that. |
Removing |
I created element-hq/element-web#24480 to track further performance work. I think this issue should be used to think about batch sizes for FWIW I think we should probably double the batch size every time we receive a full batch of hidden events, up to a max of 1000, which seems to be Synapse's default max. |
Originally opened as a
element-web
issue (on 2022-04-22) that was incorrectly moved to #491 and then a discussionYour use case
Why would you like to do it?
Rooms can be overwhelmed by bulk spam users joining rooms (thousands and thousands). Each one of those joins and leaves creates an event in the timeline.
Currently in rooms like this and trying to scrollback, you just get stuck on the thousands of member events that we only paginate 20 at a time. Each request is so slow and it doesn't even get me further back in actual results I want to see.
The goal of this change is to make the room scrollback usable again and be able to view the history of the room. Otherwise, when these spam incidents occur, that whole time period in the room is essentially a black hole.
What would you like to do? / How would you like to achieve it?
When we detect that the whole
/messages
response is filled withm.room.member
join
,leave
, andinvite
events, we can ask the user whether they want to continue scrolling back without them. If they accept, we should add afilter
to/messages
to not include them.Here is a mockup of what the user prompt could look like: "It looks like you're paginating through a lot of member events, would you like to scrollback without them?"
Another option is to automatically start back-paginating by a much bigger value (500).
Another option is to use MSC3030 jump to date to jump past all of the messages. Behind the scenes, we could use
/messages
with a filter to find the spot and then jump.Have you considered any alternatives?
It's possible to hide all join/leave messages in the timeline with Settings -> Preferences -> Timeline section -> toggle the Show join/leave messages (invites/removes/bans unaffected) (
showJoinLeaves
) setting. But this just affects the display of the event. It doesn't help with filtering them out of the/messages
pagination requests to being with to speed things up and get to the results we care about.Additional context
/messages
The text was updated successfully, but these errors were encountered: