Skip to content

Wait for ready on raw session start and respect timeout on kernel change #11768

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

Merged

Conversation

IanMatthewHuff
Copy link
Member

For #11752

  • 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!).
  • Appropriate comments and documentation strings in the code.
  • 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.

@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities (and Security Hotspot 0 Security Hotspots to review)
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@@ -131,7 +138,13 @@ export class RawJupyterSession extends BaseJupyterSession {

this.outputChannel.appendLine(localize.DataScience.kernelStarted().format(kernel.display_name || kernel.name));

return this.startRawSession(kernel, interpreter);
const newSession = await waitForPromise(this.startRawSession(kernel, interpreter), timeoutMS);
Copy link
Member Author

Choose a reason for hiding this comment

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

Needed to respect the restart timeout that was getting passed in here.

@@ -209,6 +222,9 @@ export class RawJupyterSession extends BaseJupyterSession {
// Create our raw session, it will own the process lifetime
const result = new RawSession(process);

// When our kernel connects and gets a status message it triggers the ready promise
await result.kernel.ready;
Copy link
Member Author

Choose a reason for hiding this comment

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

This was actually the more interesting part of the fix. When we were having those initial windows launch fixes I examined this promise, but it didn't actually help with the case where the ports were not open yet. But we do need it here. Ready waits for that initial kernel_status message to be returned. So without this here we might have a bad kernel that can't actually start (regardless of if the process exits or not) but we would leak outside of the start timeout check. So the start or switch timeout check would not trigger, but we'd be stuck with a hung kernel.

Copy link

@rchiodo rchiodo left a comment

Choose a reason for hiding this comment

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

:shipit:

@codecov-io
Copy link

Codecov Report

Merging #11768 into master will decrease coverage by 0.23%.
The diff coverage is 27.27%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #11768      +/-   ##
==========================================
- Coverage   60.63%   60.40%   -0.24%     
==========================================
  Files         628      630       +2     
  Lines       33943    34122     +179     
  Branches     4782     4797      +15     
==========================================
+ Hits        20581    20611      +30     
- Misses      12365    12512     +147     
- Partials      997      999       +2     
Impacted Files Coverage Δ
...client/datascience/raw-kernel/rawJupyterSession.ts 16.84% <11.11%> (ø)
src/client/common/utils/localize.ts 95.57% <100.00%> (+<0.01%) ⬆️
...ient/datascience/jupyter/kernels/kernelSwitcher.ts 87.01% <100.00%> (+0.17%) ⬆️
src/datascience-ui/react-common/arePathsSame.ts 75.00% <0.00%> (-12.50%) ⬇️
src/client/common/utils/platform.ts 64.70% <0.00%> (-5.89%) ⬇️
src/client/linters/pydocstyle.ts 86.66% <0.00%> (-2.23%) ⬇️
src/client/datascience/debugLocationTracker.ts 76.56% <0.00%> (-1.57%) ⬇️
...nt/datascience/jupyter/kernels/kernelSelections.ts 89.21% <0.00%> (-1.32%) ⬇️
src/client/common/process/proc.ts 14.49% <0.00%> (-0.73%) ⬇️
src/client/datascience/types.ts 100.00% <0.00%> (ø)
... and 8 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e9a8d0a...22ff54c. Read the comment docs.

@IanMatthewHuff IanMatthewHuff merged commit b344d29 into microsoft:master May 12, 2020
@IanMatthewHuff IanMatthewHuff deleted the dev/ianhu/badKernelLaunch branch May 12, 2020 23:26
@lock lock bot locked as resolved and limited conversation to collaborators May 20, 2020
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.

4 participants