QutEcoacoustics / workbench-client

workbench-client: a client side browser application for interacting with acoustic workbenches
Other
8 stars 1 forks source link

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

Open hudson-newey opened 5 months ago

hudson-newey commented 5 months ago

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:

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