You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug] The built-in retry never retries the token POST: HTTPAdapter(max_retries=1) keeps urllib3's default allowed_methods #957
msal/application.py lines 716-718 mount HTTPAdapter(max_retries=1) as "a minimal retry, better than nothing". For the token endpoint it is nothing: urllib3's Retry(1) keeps the default allowed_methods, which excludes POST, so a connection reset during the token request escapes after one attempt as requests.exceptions.ConnectionError.
Same on 1.37.0. I know #432 settled on retries being an http-layer concern and a custom http_client being the answer, and that is what we run. This is narrower: the adapter MSAL itself mounts does not do what its comment says. HTTPAdapter(max_retries=Retry(total=1, connect=1, allowed_methods=None, backoff_factor=0.3)) keeps the same one-retry budget and makes it real for the POST. Can send the PR.
Max Azatian (@HardMax71) Thank you for reporting the bug and for raising the PR. I’ll analyze the issue and review the changes, then get back to you with my feedback and findings.
Updated the repro gist: its fake server closed the socket before reading the whole POST, so the retried request could be reset too, and #958 failed about one run in four for that reason. With the request read in full, #958 passes 30 of 30 and dev still fails every run.
Activity
4gust commentedon Sep 4, 2026
Max Azatian (@HardMax71) Thank you for reporting the bug and for raising the PR. I’ll analyze the issue and review the changes, then get back to you with my feedback and findings.
HardMax71 commentedon Sep 23, 2026
Hi Nilesh Choudhary (@4gust), just following up to see if there are any updates on this. Thanks!
HardMax71 commentedon Oct 3, 2026
Updated the repro gist: its fake server closed the socket before reading the whole POST, so the retried request could be reset too, and #958 failed about one run in four for that reason. With the request read in full, #958 passes 30 of 30 and dev still fails every run.