element-hq / element-android

A Matrix collaboration client for Android.
https://element.io/
GNU Affero General Public License v3.0
3.34k stars 709 forks source link

Stuck on initial sync #983

Closed ppapadeas closed 3 years ago

ppapadeas commented 4 years ago

Using latest Android build from play store. After signing in with a matrix.org account I am stuck on an endless "Initial Sync: Importing account" SmartSelect_20200211-145358_RiotX

mairin commented 4 years ago

I have the same thing going on.

Update: tried clearing cache, rebooting, uninstalling and reinstalling, none seem to fix it. I let it sit for ~48 hours and no change.

emmaguy commented 4 years ago

Just ran into this too and happened to have logcat open - it was caused by a timeout exception (sorry, didn't keep the stacktrace!). I think the matrix.org server was just being very slow at the time, have retried again now and it worked okay.

The app could recover better - the spinner just keeps on spinning, so there's no way to recover or even know it's failed in the background.

Dorifer commented 4 years ago

I seem to have the same problem unsing the most recent version from f-droid (0.210) and a custom synapse server (chaostreff.at) the app successfully connects to the server but seems to be starting over the initial sync over and over again.

ppapadeas commented 4 years ago

Problem still persists as of updated version on 2020-07-20. Nice call on force updating old riot.im apps to Element on Android. Now I cannot use my matrix.org on my phone. Good call :+1:

mairin commented 4 years ago

I have the same issue with Element now, it never resolved. I can't log into matrix at all now from my mobile :(

SuperSandro2000 commented 4 years ago

Same happening to me. Couldn't find any meaningful error.

NHAS commented 4 years ago

This is definitely still an issue, Im running into it now. This is on a custom homeserver, that lives in my local network with no other users, so unlikely to be just because of slowness.

Bit of a blocking issue for me to get my friends on this.

As some added information, if you sign up through the android app you can access that account just fine. Just logging in to an existing account seems to trigger this issue. Cross signing perhaps?

Did anyone end up coming up with a solution to this?

bill-rich commented 4 years ago

I'm running into the same problem with a custom home server. I haven't found a solution yet.

NHAS commented 4 years ago

@bill-rich In the end it turned out that I had misconfigured public_baseurl under synapse to point to the wrong domain.

This happened due to me using delegation to assign matrix.certainlyawesome.com as my matrix server, However, I misunderstood the purpose of public_baseurl and set it to https://certainlyawesomesome.com instead of the correct value of https://matrix.certainlyawesome.com.

As initially this issue deals with matrix.org, I'd be very surprised if they had made the same mistake. So its probably two different issues leading to the same presentation.

SuperSandro2000 commented 4 years ago

I have a sec record and we'll known forwarding. Federation tester is happy, too and it worked very well with riotx and still does with riot web. So it probably isn't an issue with the Homeserver.

bmarty commented 4 years ago

@Dorifer I tried to create an account on chaostreff.at but registration is disabled. I do not reproduce the issue on matrix.org, so anyone who encounter the issue please provide homeserver url and test account if you want us to investigate this.

jan--f commented 4 years ago

I was about to open create a test account as I had the same issue. I wanted to make sure everything was configured correctly before commenting here. Turns out (I believe) that there was a configuration error that caused this behaviour. I sadly didn't make backup of the ostensibly broken config but I think the issue was the following: The matrix-synapse docu had a change recently in the sample reverse proxy config introduced by https://github.com/matrix-org/synapse/pull/7823. My synapse server runs under the matrix subdomain, served by nginx. synapse itself binds to 8008 on localhost. My nginx site for matrix would proxy <mydomain>:8448 to localhost:8008 as the example used to indicate. I think it should have forwarded matrix.<mydomain>:8448. After adjusting the site config according to the current reverse proxy exmaple, the inital sync succeeds just fine.

Keep in mind I'm writing this after the fact and I might have changed other things on the way I don't remember or add/leave out mistakes, but this is my best recollection of how I got to a working setup. So grains of salt apply but maybe this can be helpful to others.

SuperSandro2000 commented 4 years ago

@jan--f that can't be the problem in my case. I only ever served https on port 443 and never change that. It could be the case that the postgres crashed due to OOM. My monitoring never catched that because it does not collect data as fast and the high memory was only ever for very short periods.

ghost commented 3 years ago

In the end it turned out that I had misconfigured public_baseurl under synapse to point to the wrong domain.

This happened due to me using delegation to assign matrix.certainlyawesome.com as my matrix server, However, I misunderstood the purpose of public_baseurl and set it to https://certainlyawesomesome.com instead of the correct value of https://matrix.certainlyawesome.com.

I had this issue as well and it turned out to be the wrong public_baseurl -- the comment felt like it implies it should be the url at the end of usernames, not the delegated url. (English is not my home language)

wlcx commented 3 years ago

Seeing this with element 1.0.10 and dendrite 0.3.1 too... Stays stuck at this dialog across force quits and restarts of the app/phone as others have reported.

ShadowJonathan commented 3 years ago

This happens when the server is collecting too much data to send to the client, and so the client times out the connection, i see 200! happen on serverside requests (on synapse), which means that the client closed the connection.

Android really needs to not care about grabbing all pages upon first sync, i now cant log into matrix from my phone...

ShadowJonathan commented 3 years ago

Update: I set filter_timeline_limit to 25 (manually) and now it finally logged in.

Samgarr commented 3 years ago

Same issue here, lowering filter_timeline_limit did not help.

ShadowJonathan commented 3 years ago

Looking further into it, and poking at some rough statistics and heuristics i got from the server, i have a suspicion that it's linked to inefficient stateres caching and resolution, and maybe linked with https://github.com/matrix-org/synapse/issues/8612.

Should a synapse counterpart issue be created here? It's effectively a timeout on initial sync, where the server is too slow and only creates results after 400 seconds (according to the logs) or so, and doesn't cache the result afterwards.

Again, this is an issue where the internal exception mechanism just drops it, doesn't even update the UI to reflect it, and doesn't even retry the sync.

Samgarr commented 3 years ago

I tried Fluffychat instead Element for Android and initial sync went without issue.

dakontiva commented 3 years ago

@bill-rich In the end it turned out that I had misconfigured public_baseurl under synapse to point to the wrong domain.

This happened due to me using delegation to assign matrix.certainlyawesome.com as my matrix server, However, I misunderstood the purpose of public_baseurl and set it to https://certainlyawesomesome.com instead of the correct value of https://matrix.certainlyawesome.com.

As initially this issue deals with matrix.org, I'd be very surprised if they had made the same mistake. So its probably two different issues leading to the same presentation.

this worked for me too!

bmarty commented 3 years ago

Ok, so probably due to some misconfiguration server side and also https://github.com/matrix-org/synapse/issues/9264 which is now fixed.

telmich commented 3 years ago

I see the exact same problem for an account with a lot of rooms and high latency (Korea <-> Switzerland). While element-web is able to pickup, element/android seems to stay in that endless loop, now for 72h.

ouchadam commented 2 years ago

I've also randomly encountered this using a matrix.org account, the account has 1 DM and 1 room (matrix-hq) From the adb logs I could see the sync task completed multiple times and was in the waiting for future events phase.

Closing the app from recents and relaunching, everything works as expected

bmarty commented 2 years ago

on EA 1.3.2