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

Do not use Client.oneShotSync in SSSS and bootstrap #2028

Open
1 of 2 tasks
TheOneWithTheBraid opened this issue Feb 11, 2025 · 2 comments · May be fixed by #2032
Open
1 of 2 tasks

Do not use Client.oneShotSync in SSSS and bootstrap #2028

TheOneWithTheBraid opened this issue Feb 11, 2025 · 2 comments · May be fixed by #2032
Assignees
Labels
bug Something isn't working

Comments

@TheOneWithTheBraid
Copy link
Contributor

Checklist

  • I could not find a solution in the documentation, the existing issues or discussions.
  • I already asked for help in the chat

In which Project did the bug appear?

Other

If you selected "Other" as Project, please enter in which project the bug occurred.

matrix-dart-sdk

On which platform did the bug appear?

Firefox

SDK Version

v0.38.0

Describe the problem caused by this bug

SSSS.createKey, OpenSSSS.store, Bootstrap.askSetupCrossSigning and Bootstrap.newSsss make use of Client.oneShotSync. This is a huge slow down of SSSS handling since the homeserver might simply delay the /sync request up to the local timeout if there was nothing to sync. I'd propose to rather explicitly match on whether the keys are uploaded and locally processed than waiting for a sync.

Steps To Reproduce

  1. Create an empty account
  2. Run SSSS boostrap
  3. Wait for a loooooooong time

Screenshots or Logs

No response

Security related

Just do not in-carefully change this.

@TheOneWithTheBraid TheOneWithTheBraid added the bug Something isn't working label Feb 11, 2025
@krille-chan
Copy link
Contributor

Hey thank you for the feedback. I took a look into the code and don't yet see where this delays something. On the one hand it looks very similar to await client.onSync.stream.where(//Filter here for desired account data key and actually it was like this before but has been changed (don't know the reason maybe filtering in sync had problems with type escaping?)

However the current approach is just to wait until the next sync is finished and then check again what we have in memory and repeat this. While this is only waiting for the next sync if account data is not updated. This does not delay anything as we have to wait for the sync anyway to continue. I don't see where this would be faster than filtering the sync stream

@TheOneWithTheBraid
Copy link
Contributor Author

Yeah, I get what you mean. I don't have an easy proposal on how to better handle this. But fact is, on a completely new account, this causes SSSS bootstrap to take 5 - 10 minutes since each and every account data change first runs into a network timeout of 40 seconds (default SDK behavior) since there is nothing to sync. One approach might be to add fake syncs to the stream similar to sending an event in a room in order to have the updated account data available immediately after it was uploaded.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants