Skip to content

Opening notebooks occasionally yields kernel error, KeyError #4209

@glortho

Description

@glortho

Observed behavior: Users periodically open notebooks to a red "Kernel Error" status marker at top right, along with the bomb icon by the Python 3 kernel indicator. In the devtools console is this stack:

[E 14:13:17.077 NotebookApp] Uncaught exception POST /notebook/api/sessions (10.255.0.4)
    HTTPServerRequest(protocol='http', host='<our host here>', method='POST', uri='/notebook/api/sessions', version='HTTP/1.1', remote_ip='<our remote ip>')
    Traceback (most recent call last):
      File "/anaconda/envs/py3/lib/python3.6/site-packages/tornado/web.py", line 1543, in _execute
        result = yield result
      File "/anaconda/envs/py3/lib/python3.6/site-packages/tornado/gen.py", line 1099, in run
        value = future.result()
      File "/anaconda/envs/py3/lib/python3.6/site-packages/tornado/gen.py", line 1113, in run
        yielded = self.gen.send(value)
      File "/anaconda/envs/py3/lib/python3.6/site-packages/notebook/services/sessions/handlers.py", line 67, in post
        model = yield gen.maybe_future(sm.get_session(path=path))
      File "/anaconda/envs/py3/lib/python3.6/site-packages/notebook/services/sessions/sessionmanager.py", line 170, in get_session
        return self.row_to_model(row)
      File "/anaconda/envs/py3/lib/python3.6/site-packages/notebook/services/sessions/sessionmanager.py", line 209, in row_to_model
        raise KeyError
    KeyError
[W 14:13:17.078 NotebookApp] Unhandled error

On page refresh everything works fine.

That trace points to this:

# The kernel was killed or died without deleting the session.
# We can't use delete_session here because that tries to find
# and shut down the kernel.

We cull idle notebooks after 24 hours. I don't know if that's related. Either way, is this the desired behavior, that they would just get a kernel error when they land on the page? Is there some way to avoid this or trigger auto-refresh of the session, etc.?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions