Skip to content
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

Questionable check for launch.json from file events #47021

Closed
bpasero opened this issue Mar 31, 2018 · 8 comments
Closed

Questionable check for launch.json from file events #47021

bpasero opened this issue Mar 31, 2018 · 8 comments
Assignees
Labels
debt Code quality issues debug Debug viewlet, configurations, breakpoints, adapter issues under-discussion Issue is under discussion for relevance, priority, approach
Milestone

Comments

@bpasero
Copy link
Member

bpasero commented Mar 31, 2018

See https://github.com/Microsoft/vscode/blob/b66f0ba3c70b08ffc046a9f1a6f56e0260129540/src/vs/workbench/parts/debug/electron-browser/debugService.ts#L1310

I think this check is no longer a good one because you can have launch configurations in the multi-root workspace file as well. Is this check still needed? It probably should know in which context it is (folder?) and then check specifically for that path and nothing else.

@bpasero bpasero added the debt Code quality issues label Mar 31, 2018
@isidorn
Copy link
Contributor

isidorn commented Apr 13, 2018

Good catch that is an old heuristic that on debug restart we read the launch configuration from the launch.json only if that launch.json has been changed, otherwise we use what we have in memory.

In order to solve this properly we could:

  • For each launch configuration listen on file events and each launch configuration would be aware if it got changed. Might be a bit ugly since the debug service would have to set for each launch config that when a new debug session starts
  • Drop this heuristic and always re-read the launch configuration on restart. @weinand do you remember what was the downside of this approach?

@isidorn isidorn added debug Debug viewlet, configurations, breakpoints, adapter issues under-discussion Issue is under discussion for relevance, priority, approach labels Apr 13, 2018
@weinand
Copy link
Contributor

weinand commented Apr 13, 2018

The use case that triggered this was that a user edited a launch config and then aways restarted the debug session to pick up those changes.

Since we get the launch configurations via the configuration service, we should not really have to deal with file events ourselves. Isn't there a general mechanism provided by the configuration service that notifies us to update our in-memory model?

@isidorn
Copy link
Contributor

isidorn commented Apr 13, 2018

I understand that use case, but it would be covered by always re-reading before launch. My question is the other way around, what use case is there so we do not read it?

You make a good point about the configuration service, and that is a good approach how to properly solve this on our end and not listen to file events.
However the only time a launch is actually read is when a debug session is started, so my first question holds why not just re-read it before a session starts. Though I am sure there was a reason why we did not simply do this, I just can not remember.

@weinand
Copy link
Contributor

weinand commented Apr 13, 2018

Doing unnecessary work is always bad ("Death by a thousand paper cuts").
If the configuration service gets the data via Live Share, rereading it might be expensive.

Only if the configuration service caches the data for us (and knows when to invalidate the cache), then rereading it every time is acceptable.

@isidorn isidorn added this to the April 2018 milestone Apr 13, 2018
@isidorn
Copy link
Contributor

isidorn commented Apr 19, 2018

@weinand thanks for advice, I checked with Sandeep and the configuration service always caches.
Also we only re-read on debug session start, so I decided to ignore file events and re-read on debug start.

@weinand
Copy link
Contributor

weinand commented Apr 22, 2018

@isidorn I had to revert this change because it results in a bad regression #48333

@weinand weinand reopened this Apr 22, 2018
@weinand weinand modified the milestones: April 2018, May 2018 Apr 22, 2018
@isidorn
Copy link
Contributor

isidorn commented Apr 23, 2018

@weinand thanks for the analysis and the fix for that issue.
We need to devise a better strategy for when to re-read and when not, since it is a bit flaky now. I can think about this in debt week.

@weinand
Copy link
Contributor

weinand commented Apr 23, 2018

@isidorn my proposal:
Re-read always but remember old state and compare with new and use new only on change.
(This approach would be simple to implement if we had an object (aka DebugSession) that tracks the whole lifetime of a restarting debug session; I suggest to fix this problem only after introducing DebugSession , see #48377).

For the launch config from #48333 this will still result in the problem (but IMO we can live with that rare corner case).

@isidorn isidorn closed this as completed in f9367f7 May 8, 2018
@vscodebot vscodebot bot locked and limited conversation to collaborators Jun 22, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
debt Code quality issues debug Debug viewlet, configurations, breakpoints, adapter issues under-discussion Issue is under discussion for relevance, priority, approach
Projects
None yet
Development

No branches or pull requests

3 participants