Status-react: IPhone is heating up quickly when sending messages in 1-1 chat

Created on 21 Sep 2020  Â·  26Comments  Â·  Source: status-im/status-react

Bug Report

Problem

Generally, users noticed that iPhone currently heating up faster than on release.
To find out the reason, made the following test cases:

  1. receiving 50 messages in public chat while IPhone is in foreground
  2. sending 50 text messages to public chat
  3. sending text messages or mentions to 1-1 chat
  4. sending mentions in public chat
  5. receiving 20 push notifications in 1-1 chat while app is on background
  6. receiving 20 push notifications in public chat while the app is on background

In cases 4 - 6 there are no noticeable changes in device temperature, cases 1 - 3 are in table below

IPhone is heating up if send messages to 1-1 chat with mentions and after stopping sending continue to heat up more (from +0,2 to +0,4)

Didn't notice other actions that can heat up Iphone so quickly.

  | 1.6.1 (Iphone 7, IOS 13) | 1.6.1 (IPhone SE, IOS 14) | 21/09/20 (IPhone7, IOS 13) | 21/09/20(IPhone SE, IOS 14)
-- | -- | -- | -- | --
receiving 50 messages (foreground on 1.6.1, background +PNs on 21/09/20) | -0.5 | 0.5 | 0.4 | 0.2
sending 50 ordinary messages to public chat | 0.5 | 1.3 | 0.8 | 0.9
sending 20 messages to 1-1 chat (on 21/09/20 with mentions) | 0.2 | 0.6 | 1.1 | 1.3

Let me know if more cases should be checked.
cc @cammellos

bug performance

Most helpful comment

I figured out I believe the root cause of this issue, there was a bug in status-go that would cause a busy loop to run, due to push notifications.
The fix will be included in 1.10 and hopefully it should resolve the issue.

All 26 comments

Ok,
The issue seems to be in sending mentions.
What we added related to this in 1.7 is:

1) Sending PNs
2) Parsing mentions in status-go
3) Sending PNs for mentions in public chats
4) Parsing mentions in status-react (correct me if I am wrong @rasom )
5) Autocomplete for mentions in status-react

If the issue is only in public chats, it does seems to be related to sending mentions in public chats, as at least an extra message need to be sent for each mentioned user.
I'll investigate further.

Profile > Advanced > Send PNs is ON:
status_logs.zip - last 3 mins sending 20 messages, phone heat up ~1C

Profile > Advanced > Send PNs is OFF:
status_logs.zip - last 4
mins sending 20 messages, phone heat up ~0.3C

@cammellos in develop on status-react side we added

  1. replacing of mentions with pubkeys before passing message to status-go side
  2. mention suggestions on typing
  3. mentions highlighting in input on typing

Checking the logs there's nothing obviously wrong,
we are not sending really any PN has probably the users who are being mentioned don't have PN enabled, nor we are excessively querying the push notification server.

@churik tested with Send push notification off and the phone does not get hot.
So that seems to indicate that the issue is in status-go rather than in status-react, you are off the hook @rasom :)

My bad, I misread the description, is not for public chats.
In 1-to-1 we don't send PN for mentions, so it should not matter much, it's a bit odd.

I will recheck the same case with public and 1-1 chat and Send push notification off and on one more time and will post here results with logs

Ok, so seems that https://github.com/status-im/status-react/issues/11197#issuecomment-696151555 was a result of something else, so I rechecked and here we are:

Case | Description | Send push notifications | Temp. difference | Logs
-- | -- | -- | -- | --
1 | sending 20 messages with mentions to 1-1 chat | ON | 0.9-1.2 | status_logs.zip
2 | sending 20 messages with mentions to 1-1 chat | OFF | 1.3-1.5 | status_logs.zip
3 | sending 20 messages with mentions to public chat | ON | 0.4-0.5 | status_logs.zip
4 | sending 20 messages with mentions to public chat | OFF | 0.5-0.6 | status_logs.zip

As I can see from last measurements it doesn't really depend on Send push notifications and definitely affects mostly 1-1 chat, so probably we need summon @rasom again

@churik in case if you send 20 regular messages without mentions in 1-1 numbers are fine, right?

that's the good question! rechecking this on 1.6.1 and on current nightly

Just to clarify: in all those mentions related features the difference between different types of chats is only in the computation of "mentionable users". And that list is the shortest for 1-1 because it only contains contacts. So I would expect that if performance is bad in 1-1 chats it should be even worse in group chats.

Yes, at this point it might be non-mention related, 1-to-1 are more expensive to send then public chat messages, private group chat should also be heavier, in order of resource consumptions:

1) Public, light to send
2) 1-to-1, heavier
3) Group chats, heavier, proportional to the number of users in chat.

Description | Build | Send push notifications | Temp. difference | Logs | Time
-- | -- | -- | -- | -- | --
sending 20 ordinary messages to 1-1 chat | nightly 27/09 | ON | 0.7-1.1 | status_logs.zip | 15:15-15:17
sending 20 ordinary messages to 1-1 chat | nightly 27/10 | OFF | 0.4-0.6 | status_logs.zip | 15:28 - 15:29
sending 20 ordinary messages to 1-1 chat | release 1.6.1 | - | 0.1-0.3 | status_logs.zip | 15:40

So yes, I can see performance degradation for current nightly in 1-1 chat comparing to release.
I'll recheck it for Android and for group chats tomorrow and will update this comment.
Sorry for confusion, I didn't know exactly what is the place I should look at.

why does this happen only on ios ?

They run the same code, so I think this should happen in both cases, if it happens only on IOS maybe some processors differences that make some operations more cpu intensive, but I'd think is a red-herring.

so if you type fast on a slow device, this might be the reason, nothing should be recalculated or rerendered when typing

its not great, but i don't say its the main reason of heating

should be in advanced --- notifications

On Tue, Sep 22, 2020, 12:07 flexsurfer notifications@github.com wrote:

btw there is no option Send push notifications

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/status-im/status-react/issues/11197#issuecomment-696627591,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AAHYJMCIPUNFQMRHMMX2DADSHBZMVANCNFSM4RURBW2A
.

So:

Case | Description | Phone | Build | Send push notifications | Temp. difference | Logs | Time
-- | -- | -- | -- | -- | -- | -- | --
1 | sending 20 ordinary messages to 1-1 chat | IPhone 7 | nightly 27/09 | ON | 0.7-1.1 | status_logs.zip | 15:15-15:17
2 | sending 20 ordinary messages to 1-1 chat | IPhone 7 | nightly 27/09 | OFF | 0.4-0.6 | status_logs.zip | 15:28 - 15:29
3 | sending 20 ordinary messages to 1-1 chat | IPhone 7 | release 1.6.1 | - | 0.1-0.3 | status_logs.zip | 15:40
4 | sending 20 ordinary messages to group chat (5 participants) | IPhone 7 | nightly 27/09 | ON | 1.2-1.4 | status_logs.zip | 08:32 -08:33
5 | sending 20 ordinary messages to group chat (5 participants) | IPhone 7 | nightly 27/09 | OFF | 1.2-1.4 | status_logs.zip | 09:25-09:26
6 | sending 20 ordinary messages to group chat (5 participants) | IPhone 7 | release 1.6.1 | - | 0.6-1 | status_logs.zip | 09:37-09:38
7 | typing-clearing text in input field (20 times) | IPhone 7 | nightly/release | - | 0.9-1.1 |   |  no difference between nightly and release
8 | sending 20 ordinary messages to 1-1 chat | Xiaomi Mi Note 9 | nightly 27/09 | - | 0.4-0.6 | Status-debug-logs.zip | 10:14-10:15
9 | sending 20 ordinary messages to 1-1 chat | Xiaomi Mi Note 9 | release 1.6.1 | - | 0.1-0.2 | Status-debug-logs.zip | 10:11-10:12

So as I can see, performance is decreased in cases 1, 2, 4, 5, 8 regardless of platform.

@cammellos @flexsurfer please let me know if I can do smth else about it.

It's not clear as of now what it is.
Disecting the issue:

Sending PNs

Disabling sending pns should fix the issue (some extra work is done but should really be minimal).
According to https://github.com/status-im/status-react/issues/11197#issuecomment-696178335 should not be the case.

Parsing mentions in status-go

This happens both on received and sent messages, so we should be seeing the same performance degradation on receiving messages, and receiving messages it should be much worse.

replacing of mentions with pubkeys before passing message to status-go side

This can be tested https://github.com/status-im/status-react/pull/11226

mention suggestions on typing

I can push out a build removing this step

mentions highlighting in input on typing

I can push out a build removing this step

https://github.com/status-im/status-react/pull/11231 in this PR mentions ui is disabled:

  1. mentions are not replaced with pubkyes
  2. no suggestion
  3. no highlighted mentions in input

image
something wrong for sure

Likely related issue was reported by @fizzgig

Issue

  • Mailserver syncing issues (blue bar at the top)
  • Battery drain
  • By recollection ca. 2x in the past 6 weeks

Details

  • Release 1.8 (Android)
  • App in background
  • No notifications enabled
  • 4-5 private chats, no public chats
  • Mailserver usually auto selects to Hong Kong

Next step

Compare performance of build without mentions to build with mentions. Provided by @rasom in comment and PR

11231

Sorry, wrong account (comment by @hesterbruikman)

I figured out I believe the root cause of this issue, there was a bug in status-go that would cause a busy loop to run, due to push notifications.
The fix will be included in 1.10 and hopefully it should resolve the issue.

This is now fixed and included in develop

Was this page helpful?
0 / 5 - 0 ratings