这是indexloc提供的服务,不要输入任何密码
Skip to content

fix(renewTokens): prevent infinite loop on renew token flow #1581

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

mtfrigo
Copy link

@mtfrigo mtfrigo commented Jul 24, 2025

Users who leave the application running in the background and subsequently lose VPN connectivity are generating excessive "Failed to fetch" errors in our observability logs. This issue arises because the application does not transition to the "Session Lost" state as expected, due to a flaw in the synchroniseTokensAsync function. Properly handling this scenario by moving affected sessions to the "Session Lost" state would mitigate unnecessary error logging.

A picture tells a thousand words

Before this PR

The synchroniseTokensAsync function in renewTokens.ts could enter an infinite loop when an error occurred during token renewal, as recursive calls to itself were made without a proper break incrementing the "index" variable when the window document is hidden.

After this PR

The implementation now prevents infinite recursion in synchroniseTokensAsync by breaking the call chain. This ensures that errors during token renewal do not cause stack overflow, improving reliability and browser stability.

@mtfrigo mtfrigo changed the title fix: prevent infinite loop on renew token flow fix(renewTokens): prevent infinite loop on renew token flow Jul 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant