-
Notifications
You must be signed in to change notification settings - Fork 293
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
"notebook controller is DISPOSED." when running a code cell during debug session #16185
Comments
Thank you for filing this issue and sorry you ran into this. |
@DonJayamanne, this issue has happened only once. I have been using VS Code and Juypter regularly for over a year now and this is the first time that the problem has appeared. I did just update VS Code with the latest available, so perhaps something changed in the latest version? |
Thanks for the prompt response. We haven't made any changes in this space, its more likely related to some other issue we're looking at. If however you do run into this, please do check the logs again & share the full logs (the contents in the logs before the error is crucial in this case), it would tell us whether the notebook was closed or a cell was deleted (visually the notebook may not be closed, however the notebook object may have been closed/disposed which results in such errors). |
If you run into this again, please feel free to create a new issue or ping here and we'll re-open this, |
@DonJayamanne, please tell me more about the logs you need. Is it from the same Output window from which I copied the logs in this bug? If so, there were no other recent entries: the prior entries were from some hours before describing that I had started a debug session. (I know this because I used the timestamps to determine which parts of the logs to copy.) Also, I had not closed the notebook (or any file for that matter) at the time of the issue, nor had I deleted a cell recently. The most recent cell action was likely the addition of a cell before going to edit the cell that raised the issue. The new cell was several below the cell where the error occurred. It is understood that you need more info. Sorry the detailed logs were not enough. Let me know what you need in case it occurs again. |
@DonJayamanne, FWIW here are the logs for a few operations before the one that had the above error. Looking closely, there were other instances of the "notebook controller is DISPOSED" error, but they did not result in an error message in the notebook itself.
The last line above is the one reported earlier. |
Please can you re-load VS Code and replicate the issue and share the full log (start to end). |
Please could you enable logging as follows:
|
Thanks for the info. Your timing was perfect: the problem just happened again. I believe I may have tracked down more of the specifics for you. VS Code had been idle for some hours. I sat down and started editing some code, then ran a cell that referenced that code. The error again appeared, in red, below the cell:
In the logs (with
This time the cause is that my edit introduced an (unintended) infinite loop. So, when I ran cell A, Python went into a loop. However, expecting that the code would execute immediately, I also ran cell B. That is when the above error occurred. The possible parallel with the previous case is that I was debugging, stopped at a break point, when I recognized an issue, changed the code, and ran the cell containing the function in question. Thus, I asked Python to run a cell while a debug session was active. Indeed, I can now reliably reproduce the error by again executing my code with the bug that causes the infinite loop (cell "A" above), then, while running, execute cell "B". But, only when another condition has also occurred, as explained below. Next, I changed the log setting as requested, restarted VS Code and repeated the above scenario. This time, no error. So, that brings us to one additional factor. Issue VS Code Issue #24364 describes my attempts to deal with an upgraded Python interpreter. In both sessions where the failure occurred, I configured a Python virtual environment by hand, then chose that environment in Jupyter. What reminded me of this was that, in the prior session (alas, now gone, so I can't copy the log lines), I saw Jupyter logging messages that it had detected the change in kernel. To test this, I again went though the steps in VS Code Issue #24364 to select the recommended interpreter (so that the interpreter changes), then to manually configure my virtual environment. As described in that other issue, Jupyter "lost" the kernel when I switch to the recommended one, then "remembered" the kernel when I switched back to my virtual environment. I then reran the required code cells in my notebook, including the one with the buggy infinite loop (cell "A"). As before, with that cell running, I ran cell "B" and again got the
Logs:
The |
@paul-rogers Please can you share the full logs.
Also, please can you add the following setting into your settings folder
Optionally you can just do this via the settings ui |
As requested, here is a session with full logs and new notebook. I was earlier wrestling with getting the Python extension to find my virtual environment. After realizing that the documentation was incomplete, and taking the necessary steps, my virtual environment now does appear in the Also, as requested in another issue, I did update the Python extension to the newest version, so the following description is with the latest version. To start, let's just set up the kernel:
Logs thus far. The contents seem to contain many errors that I did not see in sessions reported above.
I do not know what all the above means. But, in case it matters, my list of Python interpreters is currently littered with duplicates due to my efforts to resolve another issue: |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Now we can move onto reproducing the actual
def loop():
while True:
pass
loop()
The logs indicate no problem. Recall that this is simplified version of the scenario described in this bug. With a properly-configured interpreter, the I don't have the time to repeat this using the broken |
To see if the use of
What is odd is that I then recreated the infinite loop mentioned before. (The code had since been fixed.) I then recreated the scenario described above. No errors appeared in the notebook or in the logs. My conclusion is that the |
Than you for getting back, closing this issue as its been fixed |
Type: Bug
A notebook is open with a Python kernel. I was working on code for some hours. Nothing particularly special or large: just a around 20 cells, a few hundred lines of code, some Markdown and one MatPlotLib chart. Edited a Python cell containing a function declaration and ran it. Got a red error under the cell that says:
The one thing I did wrong is that I edited the cell and ran it while a debug session was still active on that same cell. Usually this just redefines the function (which, obviously, is rather goofy on my part), but usually if I make this mistake all is fine when I end the debug session. This is the first time I've seen the above error.
There does not seem to be permanent damage. If I end the debug session, rerun the function definition cell and continue working, it seems that things are back to normal. So, this is some temporary glitch that can, apparently, be ignored.
The word "log" in the message above is a link. Clicking on that opens the log with the following:
Extension version: 2024.10.0
VS Code version: Code 1.95.0 (912bb683695358a54ae0c670461738984cbb5b95, 2024-10-28T20:16:24.561Z)
OS version: Linux x64 6.8.0-47-generic
Modes:
System Info
canvas_oop_rasterization: enabled_on
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_graphite: disabled_off
video_decode: enabled
video_encode: disabled_software
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: disabled_off
webnn: disabled_off
A/B Experiments
The text was updated successfully, but these errors were encountered: