Skip to content
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

many sync - big battery drain #2733

Open
progserega opened this issue Jan 28, 2021 · 8 comments
Open

many sync - big battery drain #2733

progserega opened this issue Jan 28, 2021 · 8 comments

Comments

@progserega
Copy link

progserega commented Jan 28, 2021

Android Element use many sync calls at every day and it is in top of battery usage.

Element do many sync periodicaly - this is strange. For example - we get 2021-01-26 (graphs show only syncs-requests of my phone to my matrix-server) - every 2 hour we get many syncs. And get every hour at second part of day:
2021-01-26-syncs
Statistics from server logs about this day:

cat /var/log/matrix-synapse/homeserver.log* | grep 2021-01-26 | grep '@progserega:rsprim.ru' | grep YD201 | cut -d ' ' -f26 | cut -d '?' -f1 | cut -d '+' -f1 | cut -d '!' -f1 | sort | uniq -c | sort -n
      1 /_matrix/client/r0/sendToDevice/m.room_key_request/$local.602bef93-d447-4c45-a028-16e224105c75
      2 /_matrix/client/r0/capabilities
      2 /_matrix/client/r0/pushers/set
      2 /_matrix/client/r0/voip/turnServer
      2 /_matrix/media/r0/config
      6 /_matrix/client/r0/pushers
      6 /_matrix/media/r0/upload
      7 /_matrix/client/unstable/room_keys/version
      9 /_matrix/client/r0/user/@progserega:rsprim.ru/account_data/im.vector.setting.breadcrumbs
     11 /_matrix/client/r0/devices
     16 /_matrix/media/r0/preview_url
     18 /_matrix/client/unstable/room_keys/keys
     32 /_matrix/client/r0/rooms/
     80 /_matrix/client/r0/keys/query
    423 /_matrix/client/r0/groups/
   4013 /_matrix/client/r0/sync

I think ~4000 syncs per day - big value. I wont show number events received by me at this day, but I do not know sql query for that. If you help me - I will attach this information in comment.

For example - week syncs:
week-syncs
We see periodicaly strange big number of syncs...

this essue as continue of #2163

Element Android: 1.0.13 gplay
Phone: Yotaphone2
Server: matrix-synapse-py3 1.21.2+stretch1 amd64 on debian 9

@progserega
Copy link
Author

Yesterday, I get more big battery drain again:
Phone:
Screenshot_20210523-101148
Syncs log on my server (this is syncs only from my phone, which I grep from server log):
sync
500 syncs every ~2 hour... :-/ It is not normal. What is occur?

@Beiri22
Copy link

Beiri22 commented May 25, 2021

I did not measure syncs; but from time to time my android complains about high battery drain caused by element...

@progserega
Copy link
Author

2 days ago my frends said me - change element to fluffy chat and see what I get.

So, I setup some monitoring sync for fluffy chat and element desktop (some account). And I get some statistic from phone for fluffy chat.
So...
Syncs on server for element-desktop:
sync_element_desktop
Syncs on my server for fluffy chat:
sync_fluffy_chat
Battery use by fluffy chat:
First day:
Screenshot_20210526-181216

Second day:
Screenshot_20210527-182737

Stat for second day:
Screenshot_20210527-182740

For example battery use element-desktop some day ago:
Screenshot_20210523-101148

Result:

  1. Some strange situation for all clients: every 2 hour occure many syncs to server (I use ii matrix-synapse-py3 1.21.2+stretch1 amd64 Open federated Instant Messaging and VoIP server - debian 9.13)
  2. But with this syncs - fluffy chat not use so more battery then element-android.

@progserega
Copy link
Author

progserega commented May 28, 2021

Today I restore Element-android (clear all cache in element options for clear test) and from second half of day I also use element-android. Fluffy chat stay work from day begin. And I see that element use more battery then Fluffy chat. And after restore element-android phone become freeze and heat and battery drain.

I can not use phone - element-android freeze phone to unusable state... :-(
scaled_screenshot_20210528-205442

@progserega
Copy link
Author

Today I logout from my account on android-element, clear all data from app, login again and get new situation on server:
1
And on phone:
Screenshot_20210604-170613

So, battery drain gone... I think problem in code, which resend unsent file. Some time ago I was seeing such situation.
May be element regularly try send unsent file - this not success, he tray again and again.
I will try test this steps to reproduce:

  1. set on "airplane mode"
  2. send file
  3. wait ~2-3 minutes
  4. set "airplane mode" off
  5. see - how file will be sent. If it is not sent success - see how battery drain will be occur.

@progserega
Copy link
Author

Today I test this steps:
#2803 (comment)
So, battery drain become occur. Phone not sleep all this day and at servers logs I see many-many syncs:

1
For example at screen show last 7 days.
And screenshots from phone (at first we see, that phone not sleep today, but today I do not use phone - he simply stay on table):
Screenshot_20210606-212928 Screenshot_20210606-212920

@progserega
Copy link
Author

progserega commented Aug 24, 2021

My phone very freeze. And today I start android console for see which app eat CPU:

Screenshot_20210824-141004

I remove element from "running app list" (swipe element in list), eating CPU lost, but when phone receive new message in chat - "top" again show element with 12-40% CPU 1-2 minutes. Some times it is not use CPU, but some times phone freeze and top show big cpu use by element.

@ouchadam
Copy link
Contributor

#4225 may have helped with this (included in EA 1.3.4)

@progserega could I ask for you check again with a recent version of the app? 🤞

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants