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

fix(federation): re-add RequestSharedSecret job if necessary #44848

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

blizzz
Copy link
Member

@blizzz blizzz commented Apr 16, 2024

fighting another race condition with federated server setup

Summary

@Fenn-CS and I saw another race condition when trying to set up trusted servers. Even when running cron-jobs hand-pickedly, we could end up in state where the requestSharedSecret endpoint is called, claims to We will initiate the exchange of the shared secret, but does not have the appropriate Job in its list anymore.

The change queries the joblist to see whether this one is actually scheduled, and adds it back if it is not the case.

Checklist

fighting another race condition with federated server setup

Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
@blizzz blizzz requested review from nickvergessen, Fenn-CS, a team, ArtificialOwl and yemkareems and removed request for a team April 16, 2024 11:18
Copy link
Contributor

@Fenn-CS Fenn-CS left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested and it works, code looks good.


$hasJob = false;
foreach ($this->jobList->getJobsIterator(RequestSharedSecret::class, 1, 0) as $job) {
$hasJob = true;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but this could be for another URL?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, good point. Shall compare that argument then.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And then either loop over all or get chunks until you found it

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. I would have looked for the hasJob, but the timestamp ruins it.

@blizzz blizzz added 2. developing Work in progress and removed 3. to review Waiting for reviews labels Apr 16, 2024
@blizzz blizzz self-assigned this Apr 16, 2024
@susnux susnux added this to the Nextcloud 30 milestone Apr 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants