Add timeout to WSL credential lookups#4
Merged
CodeZeno merged 1 commit intoCodeZeno:mainfrom Mar 20, 2026
Merged
Conversation
wsl.exe -l -q can hang indefinitely on some systems (e.g. WSL installed but not fully configured), which blocks the poll thread forever and prevents any usage data from loading. Adds a run_with_timeout helper (5s deadline) and uses it for both list_wsl_distros and read_wsl_credentials. The refresh paths already had timeouts — these two were missed.
Owner
|
Thank you @jacobdwyer16 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
On systems where WSL is installed but not fully working,
wsl.exe -l -qcan hang indefinitely. This blocks the poll thread during credential gathering so usage data never loads — the widget just shows--forever.The WSL token refresh paths already had a 30s timeout via
wait_for_refresh, butlist_wsl_distrosandread_wsl_credentialswere using.output()with no deadline.This adds a small
run_with_timeouthelper that pollstry_waitand kills the process after 5 seconds, then uses it for both WSL calls. The rest of the poll logic already handles theNone/empty case gracefully.Ran into this on a Windows 11 machine where
wsl.exe -l -qhangs for 10+ minutes.