Files
cloudflared/token
James Royal d6b4ff083b AUTH-8883 Fix Access token lock self-deadlock during same-process reauth
cloudflared access tcp can fetch an Access token, receive a later Access 302 during WebSocket setup, remove the app token, and immediately fetch again in the same process. The token lock files were intentionally left on disk for stale-PID recovery, but that meant the second fetch saw the first fetch’s lock, recognized its own PID as alive, and waited until lock timeout.

This change restores normal lock release without losing crash recovery. Lock acquisition now returns an ownership handle with a per-acquisition ID, and getToken() releases both app and org token locks on return. Release only removes the lock if PID, process start time, and acquisition agree.

I tested this by manually building and running through a few scenarios on my local machine. So far I haven't seen any lockfiles get left behind and the normal CLI flows are working as expected. 

Closes AUTH-8883
2026-09-02 18:04:04 +00:00
..