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

/sync stops working when the tab becomes inactive #7620

Closed
turt2live opened this issue Oct 28, 2018 · 2 comments
Closed

/sync stops working when the tab becomes inactive #7620

turt2live opened this issue Oct 28, 2018 · 2 comments
Assignees

Comments

@turt2live
Copy link
Member

turt2live commented Oct 28, 2018

The system is not constrained for resources, and Chrome looks happy. Might have something to do with switching to browserified request

@turt2live turt2live self-assigned this Oct 29, 2018
@turt2live
Copy link
Member Author

information dump time:

This is a regression introduced by matrix-org/matrix-js-sdk#764. Something in request uses an API that Chrome suspends alongside the tab, which causes requests to freeze. Bringing the tab back into the foreground fixes the issue by making a large sync.

This particular bug is only noticeable on larger accounts due to resource consumption (probably). Chrome, and other browsers, will forcefully pause some APIs (like timers) when the tab is not in the foreground. This is usually only invoked when the process is using a lot of resources or the system is otherwise strained for resources. In my case, the system is not strained for resources however my account appears to be just past the tipping point for Chrome to pause things. This is why smaller accounts probably won't see the problem at all.

Switching request back to browser-request does resolve the issue, however that would break joining rooms with multiple server names (now a feature of the js-sdk). The API that is being paused is probably being used by the http shim (https://github.com/jhiesey/stream-http) or by request itself. Both APIs are relatively small, so it may be feasible to continue trying to walk through and find the problem.

Neither repository appears to have an issue already open for this. Then again, we might be the first to have a high resource usage app which also uses request browserified.

There's a few ways forward on this issue:

  1. Identify and fix whatever API is being paused.
  2. Switch to browser-request for the majority of APIs, using request for joining rooms.
  3. Make Riot not use so much memory

Option 1 is probably the best option given 2 is just a hack and 3 is wildly out of scope.

turt2live added a commit to matrix-org/matrix-js-sdk that referenced this issue Oct 30, 2018
Because `request` just doesn't work for us in the browser, but `browser-request` is fine despite us having to do our own query strings.

Fixes element-hq/element-web#7620
@turt2live
Copy link
Member Author

Fixed by matrix-org/matrix-js-sdk#770. Future maintenance recorded at #7634.

krombel pushed a commit to krombel/matrix-js-sdk that referenced this issue Nov 6, 2018
Because `request` just doesn't work for us in the browser, but `browser-request` is fine despite us having to do our own query strings.

Fixes element-hq/element-web#7620
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

1 participant