Skip to content

Fix issues with LiveShare and triple quotes#5084

Merged
rchiodo merged 8 commits intomasterfrom
rchiodo/triplequoted
Apr 2, 2019
Merged

Fix issues with LiveShare and triple quotes#5084
rchiodo merged 8 commits intomasterfrom
rchiodo/triplequoted

Conversation

@rchiodo
Copy link
Copy Markdown

@rchiodo rchiodo commented Apr 2, 2019

For #5012 and bugs found while testing the fix for 5012 around liveshare

  • Pull request represents a single change (i.e. not fixing disparate/unrelated things in a single PR)
  • Title summarizes what is changing
  • Has a news entry file (remember to thank yourself!)
  • Has sufficient logging.
  • Has telemetry for enhancements.
  • Unit tests & system/integration tests are added/updated
  • Test plan is updated as appropriate
  • package-lock.json has been regenerated by running npm install (if dependencies have changed)
  • The wiki is updated with any design decisions/details.

@rchiodo rchiodo self-assigned this Apr 2, 2019
@rchiodo rchiodo requested a review from IanMatthewHuff April 2, 2019 21:08
MOCHA_FILE: '$(Build.ArtifactStagingDirectory)/test-junit.xml' # All test files will write their JUnit xml output to this file, clobbering the last time it was written.
MOCHA_REPORTER_JUNIT: true # Use the mocha-multi-reporters and send output to both console (spec) and JUnit (mocha-junit-reporter).
# VSC_PYTHON_FORCE_LOGGING: true - Enable this to turn on console output for the logger
VSC_PYTHON_FORCE_LOGGING: true # Enable this to turn on console output for the logger
Copy link
Copy Markdown
Author

@rchiodo rchiodo Apr 2, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

VSC_PYTHON_FORCE_LOGGING [](start = 2, length = 24)

This is from the Monday meeting. I said I'd enable this on my next submission. #Resolved

if (this.requestLog.has(id)) {
// This must be a local call that occurred after a guest call. Just
// use the local responses to return the results.
return this.localResponses.waitForObservable(code, id);
Copy link
Copy Markdown
Author

@rchiodo rchiodo Apr 2, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

localResponses [](start = 24, length = 14)

The root change for liveshare was to separate the list of cached responses into two groups - local and guest. Local is used when the guest makes a request before the host can. This happens on export with output and sometimes when clicking/submitting through the input box. This is the root cause of the bug we saw during our demo. #Resolved

return (r.pos === pos) &&
(foundId === r.id || !foundId) &&
(code === r.code) &&
(!r.cells || (r.cells && r.cells[0].file === file && r.cells[0].line === line));
Copy link
Copy Markdown
Author

@rchiodo rchiodo Apr 2, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Realized we have an id for all requests now so checking file is unnecessary. It was the part of the original bug I found where if the guest submitted first, the file name wouldn't match. #Resolved

// Look through all of our responses that are queued up and see if they make a
// waiting promise resolve
for (let i = 0; i < this.responseQueue.length; i += 1) {
const response = this.responseQueue[i];
Copy link
Copy Markdown
Author

@rchiodo rchiodo Apr 2, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

responseQueue [](start = 34, length = 13)

Also realized rechecking here through all responses is redundant as they've already been checked before. Only need to check the new response. #Resolved

subscriber.error(this.sessionStartTime, new Error(localize.DataScience.jupyterServerCrashed().format(exitCode.toString())));
subscriber.complete(this.sessionStartTime);
} else {
const request = this.generateRequest(concatMultilineString(stripComments(subscriber.cell.data.source)), silent);
Copy link
Copy Markdown
Author

@rchiodo rchiodo Apr 2, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

stripComments [](start = 75, length = 13)

This is the bug fix for the 5102 bug. #Resolved

return callback;
}

private getApi() : Promise<vsls.LiveShare | null> {
Copy link
Copy Markdown
Author

@rchiodo rchiodo Apr 2, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Refactored this so that the promise doesn't start in the ctor. It was easier to debug when stuff was happening if the promise wasn't starting right away. #Resolved

public send(service: vsls.SharedService) {
this.responseQueue.forEach(r => service.notify(LiveShareCommands.serverResponse, r));
public send(service: vsls.SharedService, translator: (r: IServerResponse) => IServerResponse) {
this.responseQueue.forEach(r => service.notify(LiveShareCommands.serverResponse, translator(r)));
Copy link
Copy Markdown
Author

@rchiodo rchiodo Apr 2, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Host to guest file remapping now happens at send time instead of response push time. That's because of the 'local' copy the host requires. #Resolved

}

private onStatusChanged(_s: Session.ISession, a: Kernel.Status) {
traceInfo(`Status changed to ${a} from OnStatusChangedEvent`);
Copy link
Copy Markdown
Member

@IanMatthewHuff IanMatthewHuff Apr 2, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

too noisy I assume? #ByDesign

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah. Not necessary too as the 'wait for idle' status is pretty much the same thing.


In reply to: 271499147 [](ancestors = 271499147)

}

private onServerResponse = (args: Object) => {
const er = args as IExecuteObservableResponse;
Copy link
Copy Markdown
Member

@IanMatthewHuff IanMatthewHuff Apr 2, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't hostJupyterServer pass something that is just an IServerResponse and not an IExecuteObservableResponse? #WontFix

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep. Exceptions also come through. The trace will just show undefined then.


In reply to: 271502241 [](ancestors = 271502241)

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

er.Pos and er.Id will be undefined.


In reply to: 271502440 [](ancestors = 271502440,271502241)

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you think I should skip logging?


In reply to: 271502541 [](ancestors = 271502541,271502440,271502241)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it. Just wasn't sure if you wanted undefined printed out. Seems ok.


In reply to: 271502541 [](ancestors = 271502541,271502440,271502241)

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If er is not a ExecuteObservableResponse


In reply to: 271502746 [](ancestors = 271502746,271502541,271502440,271502241)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's probably ok. My brains just says null exception when I see this. Your choice,


In reply to: 271502858 [](ancestors = 271502858,271502746,271502541,271502440,271502241)

Copy link
Copy Markdown
Member

@IanMatthewHuff IanMatthewHuff left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:shipit:

@rchiodo rchiodo merged commit 1575c12 into master Apr 2, 2019
@rchiodo rchiodo deleted the rchiodo/triplequoted branch April 2, 2019 21:31
@lock lock Bot locked as resolved and limited conversation to collaborators Jul 30, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants