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

[notebook] Can't close a notebook without errors #3237

Closed
michaelaye opened this issue Apr 29, 2013 · 4 comments
Closed

[notebook] Can't close a notebook without errors #3237

michaelaye opened this issue Apr 29, 2013 · 4 comments
Labels
Milestone

Comments

@michaelaye
Copy link
Contributor

I start a notebook server with 'ipython notebook --pylab'.

When I am closing a notebook via File->Close and Halt, I am getting
almost always the following errors in my terminal:

[NotebookApp] Kernel started: 673e9899-6ec5-41b0-958e-f6c9cd573794
[NotebookApp] Connecting to: tcp://127.0.0.1:57981
[NotebookApp] Connecting to: tcp://127.0.0.1:57982
[NotebookApp] Connecting to: tcp://127.0.0.1:57984
[IPKernelApp] To connect another client to this kernel, use:
[IPKernelApp] --existing kernel-673e9899-6ec5-41b0-958e-f6c9cd573794.json

[NotebookApp] Kernel shutdown: 673e9899-6ec5-41b0-958e-f6c9cd573794
WARNING:root:Read error on 6: [Errno 54] Connection reset by peer
ERROR:root:Uncaught exception DELETE 
/kernels/673e9899-6ec5-41b0-958e-f6c9cd573794 (127.0.0.1)
HTTPRequest(protocol='http', host='127.0.0.1:8888', method='DELETE', 
uri='/kernels/673e9899-6ec5-41b0-958e-f6c9cd573794', 
version='HTTP/1.1', remote_ip='127.0.0.1', body='', headers={'Origin': 
'http://127.0.0.1:8888', 'Content-Length': '0', 'Accept-Language': 
'en-us', 'Accept-Encoding': 'gzip, deflate', 'Host': '127.0.0.1:8888', 
'Accept': '*/*', 'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 
10_8_3) AppleWebKit/536.28.10 (KHTML, like Gecko) Version/6.0.3 
Safari/536.28.10', 'Connection': 'keep-alive', 'X-Requested-With': 
'XMLHttpRequest', 'Referer': 
'http://127.0.0.1:8888/2761cf04-c906-4762-b69d-feba4ebf32f6'})
Traceback (most recent call last):
  File 
"/Library/Frameworks/EPD64.framework/Versions/7.3/lib/python2.7/site-packages/tornado/web.py", 
line 988, in _execute
    getattr(self, self.request.method.lower())(*args, **kwargs)
  File 
"/Library/Frameworks/EPD64.framework/Versions/7.3/lib/python2.7/site-packages/tornado/web.py", 
line 1739, in wrapper
    return method(self, *args, **kwargs)
  File 
"/Library/Frameworks/EPD64.framework/Versions/7.3/lib/python2.7/site-packages/IPython/frontend/html/notebook/handlers.py", 
line 351, in delete
    self.finish()
  File 
"/Library/Frameworks/EPD64.framework/Versions/7.3/lib/python2.7/site-packages/tornado/web.py", 
line 669, in finish
    self.request.finish()
  File 
"/Library/Frameworks/EPD64.framework/Versions/7.3/lib/python2.7/site-packages/tornado/httpserver.py", 
line 422, in finish
    self.connection.finish()
  File 
"/Library/Frameworks/EPD64.framework/Versions/7.3/lib/python2.7/site-packages/tornado/httpserver.py", 
line 186, in finish
    self._finish_request()
  File 
"/Library/Frameworks/EPD64.framework/Versions/7.3/lib/python2.7/site-packages/tornado/httpserver.py", 
line 222, in _finish_request
    self.stream.read_until(b("\r\n\r\n"), self._header_callback)
  File 
"/Library/Frameworks/EPD64.framework/Versions/7.3/lib/python2.7/site-packages/tornado/iostream.py", 
line 161, in read_until
    if self._read_to_buffer() == 0:
  File 
"/Library/Frameworks/EPD64.framework/Versions/7.3/lib/python2.7/site-packages/tornado/iostream.py", 
line 378, in _read_to_buffer
    chunk = self._read_from_socket()
  File 
"/Library/Frameworks/EPD64.framework/Versions/7.3/lib/python2.7/site-packages/tornado/iostream.py", 
line 359, in _read_from_socket
    chunk = self.socket.recv(self.read_chunk_size)
error: [Errno 54] Connection reset by peer
ERROR:root:Cannot send error response after headers written
ERROR:root:Uncaught exception, closing connection.
Traceback (most recent call last):
  File 
"/Library/Frameworks/EPD64.framework/Versions/7.3/lib/python2.7/site-packages/tornado/iostream.py", 
line 304, in wrapper
    callback(*args)
  File 
"/Library/Frameworks/EPD64.framework/Versions/7.3/lib/python2.7/site-packages/tornado/httpserver.py", 
line 280, in _on_request_body
    self.request_callback(self._request)
  File 
"/Library/Frameworks/EPD64.framework/Versions/7.3/lib/python2.7/site-packages/tornado/web.py", 
line 1362, in __call__
    handler._execute(transforms, *args, **kwargs)
  File 
"/Library/Frameworks/EPD64.framework/Versions/7.3/lib/python2.7/site-packages/tornado/web.py", 
line 992, in _execute
    self._handle_request_exception(e)
  File 
"/Library/Frameworks/EPD64.framework/Versions/7.3/lib/python2.7/site-packages/tornado/web.py", 
line 1032, in _handle_request_exception
    self.send_error(500, exc_info=sys.exc_info())
  File 
"/Library/Frameworks/EPD64.framework/Versions/7.3/lib/python2.7/site-packages/tornado/web.py", 
line 688, in send_error
    self.finish()
  File 
"/Library/Frameworks/EPD64.framework/Versions/7.3/lib/python2.7/site-packages/tornado/web.py", 
line 669, in finish
    self.request.finish()
  File 
"/Library/Frameworks/EPD64.framework/Versions/7.3/lib/python2.7/site-packages/tornado/httpserver.py", 
line 422, in finish
    self.connection.finish()
  File 
"/Library/Frameworks/EPD64.framework/Versions/7.3/lib/python2.7/site-packages/tornado/httpserver.py", 
line 183, in finish
    assert self._request, "Request closed"
AssertionError: Request closed
ERROR:root:Exception in callback 
<zmq.eventloop.stack_context._StackContextWrapper object at 0x108d45578>
Traceback (most recent call last):
  File 
"/Library/Frameworks/EPD64.framework/Versions/7.3/lib/python2.7/site-packages/zmq/eventloop/ioloop.py", 
line 440, in _run_callback
    callback()
  File 
"/Library/Frameworks/EPD64.framework/Versions/7.3/lib/python2.7/site-packages/tornado/iostream.py", 
line 304, in wrapper
    callback(*args)
  File 
"/Library/Frameworks/EPD64.framework/Versions/7.3/lib/python2.7/site-packages/tornado/httpserver.py", 
line 280, in _on_request_body
    self.request_callback(self._request)
  File 
"/Library/Frameworks/EPD64.framework/Versions/7.3/lib/python2.7/site-packages/tornado/web.py", 
line 1362, in __call__
    handler._execute(transforms, *args, **kwargs)
  File 
"/Library/Frameworks/EPD64.framework/Versions/7.3/lib/python2.7/site-packages/tornado/web.py", 
line 992, in _execute
    self._handle_request_exception(e)
  File 
"/Library/Frameworks/EPD64.framework/Versions/7.3/lib/python2.7/site-packages/tornado/web.py", 
line 1032, in _handle_request_exception
    self.send_error(500, exc_info=sys.exc_info())
  File 
"/Library/Frameworks/EPD64.framework/Versions/7.3/lib/python2.7/site-packages/tornado/web.py", 
line 688, in send_error
    self.finish()
  File 
"/Library/Frameworks/EPD64.framework/Versions/7.3/lib/python2.7/site-packages/tornado/web.py", 
line 669, in finish
    self.request.finish()
  File 
"/Library/Frameworks/EPD64.framework/Versions/7.3/lib/python2.7/site-packages/tornado/httpserver.py", 
line 422, in finish
    self.connection.finish()
  File 
"/Library/Frameworks/EPD64.framework/Versions/7.3/lib/python2.7/site-packages/tornado/httpserver.py", 
line 183, in finish
    assert self._request, "Request closed"
AssertionError: Request closed
WARNING:root:Read error on 35: [Errno 54] Connection reset by peer

I found this related question on SO:

http://stackoverflow.com/questions/6697322/tornado-ioerror-stream-is-closed-on-request-finish

The notebook is being closed alright and I get back to the dashboard.

Is there any way to stop this annoyance?

Michael

PS.: Am using IPython 0.13.2 from github, installed into an EPD 7.3-2,
calling it inside a iTerm2 terminal on Mac OSX 10.8.3.

@minrk
Copy link
Member

minrk commented Apr 29, 2013

We should wrap self.finish in a try/except on delete, so this doesn't happen.

@minrk
Copy link
Member

minrk commented Apr 29, 2013

what tornado version?

@michaelaye
Copy link
Contributor Author

In [3]: tornado.version
Out[3]: '2.2'

@michaelaye
Copy link
Contributor Author

I report that this issue is solved with tornado 3.1 and IPython master: 719de27

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

No branches or pull requests

2 participants