-
Notifications
You must be signed in to change notification settings - Fork 24
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
Avoid double info request for compound annotations #4619
Conversation
@fm3 As we discussed I tried to make the error handling while loading the tracing better by displaying unhandled error messages better to the user: I'll push the changes for this to this branch |
* better displaying the error to the user
I don't really understand where these two info requests come from. I guess, one of them is I also don't understand why returning Sorry, I'm a bit lost here 🙈 I understand the bug from the description in your PR, but I don't understand how this matches to the code diff. |
Ok I guess the real question is: why is this auth callback code executed even if the user is logged in. My guess is that it should handle logged-out users. |
Apparently, the serverAuthenticationCallback is always executed for the routes that have it. The reply is then ORed with the normal isAuthenticated. So this PR should work correctly. @daniel-wer @MichaelBuessemeyer do you think we should change the design in SecuredRoute completely so that the serverAuthenticationCallback is only called if isAuthenticated is false? Or do you think this solution is ok? |
@fm3 Thanks for looking and digging into this! I would say the more general and cleaner solution would be to only call the serverAuthenticationCallback if isAuthenticated is false. This should lead to fewer unnecessary requests, avoids the race condition in question and doesn't rely on assumptions of routes that are always non-public. It should be enough to change line 32 in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, works like a charm and I can only see one info request 👍
Compound Annotations are created lazily, and then cached.
The frontend checks the permissions for logged-out users for an annotation in parallel with loading it. That’s why two info requests are sent.
If the second info request fires before the first one has completed, the compound annotation is created twice, and only one of the two will be in the (key-value) cache. That is the race condition.
They will have different skeleton tracing IDs.
If the frontend then assumes the wrong skeleton ID, the reverse lookup for permission check fails.
This PR changes the frontend to only check for logged-out users if the user is logged out, avoiding this double info request.
URL of deployed dev instance (used for testing):
Steps to test:
Issues: