Rocket.Chat.ReactNative icon indicating copy to clipboard operation
Rocket.Chat.ReactNative copied to clipboard

One of the rooms crashes and freezes the app

Open johnypeterson opened this issue 6 years ago • 15 comments

Description:

One of the rooms doesn't load messages when scrolling up and crashes for all users. The app freezes and won't let you send messages or switch to another room until it is kicked out of the phone's memory. All the other rooms are unaffected Though on desktop client and web version the room doesn't have any issues. The logs were checked - nothing unusual

rocketchat

Environment Information:

  • Rocket.Chat Server Version: 3.5.4 and 3.0.7
  • Rocket.Chat App Version: 4.10.0
  • OS Version: Android 9, 10 as well as iOS

Steps to reproduce:

The issue is reproducible only in one specific room when opening it on the mobile device and scrolling through the messages

Expected behavior:

The room should load messages in a usual way and the app shouldn't freeze

Actual behavior:

The room doesn't load messages and the app freezes

Note: One unusual thing in this room: it has replies on some messages in a thread a few days later than an initial parent message

johnypeterson avatar Aug 27 '20 10:08 johnypeterson

Hey, can you reach me on https://open.rocket.chat? I'm @diego.mello. Thanks.

diegolmello avatar Aug 27 '20 11:08 diegolmello

The reason for the issue is found: If there are strange very long spaces between URL and text inside the message + this message has the replies - the room crashes and application freezes. The bug is also reported here https://github.com/stiang/remove-markdown/issues/52

johnypeterson avatar Aug 28 '20 08:08 johnypeterson

UPDATE If any user in the room makes a certain amount of spaces and line breaks in the message, and after that someone replies that message - these actions lead to the crash of the room https://github.com/stiang/remove-markdown/issues/52#issuecomment-682401313

johnypeterson avatar Aug 28 '20 08:08 johnypeterson

if apply .replace(/\s\s+/g, ' ') before run removeMarkdown then there is no problem

artem-levashov avatar Aug 28 '20 08:08 artem-levashov

Can you guys open a PR with a fix?

diegolmello avatar Aug 28 '20 11:08 diegolmello

app\containers\message\RepliedThread.js
about line 28 `let msg = shortnameToUnicode(tmsg);

//wx fix strip multiple spaces in message, prvent crash room msg = msg.replace(/\s\s+/g, ' ') //wx fix end

msg = removeMarkdown(msg);` it save room from freez. but when you try to click on reply button it freez again.

artem-levashov avatar Aug 28 '20 11:08 artem-levashov

just found second place app\containers\markdown\index.js line 387 m = removeMarkdown(m); if apply same fix before that line m = m.replace(/\s\s+/g, ' ')

then everything is ok - no problem with room and jumping into thread

artem-levashov avatar Aug 28 '20 12:08 artem-levashov

i do not see any more removeMarkdown in the project

artem-levashov avatar Aug 28 '20 12:08 artem-levashov

It looks like #2446 was created, but it didn't follow the template, nor answered my questions. @johnypeterson @artem-levashov Can you guys provide a way to reproduce this error?

diegolmello avatar Sep 09 '20 12:09 diegolmello

We have faced the problem twice already.

Steps to reproduce:

  1. From a desktop client or web version send a message which will contain text, a few long spaces, and line breaks
  2. Reply that message
  3. From the mobile client open the room and try to scroll over the messages

johnypeterson avatar Sep 09 '20 13:09 johnypeterson

I can't reproduce it. The PR didn't have a proper test plan, before/after, etc. If you faced twice, how can you be sure it's fixed?

diegolmello avatar Sep 09 '20 13:09 diegolmello

The first time issue was just in the message (without replies), the second time it occurred in a reply flow. We are sure that it's fixed because it was tested manually

johnypeterson avatar Sep 09 '20 14:09 johnypeterson

We have tested on open.rocket.chat room "test freezing room" - if you come there you will face the problem on mobile

We have now versions of application Master from rocket and fixed version with our pull request. We are facing that problem only on master version. Version with our fix works without any problem. I also put some details in broken room

artem-levashov avatar Sep 10 '20 08:09 artem-levashov

one_bad_message.txt here is file with bad text that you can copy past after download.

artem-levashov avatar Sep 10 '20 09:09 artem-levashov

Hey, this is going to be released next Monday. I'm sorry about the delay.

diegolmello avatar Dec 18 '20 14:12 diegolmello