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

Catch error when shutting down kernel from the control channel #877

Merged
merged 1 commit into from
Feb 28, 2022

Conversation

ccordoba12
Copy link
Member

  • This problem is not allowing kernel restarts to complete when the Tk backend is active.
  • The error is the following:
Traceback (most recent call last):
    File "/home/carlos/miniconda3/envs/spyder‑stable‑cf/lib/python3.7/site‑packages/ipykernel/kernelbase.py", line 285, in process_control
    await result
    File "/home/carlos/miniconda3/envs/spyder‑stable‑cf/lib/python3.7/site‑packages/ipykernel/kernelbase.py", line 814, in shutdown_request
    content = self.do_shutdown(parent['content']['restart'])
    File "/home/carlos/Projects/spyder/github‑repo/external‑deps/spyder‑kernels/spyder_kernels/console/kernel.py", line 105, in do_shutdown
    super(SpyderKernel, self).do_shutdown(restart)
    File "/home/carlos/miniconda3/envs/spyder‑stable‑cf/lib/python3.7/site‑packages/ipykernel/ipkernel.py", line 513, in do_shutdown
    self.shell.exit_now = True
    File "/home/carlos/miniconda3/envs/spyder‑stable‑cf/lib/python3.7/site‑packages/traitlets/traitlets.py", line 606, in __set__
    self.set(obj, value)
    File "/home/carlos/miniconda3/envs/spyder‑stable‑cf/lib/python3.7/site‑packages/traitlets/traitlets.py", line 595, in set
    obj._notify_trait(self.name, old_value, new_value)
    File "/home/carlos/miniconda3/envs/spyder‑stable‑cf/lib/python3.7/site‑packages/traitlets/traitlets.py", line 1224, in _notify_trait
    type='change',
    File "/home/carlos/miniconda3/envs/spyder‑stable‑cf/lib/python3.7/site‑packages/traitlets/traitlets.py", line 1229, in notify_change
    return self._notify_observers(change)
    File "/home/carlos/miniconda3/envs/spyder‑stable‑cf/lib/python3.7/site‑packages/traitlets/traitlets.py", line 1266, in _notify_observers
    c(event)
    File "/home/carlos/miniconda3/envs/spyder‑stable‑cf/lib/python3.7/site‑packages/ipykernel/zmqshell.py", line 472, in _update_exit_now
    exit_hook(self.kernel)
    File "/home/carlos/miniconda3/envs/spyder‑stable‑cf/lib/python3.7/site‑packages/ipykernel/eventloops.py", line 289, in loop_tk_exit
    kernel.app_wrapper.app.destroy()
    File "/home/carlos/miniconda3/envs/spyder‑stable‑cf/lib/python3.7/tkinter/__init__.py", line 2062, in destroy
    self.tk.call('destroy', self._w)
    RuntimeError: main thread is not in main loop

@blink1073 blink1073 added the bug label Feb 28, 2022
Copy link
Member

@blink1073 blink1073 left a comment

Choose a reason for hiding this comment

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

Thanks! Downstream test issue is unrelated

@blink1073 blink1073 merged commit d6744f9 into ipython:main Feb 28, 2022
@ccordoba12 ccordoba12 deleted the catch-error-tk-exit branch February 28, 2022 17:40
@ccordoba12
Copy link
Member Author

Thanks @blink1073!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants