microsoft / microsoft/azure-devops-python-api
This SDK isn't thread-safe (or even multi-process safe) because of OPTIONS cache
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 684
- Forks
- 218
- Avg merge
- 8d 10h
- Merged PRs (30d)
- 1
Description
This SDK is crashing some of my build agents occasionally with this error:
[Errno 13] Permission denied: '/Users/USER_NAME/.azure-devops/python-sdk/cache/options.json'
Based on reading the code, it appears to be coming from here:
https://github.com/microsoft/azure-devops-python-api/blob/dev/azure-devops/azure/devops/_file_cache.py
This code doesn't appear to be at all thread, or even process, safe, as it just asserts handles to the file.
If it can't be made thread/process safe, some option to just not use the cache at all, and just fetch it directly when needed for the connection would work. As is now, I've had to implement a machine level mutex and lock all my calls to this API behind it, which is horribly inefficient, but I can't have my builds crashing with random IO errors.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with azure-devops/azure/devops/_file_cache.py and trace how options.json is opened and updated during SDK connections. Reproduce the concurrent access failure if possible, then determine whether the cache can be made safe for threads and processes or bypassed when disabled. Done means concurrent build-agent use no longer produces the reported permission error, with the chosen behavior documented.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100