AzureAD/microsoft-authentication-extensions-for-python

Non re-entrant lock blocking extension use with msal>0.4.0

marstr opened this issue · 1 comments

Repro:

  1. Clone this repository on MacOS or Windows
  2. Create new virtual environment
  3. Run pip install, ensure pip list | grep msal (or similar command outside of bash) is greater or equal to 0.4.1.
  4. Run pytest

Expected:

  • Tests will pass

Actual:

  • Tests hang indefinitely.

What happened is that in 8a7495a006eafd75179c0975b7fc52fddf733ca5 the add function got refactored to call self.modify. In doing so, because of the inheritance involved, it is calling our FileTokenCache's implementation of these functions and causing us to try to take a second lock on a file we're already locked on. This is causing an indefinite hang.

Amusingly, this is the exact problem talked about here: https://www.youtube.com/watch?v=YXiaWtc0cgE

I think this issue is an indicator that we should probably setup a nightly CI run for this repository. Would have helped detect this error earlier. A step further, would be running the extension's tests as part of CI in the upstream repository.