Repository navigation
Fix crash when searching in the Python Packages dialog - #1795
Open
deepratna-awale wants to merge 1 commit into
Open
deepratna-awale wants to merge 1 commit into
deepratna-awale wants to merge 1 commit into
Conversation
Selecting a package loads its details (pip show / pip index) in a fire-and-forget task with no exception handler, so any failure other than a ProcessException was rethrown on the UI thread and took down the app. Typing in the search box moves the selection on almost every keystroke, starting one of these loads per keystroke, overlapping against the same venv. - Log failures of the details load instead of rethrowing them - Load one package's details at a time and skip loads whose package is no longer selected - Don't start a second load for an item that is already loading - PipIndexResult.Parse returns no versions instead of throwing when the output has no "Available versions:" line - PipShowResult.Parse no longer throws when "License:" has no following "Location:" line Fixes LykosAI#693
This branch has not been deployed
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.
Fixes #693
Problem
Searching in Packages → ⋯ → Python Packages can crash Stability Matrix (e.g. typing "ja" to find
jax). Pasting the full name works around it.Selecting a package loads its details (
pip show/pip index versions) viaLoadExtraInfo(...).SafeFireAndForget()with no exception handler. With no handler, AsyncAwaitBestPractices lets the exception escape, so anything other than aProcessException(e.g.FileNotFoundExceptionfrom the uv/pip/pyvenv.cfg checks in the venv runner,InvalidOperationExceptionfromPipIndexResult.Parse,ArgumentOutOfRangeExceptionfromPipShowResult.Parse) is rethrown on the UI thread and ends the app.The list box uses
SelectionMode="AlwaysSelected", so as the search filter narrows the list the selection jumps to a new package on almost every keystroke. Each jump started another details load, and those loads overlapped against the same venv, each one rewritingpyvenv.cfgand spawning its own pip processes. Pasting the name changes the selection once, which is why the workaround helps.Changes
PythonPackagesViewModelSemaphoreSlim). A load still waiting for its turn is dropped when the selection moves on, and a load whose package is no longer selected is skipped.PythonPackagesItemViewModel.LoadExtraInfotakes a venv runner factory instead of a path plusPyBaseInstall, and skips if it is already loading.PipIndexResult.Parsereturns no versions instead of throwing when the output has noAvailable versions:line.PipShowResult.Parseno longer throws when aLicense:line has noLocation:line after it.Testing
PythonPackagesDialogTests) open the real dialog over a substituted venv runner and type into the search box:TypingInSearch_WhenPackageDetailsFailToLoad_DoesNotCrash:pip showthrowsFileNotFoundException. On the old code the exception is rethrown on the dispatcher and fails the test. It passes with the fix.TypingInSearch_LoadsOnePackagesDetailsAtATime: on the old code more than one detail load ran at once. With the fix, at most one runs at a time.PipIndexResultTestsand two extraPipShowResultsTestscases (license without location, location before license).StabilityMatrix.UITests: 21/21 passed.StabilityMatrix.Tests: all passed except theTestLicenseUrl/TestPreviewImageUrichecks, which need outbound network access that my test environment blocks (unrelated to this change).