GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||||||||
GeezerVison is showing github.com — Save the module analysis cache when the process exits by azchohfi · Pull Request #28376 · PowerShell/PowerShell ConversationPR SummaryFixes #28375. The module analysis cache is written by a background task that waits at least 13 seconds after the last change, so a pwsh that runs one command and exits sooner ( When PR ContextMeasured on Windows 11 26100 (i9-10900K), Release builds of master 1aac7f5 with and without this change (the two differ only in System.Management.Automation.dll), default cache location, 40 interleaved runs, median of paired differences with 95% confidence interval:
The first run writes the cache (4 KB here); later runs did not rewrite it. Tests: added I used GitHub Copilot to investigate this and to help write the change and test; I reviewed the code and ran the tests above myself. PR Checklist
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactionsThe analysis cache is written by a background task that waits at least 13 seconds after the last change. A pwsh process that runs one command and exits sooner, such as pwsh -Command or -File, never saves it, so every such process analyzes the same modules again when a command is auto-loaded. If a save is still pending when the process exits, write the cache from a ProcessExit handler. A lock keeps the exit handler and the delayed write from running at the same time. Co-authored-by: Copilot App <[email protected]>
Alexandre Zollinger Chohfi (azchohfi)
requested a review
from a team
as a code owner
All reactions
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🟡 Changes recommendedTemporary cache snapshots register ProcessExit handlers that retain their entire Entries dictionaries until shutdown, allowing repeated merges to accumulate memory in long-running hosts. 1 open issueWhat changed in this PRAddresses #28375 by saving pending module analysis cache updates when PowerShell exits, avoiding repeated module analysis in short-lived processes. Changes:
Review effort: Balanced
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactionsUh oh!
There was an error while loading. Please reload this page. Serialize reads another process's cache into a temporary AnalysisCacheData to merge it, and that instance can queue a save from its delayed Cleanup. The ProcessExit handler captured the instance, so each such temporary instance stayed alive until the process exited. Register one static handler that only saves the process-wide cache. Co-authored-by: Copilot App <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Reviewers
Copilot code review
Copilot
Copilot review effort
Applies to this pull request for everyone.Learn more about Copilot code review.
At least 1 approving review is required to merge this pull request. Uh oh!
There was an error while loading. Please reload this page. AssigneesNo one assignedLabels
WG-Engine
ProjectsMilestoneNo milestoneDevelopmentSuccessfully merging this pull request may close these issues. The module analysis cache is never saved by short-lived pwsh processesUh oh!
There was an error while loading. Please reload this page. 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. | |||||||||||||||||||
| You are visitor 01402503 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |