| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
|
Thanks for the contribution! Before we can merge this, we need @dxdc to sign the Salesforce Inc. Contributor License Agreement. |
Sorry, something went wrong.
|
signed the cla |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Motivation
Audit result from #1148: all HTTP traffic flows through a single requests.Session stored on Server, and requests.Session is not guaranteed to be thread-safe (psf/requests#2766 - connection pool and cookie state can be corrupted under concurrent use). Auth state (_auth_token, _site_id, _user_id, _site_url) is also written field-by-field with no lock, so a concurrent reader could observe a token paired with the wrong site during switch_site or re-sign-in.
The practical consequence was that the common pattern of sharing one Server across a ThreadPoolExecutor (e.g. bulk workbook downloads) was unsafe, and the workaround was one fully signed-in Server per thread.
Behavior change
No public API changes. All endpoint code already routed through the session property, so the change is confined to server.py. The one private-surface change is that Server._session no longer exists as an attribute.
New test/test_thread_safety.py:
Verified the first two tests fail against the current development branch.