Commit c3c6e59
committed
Release context.lock before the protected request is sent
async_auth_flow held context.lock across `response = yield request`, so the
lock covered the whole round trip of the protected request instead of just
token acquisition. The standalone GET SSE stream goes through the same
provider, so it pinned the lock for the lifetime of the stream and the next
request, usually the first tools/call, blocked in lock.acquire() until that
stream ended.
Close the lock before the request is yielded and re-open it around the 401
and 403 re-authorization blocks. Refresh and re-authorization stay
serialized; no protected request is sent under the lock.
The new test drives two auth flows from two anyio tasks, holds the GET flow
at its yield, and requires the POST flow to reach its own yield inside
anyio.fail_after(5).1 parent a4f4ccd commit c3c6e59
2 files changed
Lines changed: 54 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
598 | 598 | | |
599 | 599 | | |
600 | 600 | | |
601 | | - | |
| 601 | + | |
| 602 | + | |
| 603 | + | |
| 604 | + | |
602 | 605 | | |
603 | | - | |
| 606 | + | |
| 607 | + | |
604 | 608 | | |
605 | 609 | | |
606 | 610 | | |
| |||
751 | 755 | | |
752 | 756 | | |
753 | 757 | | |
754 | | - | |
755 | | - | |
| 758 | + | |
| 759 | + | |
| 760 | + | |
| 761 | + | |
756 | 762 | | |
757 | 763 | | |
758 | 764 | | |
| |||
782 | 788 | | |
783 | 789 | | |
784 | 790 | | |
785 | | - | |
| 791 | + | |
| 792 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
9 | 10 | | |
10 | 11 | | |
11 | 12 | | |
| |||
3253 | 3254 | | |
3254 | 3255 | | |
3255 | 3256 | | |
| 3257 | + | |
| 3258 | + | |
| 3259 | + | |
| 3260 | + | |
| 3261 | + | |
| 3262 | + | |
| 3263 | + | |
| 3264 | + | |
| 3265 | + | |
| 3266 | + | |
| 3267 | + | |
| 3268 | + | |
| 3269 | + | |
| 3270 | + | |
| 3271 | + | |
| 3272 | + | |
| 3273 | + | |
| 3274 | + | |
| 3275 | + | |
| 3276 | + | |
| 3277 | + | |
| 3278 | + | |
| 3279 | + | |
| 3280 | + | |
| 3281 | + | |
| 3282 | + | |
| 3283 | + | |
| 3284 | + | |
| 3285 | + | |
| 3286 | + | |
| 3287 | + | |
| 3288 | + | |
| 3289 | + | |
| 3290 | + | |
| 3291 | + | |
| 3292 | + | |
| 3293 | + | |
| 3294 | + | |
| 3295 | + | |
| 3296 | + | |
| 3297 | + | |
0 commit comments