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

Different error handling of kernel startup and restart #10937

Closed
rebornix opened this issue Jul 26, 2022 · 3 comments · Fixed by #10966
Closed

Different error handling of kernel startup and restart #10937

rebornix opened this issue Jul 26, 2022 · 3 comments · Fixed by #10966
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug verified Verification succeeded
Milestone

Comments

@rebornix
Copy link
Member

rebornix commented Jul 26, 2022

Testing #10923

  1. Create a new folder and a ipynb file with content print(123) in the first cell
  2. Run the cell against a valid kernel (Python 3.6+)
  3. Add an email.py file in the same folder
  4. Restart the kernel

Now I got error message

Failed to start the Kernel. 
Cannot read properties of null (reading 'statusChanged'). 
View Jupyter [log](command:jupyter.viewOutput) for further details.

And in the Jupyter log it said

[E 10:34:35.419 NotebookApp] Error opening stream: HTTP 404: Not Found (Kernel does not exist: 4f479182-870f-4f57-a0b1-009e5853555e)

If we flip step 2 and 3, then we would get proper error message

Some of the following files found in the working directory may have prevented the Kernel from starting. Consider renaming them.
File(s): [~\email.py](file:///c%3A/Users/rebor/code/personal/notebooks/bugs/email.py?line=1) might need to be renamed.
@github-actions github-actions bot added the triage-needed Issue needs to be triaged label Jul 26, 2022
@DonJayamanne
Copy link
Contributor

DonJayamanne commented Jul 26, 2022

Oh that's a weird error, never seen that before. Looks like Jupyter is in a broken state, we end up with a session but no kernel connection, very weird.
Guess we'll need to special case this.

@rebornix please could you provide the logs (I'd like to see the exact line when this fails). I'm assuming I know, but would like to be certain, as I cannot replicate this.

@DonJayamanne DonJayamanne added the info-needed Issue requires more information from poster label Jul 26, 2022
@rebornix
Copy link
Member Author

@DonJayamanne the minified call stack is probably not easy to debug but here we go

[W 10:23:53.249 NotebookApp] delete /crash-jvsc-aff3bb37-f306-4172-a13a-10309f640e4c1dddf7a0-dad1-4fb7-a857-903eb60a80ff.ipynb
[I 10:23:56.250 NotebookApp] KernelRestarter: restarting kernel (1/5), new random ports
[I 10:23:59.270 NotebookApp] KernelRestarter: restarting kernel (2/5), new random ports
[I 10:24:02.280 NotebookApp] KernelRestarter: restarting kernel (3/5), new random ports
[I 10:24:05.302 NotebookApp] KernelRestarter: restarting kernel (4/5), new random ports
[W 10:24:08.308 NotebookApp] KernelRestarter: restart failed
[W 10:24:08.308 NotebookApp] Kernel cd644242-67e4-4c86-9070-e6c3bad2759e died, removing from map.
info 10:24:53.251: Error waiting for restart session: TypeError: Cannot read properties of null (reading 'statusChanged')
error 10:24:53.256: Restart failed c:\Users\rebor\code\personal\notebooks\bugs\crash.ipynb [TypeError: Cannot read properties of null (reading 'statusChanged')
	at waitForIdleOnSession (c:\Users\rebor\.vscode-insiders\extensions\ms-toolsai.jupyter-2022.7.1002101047\out\extension.node.js:2:1923258)
	at async w.createRestartSession (c:\Users\rebor\.vscode-insiders\extensions\ms-toolsai.jupyter-2022.7.1002101047\out\extension.node.js:2:2198963)]
[W 10:24:53.264 NotebookApp] Timeout waiting for kernel_info reply from cd644242-67e4-4c86-9070-e6c3bad2759e
[I 10:24:53.265 NotebookApp] Kernel shutdown: 1f907204-3600-471b-846d-8ee18149ea43
warn 10:24:53.590: Error occurred while trying to restart the kernel, options.disableUI=false [TypeError: Cannot read properties of null (reading 'statusChanged')
	at waitForIdleOnSession (c:\Users\rebor\.vscode-insiders\extensions\ms-toolsai.jupyter-2022.7.1002101047\out\extension.node.js:2:1923258)
	at async w.createRestartSession (c:\Users\rebor\.vscode-insiders\extensions\ms-toolsai.jupyter-2022.7.1002101047\out\extension.node.js:2:2198963)]
warn 10:24:53.592: Kernel Error, context = restart [TypeError: Cannot read properties of null (reading 'statusChanged')
	at waitForIdleOnSession (c:\Users\rebor\.vscode-insiders\extensions\ms-toolsai.jupyter-2022.7.1002101047\out\extension.node.js:2:1923258)
	at async w.createRestartSession (c:\Users\rebor\.vscode-insiders\extensions\ms-toolsai.jupyter-2022.7.1002101047\out\extension.node.js:2:2198963)]
info 10:24:53.597: Process Execution: > ~\.conda\envs\testenv\python.exe -c "import ipykernel"
> ~\.conda\envs\testenv\python.exe -c "import ipykernel"
[E 10:24:53.593 NotebookApp] Error opening stream: HTTP 404: Not Found (Kernel does not exist: cd644242-67e4-4c86-9070-e6c3bad2759e)
info 10:24:54.136: Dispose Kernel 'c:\Users\rebor\code\personal\notebooks\bugs\crash.ipynb' associated with 'c:\Users\rebor\code\personal\notebooks\bugs\crash.ipynb'
info 10:24:54.136: Cancel pending cells

@DonJayamanne
Copy link
Contributor

DonJayamanne commented Jul 28, 2022

Thanks, stack trace was very helpful, was able to find the exact spot where things failed

@DonJayamanne DonJayamanne added bug Issue identified by VS Code Team member as probable bug and removed info-needed Issue requires more information from poster triage-needed Issue needs to be triaged labels Jul 28, 2022
@DonJayamanne DonJayamanne added this to the July 2022 milestone Jul 28, 2022
@rzhao271 rzhao271 added the verified Verification succeeded label Jul 29, 2022
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 30, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug verified Verification succeeded
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants