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

Initial sync may never complete if you have insufficient bandwidth to download the response before JS SDK knifes it #2737

Closed
ara4n opened this issue Dec 11, 2016 · 22 comments · Fixed by matrix-org/matrix-js-sdk#392
Assignees
Labels
P1 S-Major Severely degrades major functionality or product features, with no satisfactory workaround T-Defect

Comments

@ara4n
Copy link
Member

ara4n commented Dec 11, 2016

@aviraldg has complained about this many times, but we don't seem to have a dedicated bug. I was just bitten badly by it - it took me about 10 mins to eventually download my initial /sync on 3G, not because the request was 504ing but because the JS SDK was getting bored and knifing the request mid-download.

The logs look like this:

2016-12-11 20:25:39.462 index.js:231 Vector starting at https://riot.im/develop/#/
2016-12-11 20:25:39.482 index.js:101 Routing URL https://riot.im/develop/#/
2016-12-11 20:25:39.482 MatrixChat.js:780 Ignoring showScreen for ''
2016-12-11 20:25:39.484 Lifecycle.js:200 Restoring session for @matthew:matrix.org
2016-12-11 20:25:39.484 Lifecycle.js:238 setLoggedIn => @matthew:matrix.org (guest=false) hs=https://matrix.org
2016-12-11 20:25:39.485 Lifecycle.js:260 Session persisted for @matthew:matrix.org
2016-12-11 20:25:39.608 sync.js:49 SyncApi.sync: starting with sync token null
2016-12-11 20:25:39.616 index.js:121 newscreen 
2016-12-11 20:25:40.056 client.js:2786 Got TURN URIs: turn:turn.matrix.org:3478?transport=udp,turn:turn.matrix.org:3478?transport=tcp,turns:turn-ssl.matrix.org:443?transport=tcp refresh in 86400 secs
2016-12-11 20:25:40.094 sync.js:49 Got push rules
2016-12-11 20:25:40.502 Presence.js:83 Presence: online
2016-12-11 20:27:30.534 sync.js:550 /sync error MatrixError
(anonymous) @ sync.js:550
_rejected @ q.js:844
(anonymous) @ q.js:870
when @ q.js:1122
Promise.promise.promiseDispatch @ q.js:788
(anonymous) @ q.js:604
runSingle @ q.js:137
flush @ q.js:125
onNextTick @ main.js:64
Item.run @ browser.js:153
drainQueue @ browser.js:123
2016-12-11 20:27:30.536 sync.js:551 MatrixError
(anonymous) @ sync.js:551
_rejected @ q.js:844
(anonymous) @ q.js:870
when @ q.js:1122
Promise.promise.promiseDispatch @ q.js:788
(anonymous) @ q.js:604
runSingle @ q.js:137
flush @ q.js:125
onNextTick @ main.js:64
Item.run @ browser.js:153
drainQueue @ browser.js:123
2016-12-11 20:27:30.537 sync.js:49 Starting keep-alive
2016-12-11 20:27:30.543 MatrixChat.js:630 MatrixClient sync state => RECONNECTING
2016-12-11 20:29:26.392 sync.js:550 /sync error MatrixError
(anonymous) @ sync.js:550
_rejected @ q.js:844
(anonymous) @ q.js:870
when @ q.js:1122
Promise.promise.promiseDispatch @ q.js:788
(anonymous) @ q.js:604
runSingle @ q.js:137
flush @ q.js:125
onNextTick @ main.js:64
Item.run @ browser.js:153
drainQueue @ browser.js:123
2016-12-11 20:29:26.398 sync.js:551 MatrixError
(anonymous) @ sync.js:551
_rejected @ q.js:844
(anonymous) @ q.js:870
when @ q.js:1122
Promise.promise.promiseDispatch @ q.js:788
(anonymous) @ q.js:604
runSingle @ q.js:137
flush @ q.js:125
onNextTick @ main.js:64
Item.run @ browser.js:153
drainQueue @ browser.js:123
2016-12-11 20:29:26.400 sync.js:49 Starting keep-alive
2016-12-11 20:29:26.408 MatrixChat.js:630 MatrixClient sync state => RECONNECTING
2016-12-11 20:31:25.351 sync.js:550 /sync error MatrixError
(anonymous) @ sync.js:550
_rejected @ q.js:844
(anonymous) @ q.js:870
when @ q.js:1122
Promise.promise.promiseDispatch @ q.js:788
(anonymous) @ q.js:604
runSingle @ q.js:137
flush @ q.js:125
onNextTick @ main.js:64
Item.run @ browser.js:153
drainQueue @ browser.js:123
2016-12-11 20:31:25.352 sync.js:551 MatrixError
(anonymous) @ sync.js:551
_rejected @ q.js:844
(anonymous) @ q.js:870
when @ q.js:1122
Promise.promise.promiseDispatch @ q.js:788
(anonymous) @ q.js:604
runSingle @ q.js:137
flush @ q.js:125
onNextTick @ main.js:64
Item.run @ browser.js:153
drainQueue @ browser.js:123
2016-12-11 20:31:25.353 sync.js:49 Starting keep-alive
2016-12-11 20:31:25.358 MatrixChat.js:630 MatrixClient sync state => RECONNECTING

The timeout looks to be 129s or so.

@ara4n
Copy link
Member Author

ara4n commented Dec 11, 2016

see also #1846 and #1510

@ara4n ara4n added T-Defect S-Major Severely degrades major functionality or product features, with no satisfactory workaround P1 labels Dec 20, 2016
@superdump
Copy link
Contributor

As mentioned elsewhere, I believe, the vast majority of an initial sync request is in state events and almost all of those are regarding membership.

In my mind, a not-too-complex solution could be:

  • conduct an initial /sync request that excludes all timeline and state events, similar to what one would expect of a filter with limit set to 0 for both room timeline and state. Unfortunately the limit filter does not work for state.
  • kick off long-polling /sync as usual
  • simultaneously and asynchronously request data as you need it in your app/UI from other end points

The last point, for example with riot web, would already have the room list and unread count after the initial sync, which should take care of the room list.

As a room is focused, one needs to backfill it with enough messages and state events to fill the screen. This could be done by sending requests to messages, state, or so, room endpoints to obtain only the required data that would be visible. Messages is paginated, state is not.

The member list would also need to be populated. There is a room members endpoint but it is not paginated. Then one needs to get the avatars for those members in the member list that are visible and those members that sent messages to the room that are visible.

I've probably missed some bits and pieces but I think that's about the minimum you could do.

Incremental sync should be used if possible.

It may be simpler to implement and support this via pagination but currently, as mentioned, state events cannot be filtered with the limit filter.

Just my initial thoughts on minimizing data. I'm not suggesting it's necessarily a sensible solution.

@superdump
Copy link
Contributor

olm and the riot web bundle are about 2MB on /develop as well.

@pik
Copy link

pik commented Jan 5, 2017

  • kick off long-polling /sync as usual
  • simultaneously and asynchronously request data as you need it in your app/UI from other end points

If I understand correctly from the client-side your approach would look something like this:

/sync # with state: { limit: 0}, timeline: { limit: 0}
# Receives the account_data, notifications, joined_room list, no timeline or room membership info
# For the currently open room in the web-client fetch at the separate endpoints:
/messages
/membership
# Now do a full sync for everything else in the background? 
/sync # with state: { limit: null }, timeline: { limit: 20 }

I guess one concern I would have with this approach is that I think sync uses a single token to mark stream position (?) , so you cannot exactly tell /sync: hey for room MatrixHQ I only need the membership events since xxx (since they would have already been synced separately).

On further thought events seem to be gathered in batches (by room_id): https://github.com/matrix-org/synapse/blob/master/synapse/storage/stream.py#L236

So it wouldn't require a lot of changes to enable specifying a from_key on a per room-basis, which would than over-ride the default from_key if a client has gotten /messages separately for a room?

@superdump
Copy link
Contributor

/sync # with state: { limit: 0}, timeline: { limit: 0}

Yes, except that "state":{"limit":0} doesn't work currently. You can use "state":{"not_types":"m.room.*"} or event just "*" for now I guess. I think ephemeral and others could possibly be filtered too if, for example, it is not immediately important to see who has read to where right from the start but only for after one has synced.

# Receives the account_data, notifications, joined_room list, no timeline or room membership info

You at least know which rooms you are a member of but you don't know about other members.

# For the currently open room in the web-client fetch at the separate endpoints:
/messages
/membership

/messages absolutely. And then perhaps /state or /members or a combination of the two. Not sure about that bit exactly as it would need some trial and error and possibly modifications in synapse/the spec to support pagination and use of stream tokens or whatever as necessary. It also depends how much and what state is absolutely needed.

# Now do a full sync for everything else in the background? 
/sync # with state: { limit: null }, timeline: { limit: 20 }

Just a regular sync with a timeout and with no filter I think.

Please note that all of this is my non-expert opinion. @erikjohnston @ara4n @richvdh may have opinions or corrections or so on all of this.

@superdump
Copy link
Contributor

The complex part with this kind of fragmented/divided asynchronous approach is going to be in implementing the management of the backfill requests (for timeline and state events) in a clean way on the client side. Without knowing about the Matrix JS and Riot React SDKs and maybe even the Riot web app, I wouldn't be surprised if it required quite a lot of changes at all levels.

If I have correctly understood the separation of concerns - changes could be needed in the Matrix JS SDK or maybe the 'Structures' in the Riot React SDK to implement the logic of dynamic backfilling, in the Riot React SDK (in the 'Views'?) to trigger the backfilling from the components there when data is not present and to display something sensible (spinners and such) until the data is available. Not sure how much reusable code is there for this cause nor how much is already done/suitable with minor modification.

Natural counter arguments for this are that it would need to be implemented in all client SDKs to benefit everyone, but once it's been figured out in one SDK, it is hopefully easier to port over the logic to others. It should be possible to implement as a backward-compatible UX improvement - you can just do a full initial sync and then go into long-polling if you want. Maybe maintaining the more complex implementation is tricky... but perhaps not? Depends how cleanly it can be implemented.

@pik
Copy link

pik commented Jan 6, 2017

Yes, except that "state":{"limit":0} doesn't work currently. You can use "state":{"not_types":"m.room."} or event just "" for now I guess.

That will filter after querying which is wasteful though, furthermore probably the check_valid_filter function should be fixed to raise an error when passed invalid filter params as well. I'm not sure whether limit particularly makes sense for state since when would you want to have 30 events as opposed to all or none of them? In that case maybe state: { include: false } would make more sense as a filter option?

The complex part with this kind of fragmented/divided asynchronous approach is going to be in implementing the management of the backfill requests (for timeline and state events) in a clean way on the client side. Without knowing about the Matrix JS and Riot React SDKs and maybe even the Riot web app, I wouldn't be surprised if it required quite a lot of changes at all levels.

It should be simple if the components are modularly written, if they aren't that's a design issue that should probably be fixed anyways? Since the ability to render a responsive/useful GUI should be an independent concern from the methods by which the data is acquired?

@superdump
Copy link
Contributor

superdump commented Jan 6, 2017

Yes, except that "state":{"limit":0} doesn't work currently. You can use "state":{"not_types":"m.room."} or event just "" for now I guess.

That will filter after querying which is wasteful though,

That is a synapse implementation detail and could potentially be improved at least for some cases.

furthermore probably the check_valid_filter function should be fixed to raise an error when passed invalid filter params as well. I'm not sure whether limit particularly makes sense for state since when would you want to have 30 events as opposed to all or none of them? In that case maybe state: { include: false } would make more sense as a filter option?

Part of my proposed solution is in not obtaining all state but only that which you need (and possibly also only when you need it.) If any request to any endpoint that returns state is an 'all or nothing' decision then you don't improve on the situation with Matrix HQ where there is a couple of MB of state. That needs to be broken up somehow.

The complex part with this kind of fragmented/divided asynchronous approach is going to be in implementing the management of the backfill requests (for timeline and state events) in a clean way on the client side. Without knowing about the Matrix JS and Riot React SDKs and maybe even the Riot web app, I wouldn't be surprised if it required quite a lot of changes at all levels.

It should be simple if the components are modularly written, if they aren't that's a design issue that should probably be fixed anyways? Since the ability to render a responsive/useful GUI should be an independent concern from the methods by which the data is acquired?

Absolutely. But then pragmatism and how much time people have to do things comes into play and maybe things aren't in the kind of shape the developers want but is in as good shape as they have had time for. Maybe everything is already awesome, I dunno. 😄 And I don't know who/how much time people have to look at something like this. If you have time, that's great!

@pik
Copy link

pik commented Jan 6, 2017

Absolutely. But then pragmatism and how much time people have to do things comes into play and maybe things aren't in the kind of shape the developers want but is in as good shape as they have had time for. Maybe everything is already awesome, I dunno. 😄 And I don't know who/how much time people have to look at something like this. If you have time, that's great!

I literally cannot run the web-client with the current state of things, so it's kind of a show-stopper for me.

@ara4n
Copy link
Member Author

ara4n commented Jan 11, 2017

i thought i'd already commented on this, but this bug has gone seriously off track. Completely agreed that initial sync needs to be faster, either by persisting state locally (bug #121), or filtering out irrelevant stuff (matrix-org/synapse#1782), or paginating the sync response per room (#1846), or paginating state somehow (#2914).

This bug is intended to be a specific one describing @aviraldg's actual issue, which is:

  • Client requests a sync.
  • Server starts generating it.
  • Client times out and retries
  • Server's still generating it, and picks up the new request and merges it with the 1st one
  • Server finishes generating it and starts streaming it to the client, and considers the requests complete and forgets about them.
  • If your bandwidth is too slow to xfer the sync response, the client timeout hits before it completes.
  • ...causing the client to timeout and start the whole thing over again; the server starts from scratch (modulo its caches).

The process only completes if you are lucky enough for the Nth request to land just before the server starts to stream the response, assuming the response is small enough to be transferred in 129s.

The solution to this is probably just to track down where the js-sdk timeout is coming from and increase it - or at least increase it for handling the data response. N.B. that loadbalancers like nginx may also timeout in-flight requests with 504s exacerbating the problem too.

Please let's not conflate all the other bugs together in here. Totally agreed that the sync shouldn't be so big anyway, but fixing that is for the other bugs.

@richvdh
Copy link
Member

richvdh commented Jan 11, 2017

The client-side timeout is controlled here: https://github.com/matrix-org/matrix-js-sdk/blob/develop/lib/sync.js#L39

(it is added to the 30-second timeout= sync param, to give 110 seconds)

@ara4n
Copy link
Member Author

ara4n commented Jan 11, 2017

@pik: are you saying that your problem is the same as @aviraldg's and the sync takes ages on bad connections (e.g. 20 minutes) and keeps looping round as per my description in #2737 (comment), or just that several minutes is too long to wait for a /sync on a busy account?

If the former, can you try increasing the timeout that @richvdh linked to and seeing if it helps? @aviraldg likewise?

@pik
Copy link

pik commented Jan 14, 2017

@ara4n @richvdh is correct that removing timeout will (at least as long as the request stays open) allow very bad connections to eventually sync and load riot-web. Which is to say that I still would consider it an open issue that it takes 20 minutes to display a useful UI on a slow-connection since the riot-web initial /sync really shouldn't be loading 1.3mb++ of state-events (that's not even a busy client, that's 3 or 4 rooms), when all it needs is a list of joined-rooms and some 20 timeline events to display a minimal useful UI.

@ara4n
Copy link
Member Author

ara4n commented Jan 14, 2017

@pik yes, i totally agree that riot should lazy-load data. that is not this bug, it is #121, #1846, matrix-org/synapse#1782, and #2914.

If the js-sdk timeout is sidestepped, /sync should take worst-case a few minutes on a very busy account. For instance, my account has 1000 rooms or so, and takes about 90 seconds for matrix.org to generate the sync response, and then another ~10s to download a few megabytes of gzipped JSON over.

Where is your figure of 20 minutes coming from? I am trying to work out whether you are seeing a different performance regression too, and if my theory on fixing this bug by changing that timeout is correct or not.

Please do not use this bug to discuss lazyloading /sync data.

@pik
Copy link

pik commented Jan 15, 2017

Where is your figure of 20 minutes coming from? I am trying to work out whether you are seeing a different performance regression too, and if my theory on fixing this bug by changing that timeout is correct or not.

I think that's purely from the terrible connection and not any other kind of regression.

screenshot from 2017-01-15 10-47-30

@ara4n
Copy link
Member Author

ara4n commented Jan 23, 2017

I'm entirely failing to initial sync right now - the requests are failing with 504 and seemingly never succeeding.

@ara4n
Copy link
Member Author

ara4n commented Jan 23, 2017

example logs of this failure mode (on relatively fast ski chalet wifi):

2017-01-23 18:47:05.468 MatrixChat.js:630MatrixClient sync state => RECONNECTING
2017-01-23 18:48:47.472 https://matrix.org/_matrix/client/r0/sync?filter=102&timeout=0&_cacheBuster… Failed to load resource: the server responded with a status of 504 (Gateway Time-out)
2017-01-23 18:48:47.473 sync.js:550/sync error SyntaxError: Unexpected token < in JSON at position 0
    at l (file:///Applications/Riot.app/Contents/Resources/app/webapp/bundle.44caf88d4add691a25b7.js:42:6585)
    at XMLHttpRequest.r (file:///Applications/Riot.app/Contents/Resources/app/webapp/bundle.44caf88d4add691a25b7.js:42:6070)(anonymous function) @ sync.js:550
2017-01-23 18:48:47.473 sync.js:551SyntaxError: Unexpected token < in JSON at position 0(…)(anonymous function) @ sync.js:551
2017-01-23 18:48:47.473 sync.js:49Starting keep-alive
2017-01-23 18:48:47.477 MatrixChat.js:630MatrixClient sync state => RECONNECTING
2017-01-23 18:49:05.640 Presence.js:83 Presence: online
2017-01-23 18:50:43.462 sync.js:550 /sync error e.exports.MatrixError(anonymous function) @ sync.js:550i @ q.js:844(anonymous function) @ q.js:870when @ q.js:1122r.promiseDispatch @ q.js:788(anonymous function) @ q.js:604r @ q.js:137e @ q.js:125runCallback @ timers.js:574tryOnImmediate @ timers.js:554processImmediate @ timers.js:533
2017-01-23 18:50:43.467 sync.js:551 e.e…s.MatrixError {errcode: "ORG.MATRIX.JSSDK_TIMEOUT", name: "ORG.MATRIX.JSSDK_TIMEOUT", message: "Locally timed out waiting for a response", data: Object}(anonymous function) @ sync.js:551i @ q.js:844(anonymous function) @ q.js:870when @ q.js:1122r.promiseDispatch @ q.js:788(anonymous function) @ q.js:604r @ q.js:137e @ q.js:125runCallback @ timers.js:574tryOnImmediate @ timers.js:554processImmediate @ timers.js:533
2017-01-23 18:50:43.468 sync.js:49 Starting keep-alive
2017-01-23 18:50:43.480 MatrixChat.js:630 MatrixClient sync state => RECONNECTING
2017-01-23 18:52:20.715 index.js:218 GET https://matrix.org/_matrix/client/r0/sync?filter=102&timeout=0&_cacheBuster… 504 (Gateway Time-out)t @ index.js:218e @ index.js:179_request @ http-api.js:649requestOtherUrl @ http-api.js:558request @ http-api.js:443authedRequest @ http-api.js:392o._sync @ sync.js:511(anonymous function) @ sync.js:562r @ q.js:834s.promiseDispatch.c @ q.js:863r.promiseDispatch @ q.js:796(anonymous function) @ q.js:604r @ q.js:137e @ q.js:125runCallback @ timers.js:574tryOnImmediate @ timers.js:554processImmediate @ timers.js:533
2017-01-23 18:52:20.717 sync.js:550 /sync error SyntaxError: Unexpected token < in JSON at position 0
    at l (file:///Applications/Riot.app/Contents/Resources/app/webapp/bundle.44caf88d4add691a25b7.js:42:6585)
    at XMLHttpRequest.r (file:///Applications/Riot.app/Contents/Resources/app/webapp/bundle.44caf88d4add691a25b7.js:42:6070)(anonymous function) @ sync.js:550i @ q.js:844(anonymous function) @ q.js:870when @ q.js:1122r.promiseDispatch @ q.js:788(anonymous function) @ q.js:604r @ q.js:137e @ q.js:125runCallback @ timers.js:574tryOnImmediate @ timers.js:554processImmediate @ timers.js:533
2017-01-23 18:52:20.718 sync.js:551 SyntaxError: Unexpected token < in JSON at position 0(…)(anonymous function) @ sync.js:551i @ q.js:844(anonymous function) @ q.js:870when @ q.js:1122r.promiseDispatch @ q.js:788(anonymous function) @ q.js:604r @ q.js:137e @ q.js:125runCallback @ timers.js:574tryOnImmediate @ timers.js:554processImmediate @ timers.js:533
2017-01-23 18:52:20.719 sync.js:49 Starting keep-alive
2017-01-23 18:52:20.724 MatrixChat.js:630 MatrixClient sync state => RECONNECTING
2017-01-23 18:54:16.858 sync.js:550 /sync error e.exports.MatrixError(anonymous function) @ sync.js:550i @ q.js:844(anonymous function) @ q.js:870when @ q.js:1122r.promiseDispatch @ q.js:788(anonymous function) @ q.js:604r @ q.js:137e @ q.js:125runCallback @ timers.js:574tryOnImmediate @ timers.js:554processImmediate @ timers.js:533
2017-01-23 18:54:16.859 sync.js:551 e.e…s.MatrixError {errcode: "ORG.MATRIX.JSSDK_TIMEOUT", name: "ORG.MATRIX.JSSDK_TIMEOUT", message: "Locally timed out waiting for a response", data: Object}(anonymous function) @ sync.js:551i @ q.js:844(anonymous function) @ q.js:870when @ q.js:1122r.promiseDispatch @ q.js:788(anonymous function) @ q.js:604r @ q.js:137e @ q.js:125runCallback @ timers.js:574tryOnImmediate @ timers.js:554processImmediate @ timers.js:533
2017-01-23 18:54:16.859 sync.js:49 Starting keep-alive
2017-01-23 18:54:16.864 MatrixChat.js:630 MatrixClient sync state => RECONNECTING
2017-01-23 18:55:51.150 index.js:218 GET https://matrix.org/_matrix/client/r0/sync?filter=102&timeout=0&_cacheBuster… 504 (Gateway Time-out)t @ index.js:218e @ index.js:179_request @ http-api.js:649requestOtherUrl @ http-api.js:558request @ http-api.js:443authedRequest @ http-api.js:392o._sync @ sync.js:511(anonymous function) @ sync.js:562r @ q.js:834s.promiseDispatch.c @ q.js:863r.promiseDispatch @ q.js:796(anonymous function) @ q.js:604r @ q.js:137e @ q.js:125runCallback @ timers.js:574tryOnImmediate @ timers.js:554processImmediate @ timers.js:533
2017-01-23 18:55:51.151 sync.js:550 /sync error SyntaxError: Unexpected token < in JSON at position 0
    at l (file:///Applications/Riot.app/Contents/Resources/app/webapp/bundle.44caf88d4add691a25b7.js:42:6585)
    at XMLHttpRequest.r (file:///Applications/Riot.app/Contents/Resources/app/webapp/bundle.44caf88d4add691a25b7.js:42:6070)(anonymous function) @ sync.js:550i @ q.js:844(anonymous function) @ q.js:870when @ q.js:1122r.promiseDispatch @ q.js:788(anonymous function) @ q.js:604r @ q.js:137e @ q.js:125runCallback @ timers.js:574tryOnImmediate @ timers.js:554processImmediate @ timers.js:533
2017-01-23 18:55:51.152 sync.js:551 SyntaxError: Unexpected token < in JSON at position 0(…)(anonymous function) @ sync.js:551i @ q.js:844(anonymous function) @ q.js:870when @ q.js:1122r.promiseDispatch @ q.js:788(anonymous function) @ q.js:604r @ q.js:137e @ q.js:125runCallback @ timers.js:574tryOnImmediate @ timers.js:554processImmediate @ timers.js:533
2017-01-23 18:55:51.153 sync.js:49 Starting keep-alive
2017-01-23 18:55:51.158 MatrixChat.js:630 MatrixClient sync state => RECONNECTING
2017-01-23 18:57:49.455 sync.js:550 /sync error e.exports.MatrixError(anonymous function) @ sync.js:550i @ q.js:844(anonymous function) @ q.js:870when @ q.js:1122r.promiseDispatch @ q.js:788(anonymous function) @ q.js:604r @ q.js:137e @ q.js:125runCallback @ timers.js:574tryOnImmediate @ timers.js:554processImmediate @ timers.js:533
2017-01-23 18:57:49.456 sync.js:551 e.e…s.MatrixError {errcode: "ORG.MATRIX.JSSDK_TIMEOUT", name: "ORG.MATRIX.JSSDK_TIMEOUT", message: "Locally timed out waiting for a response", data: Object}(anonymous function) @ sync.js:551i @ q.js:844(anonymous function) @ q.js:870when @ q.js:1122r.promiseDispatch @ q.js:788(anonymous function) @ q.js:604r @ q.js:137e @ q.js:125runCallback @ timers.js:574tryOnImmediate @ timers.js:554processImmediate @ timers.js:533
2017-01-23 18:57:49.456 sync.js:49 Starting keep-alive
2017-01-23 18:57:49.469 MatrixChat.js:630 MatrixClient sync state => RECONNECTING
2017-01-23 18:59:17.914 Presence.js:83 Presence: unavailable
2017-01-23 18:59:23.026 index.js:218 GET https://matrix.org/_matrix/client/r0/sync?filter=102&timeout=0&_cacheBuster… 504 (Gateway Time-out)t @ index.js:218e @ index.js:179_request @ http-api.js:649requestOtherUrl @ http-api.js:558request @ http-api.js:443authedRequest @ http-api.js:392o._sync @ sync.js:511(anonymous function) @ sync.js:562r @ q.js:834s.promiseDispatch.c @ q.js:863r.promiseDispatch @ q.js:796(anonymous function) @ q.js:604r @ q.js:137e @ q.js:125runCallback @ timers.js:574tryOnImmediate @ timers.js:554processImmediate @ timers.js:533
2017-01-23 18:59:23.028 sync.js:550 /sync error SyntaxError: Unexpected token < in JSON at position 0
    at l (file:///Applications/Riot.app/Contents/Resources/app/webapp/bundle.44caf88d4add691a25b7.js:42:6585)
    at XMLHttpRequest.r (file:///Applications/Riot.app/Contents/Resources/app/webapp/bundle.44caf88d4add691a25b7.js:42:6070)(anonymous function) @ sync.js:550i @ q.js:844(anonymous function) @ q.js:870when @ q.js:1122r.promiseDispatch @ q.js:788(anonymous function) @ q.js:604r @ q.js:137e @ q.js:125runCallback @ timers.js:574tryOnImmediate @ timers.js:554processImmediate @ timers.js:533
2017-01-23 18:59:23.029 sync.js:551 SyntaxError: Unexpected token < in JSON at position 0(…)(anonymous function) @ sync.js:551i @ q.js:844(anonymous function) @ q.js:870when @ q.js:1122r.promiseDispatch @ q.js:788(anonymous function) @ q.js:604r @ q.js:137e @ q.js:125runCallback @ timers.js:574tryOnImmediate @ timers.js:554processImmediate @ timers.js:533
2017-01-23 18:59:23.030 sync.js:49 Starting keep-alive
2017-01-23 18:59:23.035 MatrixChat.js:630 MatrixClient sync state => RECONNECTING
2017-01-23 19:01:16.450 sync.js:550 /sync error e.exports.MatrixError(anonymous function) @ sync.js:550i @ q.js:844(anonymous function) @ q.js:870when @ q.js:1122r.promiseDispatch @ q.js:788(anonymous function) @ q.js:604r @ q.js:137e @ q.js:125runCallback @ timers.js:574tryOnImmediate @ timers.js:554processImmediate @ timers.js:533
2017-01-23 19:01:16.451 sync.js:551 e.e…s.MatrixError {errcode: "ORG.MATRIX.JSSDK_TIMEOUT", name: "ORG.MATRIX.JSSDK_TIMEOUT", message: "Locally timed out waiting for a response", data: Object}(anonymous function) @ sync.js:551i @ q.js:844(anonymous function) @ q.js:870when @ q.js:1122r.promiseDispatch @ q.js:788(anonymous function) @ q.js:604r @ q.js:137e @ q.js:125runCallback @ timers.js:574tryOnImmediate @ timers.js:554processImmediate @ timers.js:533
2017-01-23 19:01:16.452 sync.js:49 Starting keep-alive
2017-01-23 19:01:16.456 MatrixChat.js:630 MatrixClient sync state => RECONNECTING
2017-01-23 19:02:51.012 index.js:218 GET https://matrix.org/_matrix/client/r0/sync?filter=102&timeout=0&_cacheBuster… 504 (Gateway Time-out)t @ index.js:218e @ index.js:179_request @ http-api.js:649requestOtherUrl @ http-api.js:558request @ http-api.js:443authedRequest @ http-api.js:392o._sync @ sync.js:511(anonymous function) @ sync.js:562r @ q.js:834s.promiseDispatch.c @ q.js:863r.promiseDispatch @ q.js:796(anonymous function) @ q.js:604r @ q.js:137e @ q.js:125runCallback @ timers.js:574tryOnImmediate @ timers.js:554processImmediate @ timers.js:533
2017-01-23 19:02:51.014 sync.js:550 /sync error SyntaxError: Unexpected token < in JSON at position 0
    at l (file:///Applications/Riot.app/Contents/Resources/app/webapp/bundle.44caf88d4add691a25b7.js:42:6585)
    at XMLHttpRequest.r (file:///Applications/Riot.app/Contents/Resources/app/webapp/bundle.44caf88d4add691a25b7.js:42:6070)(anonymous function) @ sync.js:550i @ q.js:844(anonymous function) @ q.js:870when @ q.js:1122r.promiseDispatch @ q.js:788(anonymous function) @ q.js:604r @ q.js:137e @ q.js:125runCallback @ timers.js:574tryOnImmediate @ timers.js:554processImmediate @ timers.js:533
2017-01-23 19:02:51.015 sync.js:551 SyntaxError: Unexpected token < in JSON at position 0(…)(anonymous function) @ sync.js:551i @ q.js:844(anonymous function) @ q.js:870when @ q.js:1122r.promiseDispatch @ q.js:788(anonymous function) @ q.js:604r @ q.js:137e @ q.js:125runCallback @ timers.js:574tryOnImmediate @ timers.js:554processImmediate @ timers.js:533
2017-01-23 19:02:51.015 sync.js:49 Starting keep-alive
2017-01-23 19:02:51.021 MatrixChat.js:630 MatrixClient sync state => RECONNECTING
2017-01-23 19:04:15.106 Presence.js:83 Presence: online
2017-01-23 19:04:30.210 index.js:218 GET https://matrix.org/_matrix/client/r0/sync?filter=102&timeout=0&_cacheBuster… 504 (Gateway Time-out)t @ index.js:218e @ index.js:179_request @ http-api.js:649requestOtherUrl @ http-api.js:558request @ http-api.js:443authedRequest @ http-api.js:392o._sync @ sync.js:511(anonymous function) @ sync.js:562r @ q.js:834s.promiseDispatch.c @ q.js:863r.promiseDispatch @ q.js:796(anonymous function) @ q.js:604r @ q.js:137e @ q.js:125runCallback @ timers.js:574tryOnImmediate @ timers.js:554processImmediate @ timers.js:533
2017-01-23 19:04:30.211 sync.js:550 /sync error SyntaxError: Unexpected token < in JSON at position 0
    at l (file:///Applications/Riot.app/Contents/Resources/app/webapp/bundle.44caf88d4add691a25b7.js:42:6585)
    at XMLHttpRequest.r (file:///Applications/Riot.app/Contents/Resources/app/webapp/bundle.44caf88d4add691a25b7.js:42:6070)(anonymous function) @ sync.js:550i @ q.js:844(anonymous function) @ q.js:870when @ q.js:1122r.promiseDispatch @ q.js:788(anonymous function) @ q.js:604r @ q.js:137e @ q.js:125runCallback @ timers.js:574tryOnImmediate @ timers.js:554processImmediate @ timers.js:533
2017-01-23 19:04:30.212 sync.js:551 SyntaxError: Unexpected token < in JSON at position 0(…)(anonymous function) @ sync.js:551i @ q.js:844(anonymous function) @ q.js:870when @ q.js:1122r.promiseDispatch @ q.js:788(anonymous function) @ q.js:604r @ q.js:137e @ q.js:125runCallback @ timers.js:574tryOnImmediate @ timers.js:554processImmediate @ timers.js:533
2017-01-23 19:04:30.213 sync.js:49 Starting keep-alive
2017-01-23 19:04:30.219 MatrixChat.js:630 MatrixClient sync state => RECONNECTING

@ara4n
Copy link
Member Author

ara4n commented Jan 23, 2017

I just managed to log in after a mere 10 minutes of retrying after upping the timeout in js-sdk to 20 minutes. Unsure if this is coincidence or not, or if I just got lucky with the 504 timing:

dispatcher.js:31 Dispatch: start_login
2017-01-23 19:21:35.075 MatrixChat.js:262 onAction: logout
2017-01-23 19:21:35.075 MatrixChat.js:262 onAction: start_login
2017-01-23 19:21:35.077 sync.js:51 SyncApi.stop
2017-01-23 19:21:35.077 dispatcher.js:31 Dispatch: on_logged_out
2017-01-23 19:21:35.078 sync.js:51 Sync no longer running: exiting
2017-01-23 19:21:35.079 MatrixChat.js:262 onAction: on_logged_out
2017-01-23 19:21:35.079 index.js:121 newscreen login
2017-01-23 19:21:35.080 MatrixChat.js:1011 rendering; loading=false; screen=undefined; logged_in=false; ready=false
2017-01-23 19:21:35.504 dispatcher.js:31 Dispatch: user_activity_end
2017-01-23 19:21:35.509 MatrixChat.js:262 onAction: user_activity_end
2017-01-23 19:21:39.518 https://matrix.org/_matrix/client/r0/login? Failed to load resource: the server responded with a status of 403 (Forbidden)
2017-01-23 19:21:44.382 Lifecycle.js:238 setLoggedIn => @matthew:matrix.org (guest=false) hs=https://matrix.org
2017-01-23 19:21:44.382 Lifecycle.js:260 Session persisted for @matthew:matrix.org
2017-01-23 19:21:44.405 dispatcher.js:31 Dispatch: on_logged_in
2017-01-23 19:21:44.405 dispatcher.js:31 Dispatch: will_start_client
2017-01-23 19:21:44.405 MatrixChat.js:262 onAction: will_start_client
2017-01-23 19:21:44.412 sync.js:51 SyncApi.sync: starting with sync token null
2017-01-23 19:21:44.414 MatrixChat.js:262 onAction: on_logged_in
2017-01-23 19:21:44.414 index.js:121 newscreen 
2017-01-23 19:21:44.415 MatrixChat.js:1011 rendering; loading=false; screen=undefined; logged_in=true; ready=false
2017-01-23 19:21:44.571 client.js:2887 Got TURN URIs: turn:turn.matrix.org:3478?transport=udp,turn:turn.matrix.org:3478?transport=tcp,turns:turn-ssl.matrix.org:443?transport=tcp refresh in 86400 secs
2017-01-23 19:21:44.711 Presence.js:83 Presence: online
2017-01-23 19:21:45.410 sync.js:51 Got push rules
2017-01-23 19:23:16.092 https://matrix.org/_matrix/client/r0/sync?filter=105&timeout=30000&_cacheBu… Failed to load resource: the server responded with a status of 504 (Gateway Time-out)
2017-01-23 19:23:16.092 https://matrix.org/_matrix/client/r0/sync?filter=105&timeout=30000&_cacheBu… Failed to load resource: the server responded with a status of 504 (Gateway Time-out)
2017-01-23 19:23:16.092 :8080/#/:1 XMLHttpRequest cannot load https://matrix.org/_matrix/client/r0/sync?filter=105&timeout=30000&_cacheBu…. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8080' is therefore not allowed access. The response had HTTP status code 504.
2017-01-23 19:23:16.508 sync.js:552 /sync error Error: CORS request rejected: https://matrix.org/_matrix/client/r0/sync?filter=105&timeout=30000&_cacheBu…
    at on_response (http://localhost:8080/bundles/1e05f58f88509faeaf12/bundle.js:67266:23)
    at XMLHttpRequest.on_state_change (http://localhost:8080/bundles/1e05f58f88509faeaf12/bundle.js:67249:8)
(anonymous) @ sync.js:552
2017-01-23 19:23:16.508 sync.js:553 Error: CORS request rejected: https://matrix.org/_matrix/client/r0/sync?filter=105&timeout=30000&_cacheBu…
    at on_response (index.js:259)
    at XMLHttpRequest.on_state_change (index.js:242)
(anonymous) @ sync.js:553
2017-01-23 19:23:16.508 sync.js:51 Starting keep-alive
2017-01-23 19:23:16.514 MatrixChat.js:679 MatrixClient sync state => RECONNECTING
2017-01-23 19:24:48.690 Presence.js:83 Presence: unavailable
2017-01-23 19:24:55.123 https://matrix.org/_matrix/client/r0/sync?filter=105&timeout=0&_cacheBuster… Failed to load resource: the server responded with a status of 504 (Gateway Time-out)
2017-01-23 19:24:55.123 https://matrix.org/_matrix/client/r0/sync?filter=105&timeout=0&_cacheBuster… Failed to load resource: the server responded with a status of 504 (Gateway Time-out)
2017-01-23 19:24:55.123 :8080/#/:1 XMLHttpRequest cannot load https://matrix.org/_matrix/client/r0/sync?filter=105&timeout=0&_cacheBuster…. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8080' is therefore not allowed access. The response had HTTP status code 504.
2017-01-23 19:24:55.454 sync.js:552 /sync error Error: CORS request rejected: https://matrix.org/_matrix/client/r0/sync?filter=105&timeout=0&_cacheBuster…
    at on_response (http://localhost:8080/bundles/1e05f58f88509faeaf12/bundle.js:67266:23)
    at XMLHttpRequest.on_state_change (http://localhost:8080/bundles/1e05f58f88509faeaf12/bundle.js:67249:8)
(anonymous) @ sync.js:552
2017-01-23 19:24:55.455 sync.js:553 Error: CORS request rejected: https://matrix.org/_matrix/client/r0/sync?filter=105&timeout=0&_cacheBuster…
    at on_response (index.js:259)
    at XMLHttpRequest.on_state_change (index.js:242)
(anonymous) @ sync.js:553
2017-01-23 19:24:55.455 sync.js:51 Starting keep-alive
2017-01-23 19:24:55.460 MatrixChat.js:679 MatrixClient sync state => RECONNECTING
2017-01-23 19:26:31.545 https://matrix.org/_matrix/client/r0/sync?filter=105&timeout=0&_cacheBuster… Failed to load resource: the server responded with a status of 504 (Gateway Time-out)
2017-01-23 19:26:31.545 https://matrix.org/_matrix/client/r0/sync?filter=105&timeout=0&_cacheBuster… Failed to load resource: the server responded with a status of 504 (Gateway Time-out)
2017-01-23 19:26:31.545 :8080/#/:1 XMLHttpRequest cannot load https://matrix.org/_matrix/client/r0/sync?filter=105&timeout=0&_cacheBuster…. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8080' is therefore not allowed access. The response had HTTP status code 504.
2017-01-23 19:26:32.391 sync.js:552 /sync error Error: CORS request rejected: https://matrix.org/_matrix/client/r0/sync?filter=105&timeout=0&_cacheBuster…
    at on_response (http://localhost:8080/bundles/1e05f58f88509faeaf12/bundle.js:67266:23)
    at XMLHttpRequest.on_state_change (http://localhost:8080/bundles/1e05f58f88509faeaf12/bundle.js:67249:8)
(anonymous) @ sync.js:552
2017-01-23 19:26:32.391 sync.js:553 Error: CORS request rejected: https://matrix.org/_matrix/client/r0/sync?filter=105&timeout=0&_cacheBuster…
    at on_response (index.js:259)
    at XMLHttpRequest.on_state_change (index.js:242)
(anonymous) @ sync.js:553
2017-01-23 19:26:32.391 sync.js:51 Starting keep-alive
2017-01-23 19:26:32.397 MatrixChat.js:679 MatrixClient sync state => RECONNECTING
2017-01-23 19:31:29.892 http://localhost:8080/version?cachebuster=1485196289814 Failed to load resource: the server responded with a status of 404 (Not Found)
2017-01-23 19:31:39.785 index.js:377 Starting key download for @matthew:matrix.org
2017-01-23 19:31:39.802 MatrixChat.js:679 MatrixClient sync state => PREPARED
2017-01-23 19:31:39.805 MatrixChat.js:1011 rendering; loading=false; screen=undefined; logged_in=true; ready=true
2017-01-23 19:31:40.086 MatrixChat.js:679 MatrixClient sync state => SYNCING

@ara4n
Copy link
Member Author

ara4n commented Jan 24, 2017

It just took me 11 minutes to login, using the 20 min JS timeout.

2017-01-24 17:11:58.686 Lifecycle.js:238 setLoggedIn => @matthew:matrix.org (guest=false) hs=https://matrix.org
2017-01-24 17:11:58.687 Lifecycle.js:260 Session persisted for @matthew:matrix.org
2017-01-24 17:11:58.811 sync.js:51 SyncApi.sync: starting with sync token null
2017-01-24 17:11:58.817 index.js:121 newscreen 
2017-01-24 17:11:58.823 MatrixChat.js:1011 rendering; loading=true; screen=undefined; logged_in=true; ready=false
2017-01-24 17:11:58.842 MatrixChat.js:1011 rendering; loading=false; screen=undefined; logged_in=true; ready=false
2017-01-24 17:11:59.147 client.js:2887 Got TURN URIs: turn:turn.matrix.org:3478?transport=udp,turn:turn.matrix.org:3478?transport=tcp,turns:turn-ssl.matrix.org:443?transport=tcp refresh in 86400 secs
2017-01-24 17:11:59.211 Presence.js:83 Presence: online
2017-01-24 17:11:59.241 sync.js:51 Got push rules
2017-01-24 17:13:30.600 index.js:218 GET https://matrix.org/_matrix/client/r0/sync?filter=105&timeout=30000&_cacheBu… 504 (Gateway Time-out)

2017-01-24 17:13:30.600 index.js:218 GET https://matrix.org/_matrix/client/r0/sync?filter=105&timeout=30000&_cacheBu… 504 (Gateway Time-out)

2017-01-24 17:13:30.600 :8080/#/:1 XMLHttpRequest cannot load https://matrix.org/_matrix/client/r0/sync?filter=105&timeout=30000&_cacheBu…. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8080' is therefore not allowed access. The response had HTTP status code 504.
2017-01-24 17:13:31.665 sync.js:552 /sync error Error: CORS request rejected: https://matrix.org/_matrix/client/r0/sync?filter=105&timeout=30000&_cacheBu…
    at on_response (http://localhost:8080/bundles/1e05f58f88509faeaf12/bundle.js:67266:23)
    at XMLHttpRequest.on_state_change (http://localhost:8080/bundles/1e05f58f88509faeaf12/bundle.js:67249:8)

2017-01-24 17:13:31.667 sync.js:553 Error: CORS request rejected: https://matrix.org/_matrix/client/r0/sync?filter=105&timeout=30000&_cacheBu…
    at on_response (index.js:259)
    at XMLHttpRequest.on_state_change (index.js:242)

2017-01-24 17:13:31.668 sync.js:51 Starting keep-alive
2017-01-24 17:13:31.675 MatrixChat.js:679 MatrixClient sync state => RECONNECTING
2017-01-24 17:15:13.820 index.js:218 GET https://matrix.org/_matrix/client/r0/sync?filter=105&timeout=0&_cacheBuster… 504 (Gateway Time-out)

2017-01-24 17:15:13.820 index.js:218 GET https://matrix.org/_matrix/client/r0/sync?filter=105&timeout=0&_cacheBuster… 504 (Gateway Time-out)

2017-01-24 17:15:13.820 :8080/#/:1 XMLHttpRequest cannot load https://matrix.org/_matrix/client/r0/sync?filter=105&timeout=0&_cacheBuster…. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8080' is therefore not allowed access. The response had HTTP status code 504.
2017-01-24 17:15:13.822 sync.js:552 /sync error Error: CORS request rejected: https://matrix.org/_matrix/client/r0/sync?filter=105&timeout=0&_cacheBuster…
    at on_response (http://localhost:8080/bundles/1e05f58f88509faeaf12/bundle.js:67266:23)
    at XMLHttpRequest.on_state_change (http://localhost:8080/bundles/1e05f58f88509faeaf12/bundle.js:67249:8)

2017-01-24 17:15:13.823 sync.js:553 Error: CORS request rejected: https://matrix.org/_matrix/client/r0/sync?filter=105&timeout=0&_cacheBuster…
    at on_response (index.js:259)
    at XMLHttpRequest.on_state_change (index.js:242)

2017-01-24 17:15:13.824 sync.js:51 Starting keep-alive
2017-01-24 17:15:13.830 MatrixChat.js:679 MatrixClient sync state => RECONNECTING
2017-01-24 17:16:49.180 index.js:218 GET https://matrix.org/_matrix/client/r0/sync?filter=105&timeout=0&_cacheBuster… 504 (Gateway Time-out)

2017-01-24 17:16:49.180 index.js:218 GET https://matrix.org/_matrix/client/r0/sync?filter=105&timeout=0&_cacheBuster… 504 (Gateway Time-out)

2017-01-24 17:16:49.181 :8080/#/:1 XMLHttpRequest cannot load https://matrix.org/_matrix/client/r0/sync?filter=105&timeout=0&_cacheBuster…. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8080' is therefore not allowed access. The response had HTTP status code 504.
2017-01-24 17:16:49.497 sync.js:552 /sync error Error: CORS request rejected: https://matrix.org/_matrix/client/r0/sync?filter=105&timeout=0&_cacheBuster…
    at on_response (http://localhost:8080/bundles/1e05f58f88509faeaf12/bundle.js:67266:23)
    at XMLHttpRequest.on_state_change (http://localhost:8080/bundles/1e05f58f88509faeaf12/bundle.js:67249:8)

2017-01-24 17:16:49.498 sync.js:553 Error: CORS request rejected: https://matrix.org/_matrix/client/r0/sync?filter=105&timeout=0&_cacheBuster…
    at on_response (index.js:259)
    at XMLHttpRequest.on_state_change (index.js:242)

2017-01-24 17:16:49.500 sync.js:51 Starting keep-alive
2017-01-24 17:16:49.506 MatrixChat.js:679 MatrixClient sync state => RECONNECTING
2017-01-24 17:16:58.477 Presence.js:83 Presence: unavailable
2017-01-24 17:17:53.691 Presence.js:83 Presence: online
2017-01-24 17:18:27.559 index.js:218 GET https://matrix.org/_matrix/client/r0/sync?filter=105&timeout=0&_cacheBuster… 

2017-01-24 17:18:27.559 index.js:218 GET https://matrix.org/_matrix/client/r0/sync?filter=105&timeout=0&_cacheBuster… 

2017-01-24 17:18:27.559 :8080/#/:1 XMLHttpRequest cannot load https://matrix.org/_matrix/client/r0/sync?filter=105&timeout=0&_cacheBuster…. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8080' is therefore not allowed access. The response had HTTP status code 504.
2017-01-24 17:18:27.560 sync.js:552 /sync error Error: CORS request rejected: https://matrix.org/_matrix/client/r0/sync?filter=105&timeout=0&_cacheBuster…
    at on_response (http://localhost:8080/bundles/1e05f58f88509faeaf12/bundle.js:67266:23)
    at XMLHttpRequest.on_state_change (http://localhost:8080/bundles/1e05f58f88509faeaf12/bundle.js:67249:8)

2017-01-24 17:18:27.561 sync.js:553 Error: CORS request rejected: https://matrix.org/_matrix/client/r0/sync?filter=105&timeout=0&_cacheBuster…
    at on_response (index.js:259)
    at XMLHttpRequest.on_state_change (index.js:242)

2017-01-24 17:18:27.563 sync.js:51 Starting keep-alive
2017-01-24 17:18:27.567 MatrixChat.js:679 MatrixClient sync state => RECONNECTING
2017-01-24 17:20:02.536 index.js:218 GET https://matrix.org/_matrix/client/r0/sync?filter=105&timeout=0&_cacheBuster… 504 (Gateway Time-out)


2017-01-24 17:20:02.536 index.js:218 GET https://matrix.org/_matrix/client/r0/sync?filter=105&timeout=0&_cacheBuster… 504 (Gateway Time-out)

2017-01-24 17:20:02.536 :8080/#/:1 XMLHttpRequest cannot load https://matrix.org/_matrix/client/r0/sync?filter=105&timeout=0&_cacheBuster…. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8080' is therefore not allowed access. The response had HTTP status code 504.
2017-01-24 17:20:03.891 sync.js:552 /sync error Error: CORS request rejected: https://matrix.org/_matrix/client/r0/sync?filter=105&timeout=0&_cacheBuster…
    at on_response (http://localhost:8080/bundles/1e05f58f88509faeaf12/bundle.js:67266:23)
    at XMLHttpRequest.on_state_change (http://localhost:8080/bundles/1e05f58f88509faeaf12/bundle.js:67249:8)

2017-01-24 17:20:03.893 sync.js:553 Error: CORS request rejected: https://matrix.org/_matrix/client/r0/sync?filter=105&timeout=0&_cacheBuster…
    at on_response (index.js:259)
    at XMLHttpRequest.on_state_change (index.js:242)

2017-01-24 17:20:03.894 sync.js:51 Starting keep-alive
2017-01-24 17:20:03.900 MatrixChat.js:679 MatrixClient sync state => RECONNECTING
2017-01-24 17:21:41.555 index.js:218 GET https://matrix.org/_matrix/client/r0/sync?filter=105&timeout=0&_cacheBuster… 504 (Gateway Time-out)

2017-01-24 17:21:41.555 index.js:218 GET https://matrix.org/_matrix/client/r0/sync?filter=105&timeout=0&_cacheBuster… 504 (Gateway Time-out)

2017-01-24 17:21:41.555 :8080/#/:1 XMLHttpRequest cannot load https://matrix.org/_matrix/client/r0/sync?filter=105&timeout=0&_cacheBuster…. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8080' is therefore not allowed access. The response had HTTP status code 504.
2017-01-24 17:21:41.557 sync.js:552 /sync error Error: CORS request rejected: https://matrix.org/_matrix/client/r0/sync?filter=105&timeout=0&_cacheBuster…
    at on_response (http://localhost:8080/bundles/1e05f58f88509faeaf12/bundle.js:67266:23)
    at XMLHttpRequest.on_state_change (http://localhost:8080/bundles/1e05f58f88509faeaf12/bundle.js:67249:8)

2017-01-24 17:21:41.559 sync.js:553 Error: CORS request rejected: https://matrix.org/_matrix/client/r0/sync?filter=105&timeout=0&_cacheBuster…
    at on_response (index.js:259)
    at XMLHttpRequest.on_state_change (index.js:242)

2017-01-24 17:21:41.560 sync.js:51 Starting keep-alive
2017-01-24 17:21:41.567 MatrixChat.js:679 MatrixClient sync state => RECONNECTING
2017-01-24 17:21:58.632 index.js:218 GET http://localhost:8080/version?cachebuster=1485274918628 404 (Not Found)

2017-01-24 17:21:58.634 WebPlatform.js:180 Failed to poll for update Object {status: 404}

2017-01-24 17:23:18.567 index.js:218 GET https://matrix.org/_matrix/client/r0/sync?filter=105&timeout=0&_cacheBuster… 

2017-01-24 17:23:18.567 index.js:218 GET https://matrix.org/_matrix/client/r0/sync?filter=105&timeout=0&_cacheBuster… 

2017-01-24 17:23:18.567 :8080/#/:1 XMLHttpRequest cannot load https://matrix.org/_matrix/client/r0/sync?filter=105&timeout=0&_cacheBuster…. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8080' is therefore not allowed access. The response had HTTP status code 504.
2017-01-24 17:23:18.569 sync.js:552 /sync error Error: CORS request rejected: https://matrix.org/_matrix/client/r0/sync?filter=105&timeout=0&_cacheBuster…
    at on_response (http://localhost:8080/bundles/1e05f58f88509faeaf12/bundle.js:67266:23)
    at XMLHttpRequest.on_state_change (http://localhost:8080/bundles/1e05f58f88509faeaf12/bundle.js:67249:8)

2017-01-24 17:23:18.570 sync.js:553 Error: CORS request rejected: https://matrix.org/_matrix/client/r0/sync?filter=105&timeout=0&_cacheBuster…
    at on_response (index.js:259)
    at XMLHttpRequest.on_state_change (index.js:242)

2017-01-24 17:23:18.572 sync.js:51 Starting keep-alive
2017-01-24 17:23:18.577 MatrixChat.js:679 MatrixClient sync state => RECONNECTING
2017-01-24 17:24:53.770 olm.js:311 created new inbound Olm session ID TAEQIF9e9MCjcr99wLqVV8+rkUXmOYhUSxKJbCtq9cs with ZqaQnGISuenc8lpO4dhdBuq+F1LkeJ0cMzNeNgelLXU
...and in.

@ara4n
Copy link
Member Author

ara4n commented Mar 2, 2017

this is still the case for actual initial sync, but the indexeddb stuff helps enormously.

meanwhile, we should just increase timeout as suggested by @richvdh assuming that's what the underlying problem is here.

Finally, #2914 is your home for all your paginated sync desires.

@ara4n ara4n added P2 and removed P1 labels Mar 2, 2017
@ara4n
Copy link
Member Author

ara4n commented Mar 2, 2017

...actually, fixing the timeout is easy and probably still p1

@ara4n ara4n added P1 and removed P2 labels Mar 2, 2017
@lukebarnard1
Copy link
Contributor

lukebarnard1 commented Mar 2, 2017

lukebarnard1 pushed a commit to matrix-org/matrix-js-sdk that referenced this issue Mar 15, 2017
Instead of just using a timeout to reject ongoing requests, reset the timeout when progress is observed (at least when requests are done from browsers).

This is to fix element-hq/element-web#2737
richvdh pushed a commit to matrix-org/matrix-js-sdk that referenced this issue Mar 16, 2017
Instead of just using a timeout to reject ongoing requests, reset the timeout when progress is observed (at least when requests are done from browsers).

This is to fix element-hq/element-web#2737
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P1 S-Major Severely degrades major functionality or product features, with no satisfactory workaround T-Defect
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants