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

Race condition for authentication reponse causes double requests and "partial states" #2127

Open
hudson-newey opened this issue Mar 19, 2024 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@hudson-newey
Copy link
Member

hudson-newey commented Mar 19, 2024

Sometimes we send out the same request multiple times with only the Authentication header changed and sometimes the original request gets aborted with NS_BINDING_ABORTED.

The best way to recreate this and clearly see the impact is to:

  1. Go to a site with no audio (eg. ecosounds.org/projects/1080/sites/1657) (I've chosen this site since you can access it without an account)
  2. Make sure you are logged in
  3. Open development tools (Network tab)
  4. Reload the page using F5 (or ctrl + R)
  5. In the dev tools search box, search for all requests going to the /filter route
  6. Observe that ~50% of the time, the requests are doubled (and sometimes half of the requests are aborted)
    a. Throttling the network speeds to 4G seems to increase the likelihood of emitting two requests

To verify that this only happens when logged in, log out and observe that you will no longer see double requests.

Additionally, you can observe this on all pages, but the requests can get a bit cluttered with a lot of requests (hence why I recommend reproducing it in a site with no audio).


The only difference between the two requests is the Authentication header, I suspect that this has something to do with our interceptor service adding authentication information.

Something similar to:

  • Send a request to fetch a resource (/filter)
  • Interceptor service sees that we are not logged in and doesn't attach Authentication header
  • Send a separate completely unrelated request to the API to authenticate the user and get an auth token
  • Request for auth token is processed before /filter request completes
  • Interceptor sees that we now have auth token and issues the same request (aborting the old request if possible)

I suspect that it is also possible for the original /filter request (from the example above) to complete and start populating the page (leading to "partial states").


This might also be the root cause of a lot of our bugs such as:

#2084
#2050
#2047

@hudson-newey hudson-newey added the bug Something isn't working label Mar 19, 2024
@hudson-newey hudson-newey self-assigned this Mar 19, 2024
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

No branches or pull requests

1 participant