guardian / gudocs

2 stars 1 forks source link

Revert "Fix bug in retry code" #68

Closed davidfurey closed 5 months ago

davidfurey commented 5 months ago

Reverts guardian/gudocs#67

guardian/gudocs#67 attempts to address a legitimate problem (retries due to token expiry always fail because function req is not defined at the point it is called).

Unfortunately it introduces a much more serious bug. rlimiter only allows one in-flight request at a time, and can be thought of as a mutex. When a retry is attempt, the original request still holds the mutex. So the retry request will wait on the mutex, but the original request will never release the mutex because it is waiting on the retry request. This creates a deadlock.

Since rlimiter is shared, once a n auth token expiry happens, all subsequent attempt to publish will sit waiting on the lock, and therefore never happen. The only way to resolve this is to restart the service.