-
Notifications
You must be signed in to change notification settings - Fork 201
Description
Hello Friends --
I found on qtconsole if you create a new tab New Tab with New Kernel, then close the new tab with No, just this Tab (or any other number of created tabs), there will be almost silent exception about:
RuntimeError: wrapped C/C++ object of type QtKernelManager has been deleted
[IPKernelApp] WARNING | Parent appears to have exited, shutting down.The side effect is very small, but makes me double check as I subclass your nice library for learning.
I know this qt RuntimeError message. Perhaps it is race condition or indicate some leak of memory / reference?
Because of where the exception is (in jupyter_client.manager), it does not reach the line where connection info json is cleaned up.
So it is garbage left over (can check your user jupyter folder for number of json connect info files!). Also for crashing spyder app too (start a new console).
def __del__(self) -> None:
self._close_control_socket() ##<-- traceback below
self.cleanup_connection_file()
The first kernel / tab is created differently from additional, can be problem?
Terminal output (problem)
(ihaveaircon) D:\pythong\CODE\zmqgui>jupyter qtconsole
Exception ignored in: <function KernelManager.__del__ at 0x0000023C20507600>
Traceback (most recent call last):
File "%yoyoyo%\miniforge3\envs\ihaveaircon\Lib\site-packages\jupyter_client\manager.py", line 232, in __del__
self._close_control_socket()
File "%yoyoyo%\miniforge3\envs\ihaveaircon\Lib\site-packages\jupyter_client\manager.py", line 373, in _close_control_socket
self._control_socket = None
^^^^^^^^^^^^^^^^^^^^
File "%yoyoyo%\miniforge3\envs\ihaveaircon\Lib\site-packages\traitlets\traitlets.py", line 716, in __set__
self.set(obj, value)
File "%yoyoyo%\miniforge3\envs\ihaveaircon\Lib\site-packages\traitlets\traitlets.py", line 706, in set
obj._notify_trait(self.name, old_value, new_value)
File "%yoyoyo%\miniforge3\envs\ihaveaircon\Lib\site-packages\traitlets\traitlets.py", line 1513, in _notify_trait
self.notify_change(
File "%yoyoyo%\miniforge3\envs\ihaveaircon\Lib\site-packages\traitlets\traitlets.py", line 1525, in notify_change
return self._notify_observers(change)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "%yoyoyo%\miniforge3\envs\ihaveaircon\Lib\site-packages\traitlets\traitlets.py", line 1544, in _notify_observers
if event["type"] == "change" and hasattr(self, magic_name):
^^^^^^^^^^^^^^^^^^^^^^^^^
RuntimeError: wrapped C/C++ object of type QtKernelManager has been deleted
[IPKernelApp] WARNING | Parent appears to have exited, shutting down.
(ihaveaircon) D:\pythong\CODE\zmqgui>Also, same behavior when making new tab+kernel and then closing it later, like:
from qtconsole.qtconsoleapp import JupyterQtConsoleApp
class CustomJupyterQtConsoleApp(JupyterQtConsoleApp):
def spawn_new_kernel_tab(self):
self.window.new_kernel_tab_act.trigger() #calls create_tab_with_new_frontendLet's find the bug!
-- Best!