Repository navigation
Name a suspected leak by what the runtime reported; tell a direct runtime what tracking does - #33
Merged
Merged
Conversation
…time what tracking does The autopilot's leak offer named every leak by file:line, and the diff the UI reads dropped the runtime's type name. A .NET byte[] grown by user code has a type and no line, so SharpLsp offered "Suspected memory leak at :0 (HIGH)" on every run. The offer now names the type and the source line as far as they were reported, and among equally confident leaks it offers one with a source line. Both toasts that open tracking told the user to press Continue so each pause is captured. A direct runtime is never captured at a pause ([PROF-MEMORY-MODE]), so a .NET user waited for captures that never came. The toast now says what the runtime's mode does: a direct runtime is captured on the interval while it runs (or snapshotted by hand), never while paused, and its last snapshot opens when it ends.
…s the editor does cancel_during_a_scan_stops_the_stream_with_the_standard_error failed on CI (lspkit #33, run 40838382102): it required a second partial to stream after the first, but a cancel racing the first partial sometimes left none. The scan is now held on the native read of its last document, which sorts after every scan document, so the cancel lands mid-scan by construction. The test now asserts every one of the 64 documents before the hold streamed exactly once, the held one never did, and the reply is the standard cancellation error. The CPU capture contract's hot-line navigation compared the opened editor's fsPath to the runtime's file as raw strings. On Windows the editor spells the drive in lower case, so a fixture built from an upper-case path failed although the right file opened at the right line (SharpLsp's Windows profiler chunk, locally). It now compares through editorPathKey and asserts the hot line's own file opened.
…nguages in messages Watching SharpLsp's Windows profiler suite turned up two more messages that told a .NET user something untrue or unreadable: - Stopping tracking before any snapshot said "Take a snapshot while paused, or let the program finish". A direct runtime refuses a snapshot while paused ([PROF-MEMORY-MODE]), and the start toast just above it now says "never while paused". stoppedWithoutSnapshot now says, for a direct runtime, to take one while the program runs. - "Run & profile" with no file of the host's languages open said "Open a csharp/fsharp file": VS Code language IDs. A host now also supplies languageNames ([PROF-UI-HOST]), and the message reads "Open a file in F# or C# to run and profile."
…re survives The editor-path-key test junctions dotnet/fixtures/HotLeakApp into a temp directory. On Windows its teardown's recursive rmSync followed the junction and deleted the real fixture's Program.cs and HotLeakApp.csproj on every UI-suite run. The link itself is now unlinked first, and a new test removes a link the same way and asserts the linked project's files remain; it fails without the unlink.
… copied-PID toast Revealing a .NET process row with no entry file said 'no resolvable script file', Python-era wording under a command titled 'Reveal Entry in Editor'; 'Copied PID' was the one profiler toast without the host's name.
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.
TLDR
The autopilot's leak offer no longer reads "Suspected memory leak at :0" for a leak with a type and no source line. The tracking toast no longer tells a direct (.NET) runtime that each pause is captured. Two flaky tests are made deterministic: the server's mid-scan cancel, and Windows hot-line navigation.
Details
Both bugs showed up watching SharpLsp's memory autopilot e2e in a real VS Code window on Windows.
toDiffResult) dropped the runtime'stype_name, and the offer named every leak bybasename(file):line.byte[]grown by user code has a type and no line, so every local run of SharpLsp's money-flow e2e offered:0 (HIGH): 8 of 8 offers.memory-leak-offer.ts:describeLeaknames the type and the source line as far as they were reported, for exampleLoopLeak.Widget at Program.cs:4orSystem.Byte[];leakToOfferoffers the most confident leak, and among equals one with a source line.LeakActionOffer(the e2e seam) now recordstypeNameand themessageshown.worstLeakis gone: the capture ledger's max confidence comes fromleakToOffer.memory-guidance.ts,trackingGuidance(direct, intervalSecs):captureIntervalSeconds()is now the one reader of the interval settings, shared by the autopilot timer and the toast.stoppedWithoutSnapshot(direct)now tells a direct runtime to take one while the program runs.ProfilerHostnow carries the requiredlanguageNames, and the message reads "Open a file in F# or C# to run and profile". The spec lists the new field.editor-path-key.test.tsjunctionsdotnet/fixtures/HotLeakAppinto a temp dir. Its teardown's recursivermSyncfollowed the junction on Windows and deleted the fixture'sProgram.csandHotLeakApp.csprojon every run.cancel_during_a_scan_stops_the_stream_with_the_standard_error.HeldSource;waiting.jsonsorts after everyscan-NNNN.json), so the cancel lands mid-scan by construction.-32800.a measured hot line navigates to the actual runtime source.activeTextEditor.document.uri.fsPathto the runtime's file as raw strings. VS Code spells the drivec:, and a fixture built fromC:\...reportedC:.editorPathKey, like every other overlay, and asserts the hot line's own file opened.How Do The Automated Tests Prove It Works?
src/test/suite/memory-leak-offer.test.tshas 9 tests:a diff keeps the type the runtime named…pushes a wire diff of three leaks throughtoMemoryIngestResultandtoDiffResult: type-only, located, and neither. It asserts each leak's file, line, type and confidence. With the mapping line reverted it fails ontypeName: ''vs'System.Byte[]'and'LoopLeak.Widget'.Naming:
System.Byte[]and contains no:;LoopLeak.Widget at Program.cs:4, orProgram.cs:4without a type;Choice:
Toast:
stopped before any snapshot…: a direct runtime is told to snapshot while it runs, never while paused, and a courier one keeps its words.host-language-names.test.ts: two names are joined in words in the host's order, one name stands alone, and no/or language ID leaks through.removing the link leaves the project it linked to in placefails without the unlink: the fixture is gone. It passes with it.The full UI suite passes (189) and
npm run lintis clean.dispatcher::passed 20 of 20 runs on Windows after the change.profiler-cpu-e2eon Windows failed before the change: the editor was atc:\...\ProfileTarget\Program.csline 251, and the test timed out on the raw compare.