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

Kernel dies when interrupting long-running completions #261

Open
chmp opened this issue Aug 18, 2017 · 1 comment
Open

Kernel dies when interrupting long-running completions #261

chmp opened this issue Aug 18, 2017 · 1 comment

Comments

@chmp
Copy link

chmp commented Aug 18, 2017

Under certain conditions, completion for pandas dataframes can take considerable amounts of time. When interrupting the kernel, it will die. This problem can be easily reproduced by forcing long completion times. Consider the object inst defined via

import time

class SleepingDir(object):
    def __dir__(self):
        time.sleep(60)
        return []
    
inst = SleepingDir()

When starting completion for inst, the kernel stops to respond. Interrupting the kernel kills it with the following stack trace:

ERROR:tornado.general:Uncaught exception, closing connection.
Traceback (most recent call last):
  File "/Volumes/Home/venvs/py3-data-science/lib/python3.6/site-packages/zmq/eventloop/zmqstream.py", line 414, in _run_callback
    callback(*args, **kwargs)
  File "/Volumes/Home/venvs/py3-data-science/lib/python3.6/site-packages/tornado/stack_context.py", line 277, in null_wrapper
    return fn(*args, **kwargs)
  File "/Volumes/Home/venvs/py3-data-science/lib/python3.6/site-packages/ipykernel/kernelbase.py", line 283, in dispatcher
    return self.dispatch_shell(stream, msg)
  File "/Volumes/Home/venvs/py3-data-science/lib/python3.6/site-packages/ipykernel/kernelbase.py", line 235, in dispatch_shell
    handler(stream, idents, msg)
  File "/Volumes/Home/venvs/py3-data-science/lib/python3.6/site-packages/ipykernel/kernelbase.py", line 434, in complete_request
    matches = self.do_complete(code, cursor_pos)
  File "/Volumes/Home/venvs/py3-data-science/lib/python3.6/site-packages/ipykernel/ipkernel.py", line 257, in do_complete
    txt, matches = self.shell.complete('', line, line_cursor)
  File "/Volumes/Home/venvs/py3-data-science/lib/python3.6/site-packages/IPython/core/interactiveshell.py", line 1974, in complete
    return self.Completer.complete(text, line, cursor_pos)
  File "/Volumes/Home/venvs/py3-data-science/lib/python3.6/site-packages/IPython/core/completer.py", line 1840, in complete
    return self._complete(line_buffer=line_buffer, cursor_pos=cursor_pos, text=text, cursor_line=0)[:2]
  File "/Volumes/Home/venvs/py3-data-science/lib/python3.6/site-packages/IPython/core/completer.py", line 1913, in _complete
    cursor_pos, cursor_line, full_text)
  File "/Volumes/Home/venvs/py3-data-science/lib/python3.6/site-packages/IPython/core/completer.py", line 1297, in _jedi_matches
    return filter(completion_filter, interpreter.completions())
  File "/Volumes/Home/venvs/py3-data-science/lib/python3.6/site-packages/jedi/api/__init__.py", line 179, in completions
    completions = completion.completions()
  File "/Volumes/Home/venvs/py3-data-science/lib/python3.6/site-packages/jedi/api/completion.py", line 96, in completions
    completion_names = self._get_context_completions()
  File "/Volumes/Home/venvs/py3-data-science/lib/python3.6/site-packages/jedi/api/completion.py", line 169, in _get_context_completions
    completion_names += self._trailer_completions(dot.get_previous_leaf())
  File "/Volumes/Home/venvs/py3-data-science/lib/python3.6/site-packages/jedi/api/completion.py", line 210, in _trailer_completions
    completion_names += filter.values()
  File "/Volumes/Home/venvs/py3-data-science/lib/python3.6/site-packages/jedi/evaluate/compiled/__init__.py", line 344, in values
    for name in dir(obj):
  File "<ipython-input-3-8d9cbde41fb7>", line 5, in __dir__
    time.sleep(60)
KeyboardInterrupt
ERROR:tornado.general:Uncaught exception, closing connection.
Traceback (most recent call last):
  File "/Volumes/Home/venvs/py3-data-science/lib/python3.6/site-packages/zmq/eventloop/zmqstream.py", line 440, in _handle_events
    self._handle_recv()
  File "/Volumes/Home/venvs/py3-data-science/lib/python3.6/site-packages/zmq/eventloop/zmqstream.py", line 472, in _handle_recv
    self._run_callback(callback, msg)
  File "/Volumes/Home/venvs/py3-data-science/lib/python3.6/site-packages/zmq/eventloop/zmqstream.py", line 414, in _run_callback
    callback(*args, **kwargs)
  File "/Volumes/Home/venvs/py3-data-science/lib/python3.6/site-packages/tornado/stack_context.py", line 277, in null_wrapper
    return fn(*args, **kwargs)
  File "/Volumes/Home/venvs/py3-data-science/lib/python3.6/site-packages/ipykernel/kernelbase.py", line 283, in dispatcher
    return self.dispatch_shell(stream, msg)
  File "/Volumes/Home/venvs/py3-data-science/lib/python3.6/site-packages/ipykernel/kernelbase.py", line 235, in dispatch_shell
    handler(stream, idents, msg)
  File "/Volumes/Home/venvs/py3-data-science/lib/python3.6/site-packages/ipykernel/kernelbase.py", line 434, in complete_request
    matches = self.do_complete(code, cursor_pos)
  File "/Volumes/Home/venvs/py3-data-science/lib/python3.6/site-packages/ipykernel/ipkernel.py", line 257, in do_complete
    txt, matches = self.shell.complete('', line, line_cursor)
  File "/Volumes/Home/venvs/py3-data-science/lib/python3.6/site-packages/IPython/core/interactiveshell.py", line 1974, in complete
    return self.Completer.complete(text, line, cursor_pos)
  File "/Volumes/Home/venvs/py3-data-science/lib/python3.6/site-packages/IPython/core/completer.py", line 1840, in complete
    return self._complete(line_buffer=line_buffer, cursor_pos=cursor_pos, text=text, cursor_line=0)[:2]
  File "/Volumes/Home/venvs/py3-data-science/lib/python3.6/site-packages/IPython/core/completer.py", line 1913, in _complete
    cursor_pos, cursor_line, full_text)
  File "/Volumes/Home/venvs/py3-data-science/lib/python3.6/site-packages/IPython/core/completer.py", line 1297, in _jedi_matches
    return filter(completion_filter, interpreter.completions())
  File "/Volumes/Home/venvs/py3-data-science/lib/python3.6/site-packages/jedi/api/__init__.py", line 179, in completions
    completions = completion.completions()
  File "/Volumes/Home/venvs/py3-data-science/lib/python3.6/site-packages/jedi/api/completion.py", line 96, in completions
    completion_names = self._get_context_completions()
  File "/Volumes/Home/venvs/py3-data-science/lib/python3.6/site-packages/jedi/api/completion.py", line 169, in _get_context_completions
    completion_names += self._trailer_completions(dot.get_previous_leaf())
  File "/Volumes/Home/venvs/py3-data-science/lib/python3.6/site-packages/jedi/api/completion.py", line 210, in _trailer_completions
    completion_names += filter.values()
  File "/Volumes/Home/venvs/py3-data-science/lib/python3.6/site-packages/jedi/evaluate/compiled/__init__.py", line 344, in values
    for name in dir(obj):
  File "<ipython-input-3-8d9cbde41fb7>", line 5, in __dir__
    time.sleep(60)
KeyboardInterrupt

I'm running with version 4.6.1 of the ipykernel package. The output of python -c "import IPython; print(IPython.sys_info())" reads:

{'commit_hash': 'd86648c5d',
 'commit_source': 'installation',
 'default_encoding': 'UTF-8',
 'ipython_path': '/Volumes/Home/venvs/py3-data-science/lib/python3.6/site-packages/IPython',
 'ipython_version': '6.1.0',
 'os_name': 'posix',
 'platform': 'Darwin-16.7.0-x86_64-i386-64bit',
 'sys_executable': '/Volumes/Home/venvs/py3-data-science/bin/python',
 'sys_platform': 'darwin',
 'sys_version': '3.6.1 (default, Jun 11 2017, 13:55:01) \n'
                '[GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.42.1)]'}
@chmp
Copy link
Author

chmp commented Aug 18, 2017

Oops, I overlooked this issue with the same problem on the ipython project.

Edit: reopened, since the problems seem to be different after all, even though quite similar.

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

No branches or pull requests

1 participant