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

websocket closing and/or on-open error #104

Closed
ebrevdo opened this issue Feb 22, 2013 · 8 comments
Closed

websocket closing and/or on-open error #104

ebrevdo opened this issue Feb 22, 2013 · 8 comments

Comments

@ebrevdo
Copy link

ebrevdo commented Feb 22, 2013

On OS X, running emacs/ein via:

$ EMACS=/usr/local/Cellar/emacs/HEAD/Emacs.app/Contents/MacOS/Emacs lisp/zeroein.el

Steps to reproduce the problem

  1. Start emacs
  2. Run ein:notebooklist-open
  3. Select a notebook and hit "Open"

Expected output

The notebook opens, no error messages.

Your EIN configuration (in .emacs.d/init.el or somewhere else)

using zeroein

Your IPython configuration

  1. What is your IPython version? (run ipython --version):

$ ipython --version
0.13.1

  1. How do you start IPython? (e.g., ipython notebook --port 9999):

ipython notebook

  1. What is your IPython notebook port number or URL?:

localhost:8888

Additional information (if any)

ipython + zmq installed installed by pip. zeromq=3.2.2 installed via
brew (pyzmq uses this version). tornado in ipython version 2.4.1,
pyzmq version 13.0.0.

System info:

("EIN system info"
 :emacs-version
 "GNU Emacs 24.3.50.1 (i386-apple-darwin11.4.2, NS apple-appkit-1138.51)
 of 2013-02-21 on eugbook.local"
 :emacs-bzr-version nil
 :window-system ns
 :emacs-variant nil
 :os
 (:uname
  "Darwin eugbook.local 11.4.2 Darwin Kernel Version 11.4.2: Thu Aug 23 16:25:48 PDT 2012; root:xnu-1699.32.7~1/RELEASE_X86_64 x86_64
"
  :lsb-release nil)
 :image-types
 (png gif tiff jpeg xpm xbm pbm)
 :image-types-available
 (png gif tiff jpeg xpm xbm pbm)
 :request
 (:backend curl)
 :ein
 (:version "0.2.1alpha2.e5b53e5"
       :source-dir "/tmp/emacs-ipython-notebook/lisp/")
 :lib
 ((:name "websocket"
     :path "/tmp/emacs-ipython-notebook/lib/websocket/websocket.el"
     :featurep t
     :version-var websocket-version
     :version "0.93.1")
  (:name "request"
     :path "/tmp/emacs-ipython-notebook/lib/request/request.el"
     :featurep t
     :version-var request-version
     :version "0.2.0alpha1")
  (:name "auto-complete"
     :path "/tmp/emacs-ipython-notebook/lib/auto-complete/auto-complete.el"
     :featurep t
     :version-var nil
     :version nil)
  (:name "mumamo"
     :path "/tmp/emacs-ipython-notebook/lib/nxhtml/util/mumamo.el"
     :featurep nil
     :version-var nil
     :version nil)
  (:name "auto-complete"
     :path "/tmp/emacs-ipython-notebook/lib/auto-complete/auto-complete.el"
     :featurep t
     :version-var nil
     :version nil)
  (:name "popup"
     :path "/tmp/emacs-ipython-notebook/lib/popup/popup.el"
     :featurep t
     :version-var nil
     :version nil)
  (:name "fuzzy"
     :path "/tmp/emacs-ipython-notebook/lib/fuzzy/fuzzy.el"
     :featurep nil
     :version-var nil
     :version nil)
  (:name "pos-tip"
     :path "/tmp/emacs-ipython-notebook/lib/pos-tip/pos-tip.el"
     :featurep nil
     :version-var nil
     :version nil)
  (:name "python"
     :path "/tmp/emacs-ipython-notebook/lib/python/python.el"
     :featurep nil
     :version-var nil
     :version nil)
  (:name "markdown-mode"
     :path "/tmp/emacs-ipython-notebook/lib/markdown-mode/markdown-mode.el"
     :featurep nil
     :version-var nil
     :version nil)
  (:name "smartrep"
     :path "/tmp/emacs-ipython-notebook/lib/smartrep/smartrep.el"
     :featurep nil
     :version-var nil
     :version nil)))
  1. Log and Backtrace

Messages

debug-on-error=t websocket-debug=t websocket-callback-debug-on-error=nil ein:debug=t ein:log-level=debug ein:log-message-level=verbose
ein: [info] Opening notebook 62a49637-6b89-454d-bd2f-2ccf94e89fa1...
ein: [info] Worksheet Untitled0 is ready
Making mumamo-bug-3467-w14 local to temp while let-bound!
Tested for Bug 3467 => PASSED
ein: [info] Notebook Untitled0 is ready
ein: [info] Kernel started: bbbb69e9-11e1-4b50-ae1d-97f829d6a06b
ein: [info] Starting WS: "ws://127.0.0.1:8888/kernels/bbbb69e9-11e1-4b50-ae1d-97f829d6a06b"
Error found in callback on-open': [cl-struct-websocket-frame text {"header":{"msg_id":"ca13c350-904d-4d01-9c00-5704851e363d","username":"username","session":"c4df7ad1-167e-4eda-8e7e-b1f592d6e8d9","msg_type":"execute_request"},"metadata":{},"content":{"code":"__import__('sys').stdout.write(__import__('os').getcwd())","silent":true,"user_variables":[],"user_expressions":{},"allow_stdin":false},"parent_header":{}} nil t] Error found in callbackon-open': (ein:$websocket-onopen accessing a non-ein:$websocket)
Mark set [3 times]

websocket ws:///..../shell debug

[WS] Sending handshake, key: ZmplzHUA5XVNauqzmDppSA==, acceptance: j3zAZFvRpdQxQyRGIH7NORDvUfk=
[WS] Websocket opened
[WS] Received: HTTP/1.1 101 Switching Protocols
Upgrade: websocket
Connection: Upgrade
Sec-WebSocket-Accept: j3zAZFvRpdQxQyRGIH7NORDvUfk=

[WS] Checking for accept header: Sec-WebSocket-Accept: j3zAZFvRpdQxQyRGIH7NORDvUfk=
[WS] Checking for upgrade header
[WS] Checking for connection header
[WS] Sending frame, opcode: text payload: username=
[WS] Sending frame, opcode: text payload: {"header":{"msg_id":"ca13c350-904d-4d01-9c00-5704851e363d","username":"username","session":"c4df7ad1-167e-4eda-8e7e-b1f592d6e8d9","msg_type":"execute_request"},"metadata":{},"content":{"code":"import('sys').stdout.write(import('os').getcwd())","silent":true,"user_variables":[],"user_expressions":{},"allow_stdin":false},"parent_header":{}}
[WS] Closing websocket
[WS] State change to deleted

[WS] Sending handshake, key: IfcUBziTB2WzxAzQkfbczg==, acceptance: JC5x68G56ATrQ6hOHzc5aREqIZc=
[WS] Websocket opened
[WS] Received: HTTP/1.1 101 Switching Protocols
Upgrade: websocket
Connection: Upgrade
Sec-WebSocket-Accept: JC5x68G56ATrQ6hOHzc5aREqIZc=

[WS] Checking for accept header: Sec-WebSocket-Accept: JC5x68G56ATrQ6hOHzc5aREqIZc=
[WS] Checking for upgrade header
[WS] Checking for connection header

@tkf
Copy link
Owner

tkf commented Feb 22, 2013

Hmm... I guess this one will be difficult to debug. Can you try again with C-u M-x ein:dev-start-debug (with the universal prefix key C-u this time)? I think you will get a backtrace. Please paste it here.

@ebrevdo
Copy link
Author

ebrevdo commented Feb 22, 2013

Here's the backtrace:

Debugger entered--Lisp error: (websocket-closed . [cl-struct-websocket-frame text "{\"header\":{\"msg_id\":\"f78b0588-7ea8-4821-b6df-a7a44d2e5568\",\"username\":\"username\",\"session\":\"38e0581a-3a4e-430e-9d4a-0775ef025c8d\",\"msg_type\":\"execute_request\"},\"metadata\":{},\"content\":{\"code\":\"__import__('sys').stdout.write(__import__('os').getcwd())\",\"silent\":true,\"user_variables\":[],\"user_expressions\":{},\"allow_stdin\":false},\"parent_header\":{}}" nil t])
  signal(websocket-closed [cl-struct-websocket-frame text "{\"header\":{\"msg_id\":\"f78b0588-7ea8-4821-b6df-a7a44d2e5568\",\"username\":\"username\",\"session\":\"38e0581a-3a4e-430e-9d4a-0775ef025c8d\",\"msg_type\":\"execute_request\"},\"metadata\":{},\"content\":{\"code\":\"__import__('sys').stdout.write(__import__('os').getcwd())\",\"silent\":true,\"user_variables\":[],\"user_expressions\":{},\"allow_stdin\":false},\"parent_header\":{}}" nil t])
  (if ... nil ...)
  websocket-send([cl-struct-websocket open [cl-struct-ein:$websocket #0 ... nil ein:kernel--ws-closed-callback ... ... nil nil] ... ... ... websocket-default-error-handler nil nil nil "ws://127.0.0.1:8888/kernels/bbbb69e9-11e1-4b50-ae1d-97f829d6a06b/shell" nil nil #<process websocket to ws://127.0.0.1:8888/kernels/bbbb69e9-11e1-4b50-ae1d-97f829d6a06b/shell> nil "mIfpALeoarjg7JP8/W9C5g0a40Q=" nil] [cl-struct-websocket-frame text "{\"header\":{\"msg_id\":\"f78b0588-7ea8-4821-b6df-a7a44d2e5568\",\"username\":\"username\",\"session\":\"38e0581a-3a4e-430e-9d4a-0775ef025c8d\",\"msg_type\":\"execute_request\"},\"metadata\":{},\"content\":{\"code\":\"__import__('sys').stdout.write(__import__('os').getcwd())\",\"silent\":true,\"user_variables\":[],\"user_expressions\":{},\"allow_stdin\":false},\"parent_header\":{}}" nil t])
  websocket-send-text([cl-struct-websocket open [cl-struct-ein:$websocket #0 ... nil ein:kernel--ws-closed-callback ... ... nil nil] ... ... ... websocket-default-error-handler nil nil nil "ws://127.0.0.1:8888/kernels/bbbb69e9-11e1-4b50-ae1d-97f829d6a06b/shell" nil nil #<process websocket to ws://127.0.0.1:8888/kernels/bbbb69e9-11e1-4b50-ae1d-97f829d6a06b/shell> nil "mIfpALeoarjg7JP8/W9C5g0a40Q=" nil] "{\"header\":{\"msg_id\":\"f78b0588-7ea8-4821-b6df-a7a44d2e5568\",\"username\":\"username\",\"session\":\"38e0581a-3a4e-430e-9d4a-0775ef025c8d\",\"msg_type\":\"execute_request\"},\"metadata\":{},\"content\":{\"code\":\"__import__('sys').stdout.write(__import__('os').getcwd())\",\"silent\":true,\"user_variables\":[],\"user_expressions\":{},\"allow_stdin\":false},\"parent_header\":{}}")
  ein:websocket-send([cl-struct-ein:$websocket [cl-struct-websocket open #0 ... ... ... websocket-default-error-handler nil nil nil "ws://127.0.0.1:8888/kernels/bbbb69e9-11e1-4b50-ae1d-97f829d6a06b/shell" nil nil #<process websocket to ws://127.0.0.1:8888/kernels/bbbb69e9-11e1-4b50-ae1d-97f829d6a06b/shell> nil "mIfpALeoarjg7JP8/W9C5g0a40Q=" nil] ... nil ein:kernel--ws-closed-callback ... ... nil nil] "{\"header\":{\"msg_id\":\"f78b0588-7ea8-4821-b6df-a7a44d2e5568\",\"username\":\"username\",\"session\":\"38e0581a-3a4e-430e-9d4a-0775ef025c8d\",\"msg_type\":\"execute_request\"},\"metadata\":{},\"content\":{\"code\":\"__import__('sys').stdout.write(__import__('os').getcwd())\",\"silent\":true,\"user_variables\":[],\"user_expressions\":{},\"allow_stdin\":false},\"parent_header\":{}}")
  (let* ... ... ... ... msg-id)
  (progn ... ...)
  (let* ... ... ...)
  ein:kernel-execute([cl-struct-ein:$kernel 8888 [object ein:events "ein:events" #s(hash-table size 65 test eq rehash-size 1.5 rehash-threshold 0.8 data (maybe_reset_undo\.Worksheet ... set_next_input\.Worksheet ... set_dirty\.Worksheet ... open_with_text\.Pager ... status_idle\.Kernel ... status_busy\.Kernel ... status_dead\.Kernel ... notebook_saving\.Notebook ... notebook_saved\.Notebook ... notebook_save_failed\.Notebook ... execution_count\.Kernel ... status_restarting\.Kernel ... ...))] "bbbb69e9-11e1-4b50-ae1d-97f829d6a06b" [cl-struct-ein:$websocket [cl-struct-websocket open #1 ... ... ... websocket-default-error-handler nil nil nil "ws://127.0.0.1:8888/kernels/bbbb69e9-11e1-4b50-ae1d-97f829d6a06b/shell" nil nil #<process websocket to ws://127.0.0.1:8888/kernels/bbbb69e9-11e1-4b50-ae1d-97f829d6a06b/shell> nil "mIfpALeoarjg7JP8/W9C5g0a40Q=" nil] ... nil ein:kernel--ws-closed-callback ... ... nil nil] [cl-struct-ein:$websocket [cl-struct-websocket open #1 ... ... ... websocket-default-error-handler nil nil nil "ws://127.0.0.1:8888/kernels/bbbb69e9-11e1-4b50-ae1d-97f829d6a06b/iopub" nil nil #<process websocket to ws://127.0.0.1:8888/kernels/bbbb69e9-11e1-4b50-ae1d-97f829d6a06b/iopub> nil "YGKj8YOByrL0iQSAr2TIWDcMQVs=" nil] ... nil ein:kernel--ws-closed-callback ... ... nil nil] "/kernels" "/kernels/bbbb69e9-11e1-4b50-ae1d-97f829d6a06b" "ws://127.0.0.1:8888" t "username" "38e0581a-3a4e-430e-9d4a-0775ef025c8d" #s(hash-table size 65 test equal rehash-size 1.5 rehash-threshold 0.8 data ( ...)) ... ...] "__import__('sys').stdout.write(__import__('os').getcwd())" (:output ...))
  ein:kernel-request-stream([cl-struct-ein:$kernel 8888 [object ein:events "ein:events" #s(hash-table size 65 test eq rehash-size 1.5 rehash-threshold 0.8 data (maybe_reset_undo\.Worksheet ... set_next_input\.Worksheet ... set_dirty\.Worksheet ... open_with_text\.Pager ... status_idle\.Kernel ... status_busy\.Kernel ... status_dead\.Kernel ... notebook_saving\.Notebook ... notebook_saved\.Notebook ... notebook_save_failed\.Notebook ... execution_count\.Kernel ... status_restarting\.Kernel ... ...))] "bbbb69e9-11e1-4b50-ae1d-97f829d6a06b" [cl-struct-ein:$websocket [cl-struct-websocket open #1 ... ... ... websocket-default-error-handler nil nil nil "ws://127.0.0.1:8888/kernels/bbbb69e9-11e1-4b50-ae1d-97f829d6a06b/shell" nil nil #<process websocket to ws://127.0.0.1:8888/kernels/bbbb69e9-11e1-4b50-ae1d-97f829d6a06b/shell> nil "mIfpALeoarjg7JP8/W9C5g0a40Q=" nil] ... nil ein:kernel--ws-closed-callback ... ... nil nil] [cl-struct-ein:$websocket [cl-struct-websocket open #1 ... ... ... websocket-default-error-handler nil nil nil "ws://127.0.0.1:8888/kernels/bbbb69e9-11e1-4b50-ae1d-97f829d6a06b/iopub" nil nil #<process websocket to ws://127.0.0.1:8888/kernels/bbbb69e9-11e1-4b50-ae1d-97f829d6a06b/iopub> nil "YGKj8YOByrL0iQSAr2TIWDcMQVs=" nil] ... nil ein:kernel--ws-closed-callback ... ... nil nil] "/kernels" "/kernels/bbbb69e9-11e1-4b50-ae1d-97f829d6a06b" "ws://127.0.0.1:8888" t "username" "38e0581a-3a4e-430e-9d4a-0775ef025c8d" #s(hash-table size 65 test equal rehash-size 1.5 rehash-threshold 0.8 data ( ...)) ... ...] "__import__('sys').stdout.write(__import__('os').getcwd())" (lambda ... ...) ([object ein:kernelinfo "ein:kernelinfo" [cl-struct-ein:$kernel 8888 [object ein:events "ein:events" #s(hash-table size 65 test eq rehash-size 1.5 rehash-threshold 0.8 data (maybe_reset_undo\.Worksheet ... set_next_input\.Worksheet ... set_dirty\.Worksheet ... open_with_text\.Pager ... status_idle\.Kernel ... status_busy\.Kernel ... status_dead\.Kernel ... notebook_saving\.Notebook ... notebook_saved\.Notebook ... notebook_save_failed\.Notebook ... execution_count\.Kernel ... status_restarting\.Kernel ... ...))] "bbbb69e9-11e1-4b50-ae1d-97f829d6a06b" [cl-struct-ein:$websocket [cl-struct-websocket open #3 ... ... ... websocket-default-error-handler nil nil nil "ws://127.0.0.1:8888/kernels/bbbb69e9-11e1-4b50-ae1d-97f829d6a06b/shell" nil nil #<process websocket to ws://127.0.0.1:8888/kernels/bbbb69e9-11e1-4b50-ae1d-97f829d6a06b/shell> nil "mIfpALeoarjg7JP8/W9C5g0a40Q=" nil] ... nil ein:kernel--ws-closed-callback ... ... nil nil] [cl-struct-ein:$websocket [cl-struct-websocket open #3 ... ... ... websocket-default-error-handler nil nil nil "ws://127.0.0.1:8888/kernels/bbbb69e9-11e1-4b50-ae1d-97f829d6a06b/iopub" nil nil #<process websocket to ws://127.0.0.1:8888/kernels/bbbb69e9-11e1-4b50-ae1d-97f829d6a06b/iopub> nil "YGKj8YOByrL0iQSAr2TIWDcMQVs=" nil] ... nil ein:kernel--ws-closed-callback ... ... nil nil] "/kernels" "/kernels/bbbb69e9-11e1-4b50-ae1d-97f829d6a06b" "ws://127.0.0.1:8888" t "username" "38e0581a-3a4e-430e-9d4a-0775ef025c8d" #s(hash-table size 65 test equal rehash-size 1.5 rehash-threshold 0.8 data ( ...)) ... ...] ... unbound unbound]))
  ein:kernelinfo-update-ccwd([object ein:kernelinfo "ein:kernelinfo" [cl-struct-ein:$kernel 8888 [object ein:events "ein:events" #s(hash-table size 65 test eq rehash-size 1.5 rehash-threshold 0.8 data (maybe_reset_undo\.Worksheet ... set_next_input\.Worksheet ... set_dirty\.Worksheet ... open_with_text\.Pager ... status_idle\.Kernel ... status_busy\.Kernel ... status_dead\.Kernel ... notebook_saving\.Notebook ... notebook_saved\.Notebook ... notebook_save_failed\.Notebook ... execution_count\.Kernel ... status_restarting\.Kernel ... ...))] "bbbb69e9-11e1-4b50-ae1d-97f829d6a06b" [cl-struct-ein:$websocket [cl-struct-websocket open #2 ... ... ... websocket-default-error-handler nil nil nil "ws://127.0.0.1:8888/kernels/bbbb69e9-11e1-4b50-ae1d-97f829d6a06b/shell" nil nil #<process websocket to ws://127.0.0.1:8888/kernels/bbbb69e9-11e1-4b50-ae1d-97f829d6a06b/shell> nil "mIfpALeoarjg7JP8/W9C5g0a40Q=" nil] ... nil ein:kernel--ws-closed-callback ... ... nil nil] [cl-struct-ein:$websocket [cl-struct-websocket open #2 ... ... ... websocket-default-error-handler nil nil nil "ws://127.0.0.1:8888/kernels/bbbb69e9-11e1-4b50-ae1d-97f829d6a06b/iopub" nil nil #<process websocket to ws://127.0.0.1:8888/kernels/bbbb69e9-11e1-4b50-ae1d-97f829d6a06b/iopub> nil "YGKj8YOByrL0iQSAr2TIWDcMQVs=" nil] ... nil ein:kernel--ws-closed-callback ... ... nil nil] "/kernels" "/kernels/bbbb69e9-11e1-4b50-ae1d-97f829d6a06b" "ws://127.0.0.1:8888" t "username" "38e0581a-3a4e-430e-9d4a-0775ef025c8d" #s(hash-table size 65 test equal rehash-size 1.5 rehash-threshold 0.8 data ( ...)) ... ...] ... unbound unbound])
  ein:kernelinfo-update-all([object ein:kernelinfo "ein:kernelinfo" [cl-struct-ein:$kernel 8888 [object ein:events "ein:events" #s(hash-table size 65 test eq rehash-size 1.5 rehash-threshold 0.8 data (maybe_reset_undo\.Worksheet ... set_next_input\.Worksheet ... set_dirty\.Worksheet ... open_with_text\.Pager ... status_idle\.Kernel ... status_busy\.Kernel ... status_dead\.Kernel ... notebook_saving\.Notebook ... notebook_saved\.Notebook ... notebook_save_failed\.Notebook ... execution_count\.Kernel ... status_restarting\.Kernel ... ...))] "bbbb69e9-11e1-4b50-ae1d-97f829d6a06b" [cl-struct-ein:$websocket [cl-struct-websocket open #2 ... ... ... websocket-default-error-handler nil nil nil "ws://127.0.0.1:8888/kernels/bbbb69e9-11e1-4b50-ae1d-97f829d6a06b/shell" nil nil #<process websocket to ws://127.0.0.1:8888/kernels/bbbb69e9-11e1-4b50-ae1d-97f829d6a06b/shell> nil "mIfpALeoarjg7JP8/W9C5g0a40Q=" nil] ... nil ein:kernel--ws-closed-callback ... ... nil nil] [cl-struct-ein:$websocket [cl-struct-websocket open #2 ... ... ... websocket-default-error-handler nil nil nil "ws://127.0.0.1:8888/kernels/bbbb69e9-11e1-4b50-ae1d-97f829d6a06b/iopub" nil nil #<process websocket to ws://127.0.0.1:8888/kernels/bbbb69e9-11e1-4b50-ae1d-97f829d6a06b/iopub> nil "YGKj8YOByrL0iQSAr2TIWDcMQVs=" nil] ... nil ein:kernel--ws-closed-callback ... ... nil nil] "/kernels" "/kernels/bbbb69e9-11e1-4b50-ae1d-97f829d6a06b" "ws://127.0.0.1:8888" t "username" "38e0581a-3a4e-430e-9d4a-0775ef025c8d" #s(hash-table size 65 test equal rehash-size 1.5 rehash-threshold 0.8 data ( ...)) ... ...] ... unbound unbound])
  apply(ein:kernelinfo-update-all [object ein:kernelinfo "ein:kernelinfo" [cl-struct-ein:$kernel 8888 [object ein:events "ein:events" #s(hash-table size 65 test eq rehash-size 1.5 rehash-threshold 0.8 data (maybe_reset_undo\.Worksheet ... set_next_input\.Worksheet ... set_dirty\.Worksheet ... open_with_text\.Pager ... status_idle\.Kernel ... status_busy\.Kernel ... status_dead\.Kernel ... notebook_saving\.Notebook ... notebook_saved\.Notebook ... notebook_save_failed\.Notebook ... execution_count\.Kernel ... status_restarting\.Kernel ... ...))] "bbbb69e9-11e1-4b50-ae1d-97f829d6a06b" [cl-struct-ein:$websocket [cl-struct-websocket open #2 ... ... ... websocket-default-error-handler nil nil nil "ws://127.0.0.1:8888/kernels/bbbb69e9-11e1-4b50-ae1d-97f829d6a06b/shell" nil nil #<process websocket to ws://127.0.0.1:8888/kernels/bbbb69e9-11e1-4b50-ae1d-97f829d6a06b/shell> nil "mIfpALeoarjg7JP8/W9C5g0a40Q=" nil] ... nil ein:kernel--ws-closed-callback ... ... nil nil] [cl-struct-ein:$websocket [cl-struct-websocket open #2 ... ... ... websocket-default-error-handler nil nil nil "ws://127.0.0.1:8888/kernels/bbbb69e9-11e1-4b50-ae1d-97f829d6a06b/iopub" nil nil #<process websocket to ws://127.0.0.1:8888/kernels/bbbb69e9-11e1-4b50-ae1d-97f829d6a06b/iopub> nil "YGKj8YOByrL0iQSAr2TIWDcMQVs=" nil] ... nil ein:kernel--ws-closed-callback ... ... nil nil] "/kernels" "/kernels/bbbb69e9-11e1-4b50-ae1d-97f829d6a06b" "ws://127.0.0.1:8888" t "username" "38e0581a-3a4e-430e-9d4a-0775ef025c8d" #s(hash-table size 65 test equal rehash-size 1.5 rehash-threshold 0.8 data ( ...)) ... ...] ... unbound unbound] nil)
  ein:funcall-packed((ein:kernelinfo-update-all . [object ein:kernelinfo "ein:kernelinfo" [cl-struct-ein:$kernel 8888 [object ein:events "ein:events" #s(hash-table size 65 test eq rehash-size 1.5 rehash-threshold 0.8 data (maybe_reset_undo\.Worksheet ... set_next_input\.Worksheet ... set_dirty\.Worksheet ... open_with_text\.Pager ... status_idle\.Kernel ... status_busy\.Kernel ... status_dead\.Kernel ... notebook_saving\.Notebook ... notebook_saved\.Notebook ... notebook_save_failed\.Notebook ... execution_count\.Kernel ... status_restarting\.Kernel ... ...))] "bbbb69e9-11e1-4b50-ae1d-97f829d6a06b" [cl-struct-ein:$websocket [cl-struct-websocket open #3 ... ... ... websocket-default-error-handler nil nil nil "ws://127.0.0.1:8888/kernels/bbbb69e9-11e1-4b50-ae1d-97f829d6a06b/shell" nil nil #<process websocket to ws://127.0.0.1:8888/kernels/bbbb69e9-11e1-4b50-ae1d-97f829d6a06b/shell> nil "mIfpALeoarjg7JP8/W9C5g0a40Q=" nil] ... nil ein:kernel--ws-closed-callback ... ... nil nil] [cl-struct-ein:$websocket [cl-struct-websocket open #3 ... ... ... websocket-default-error-handler nil nil nil "ws://127.0.0.1:8888/kernels/bbbb69e9-11e1-4b50-ae1d-97f829d6a06b/iopub" nil nil #<process websocket to ws://127.0.0.1:8888/kernels/bbbb69e9-11e1-4b50-ae1d-97f829d6a06b/iopub> nil "YGKj8YOByrL0iQSAr2TIWDcMQVs=" nil] ... nil ein:kernel--ws-closed-callback ... ... nil nil] "/kernels" "/kernels/bbbb69e9-11e1-4b50-ae1d-97f829d6a06b" "ws://127.0.0.1:8888" t "username" "38e0581a-3a4e-430e-9d4a-0775ef025c8d" #s(hash-table size 65 test equal rehash-size 1.5 rehash-threshold 0.8 data ( ...)) ... ...] ... unbound unbound]))
  mapc(ein:funcall-packed (... ...))
  ein:kernel-run-after-start-hook([cl-struct-ein:$kernel 8888 [object ein:events "ein:events" #s(hash-table size 65 test eq rehash-size 1.5 rehash-threshold 0.8 data (maybe_reset_undo\.Worksheet ... set_next_input\.Worksheet ... set_dirty\.Worksheet ... open_with_text\.Pager ... status_idle\.Kernel ... status_busy\.Kernel ... status_dead\.Kernel ... notebook_saving\.Notebook ... notebook_saved\.Notebook ... notebook_save_failed\.Notebook ... execution_count\.Kernel ... status_restarting\.Kernel ... ...))] "bbbb69e9-11e1-4b50-ae1d-97f829d6a06b" [cl-struct-ein:$websocket [cl-struct-websocket open #1 ... ... ... websocket-default-error-handler nil nil nil "ws://127.0.0.1:8888/kernels/bbbb69e9-11e1-4b50-ae1d-97f829d6a06b/shell" nil nil #<process websocket to ws://127.0.0.1:8888/kernels/bbbb69e9-11e1-4b50-ae1d-97f829d6a06b/shell> nil "mIfpALeoarjg7JP8/W9C5g0a40Q=" nil] ... nil ein:kernel--ws-closed-callback ... ... nil nil] [cl-struct-ein:$websocket [cl-struct-websocket open #1 ... ... ... websocket-default-error-handler nil nil nil "ws://127.0.0.1:8888/kernels/bbbb69e9-11e1-4b50-ae1d-97f829d6a06b/iopub" nil nil #<process websocket to ws://127.0.0.1:8888/kernels/bbbb69e9-11e1-4b50-ae1d-97f829d6a06b/iopub> nil "YGKj8YOByrL0iQSAr2TIWDcMQVs=" nil] ... nil ein:kernel--ws-closed-callback ... ... nil nil] "/kernels" "/kernels/bbbb69e9-11e1-4b50-ae1d-97f829d6a06b" "ws://127.0.0.1:8888" t "username" "38e0581a-3a4e-430e-9d4a-0775ef025c8d" #s(hash-table size 65 test equal rehash-size 1.5 rehash-threshold 0.8 data ( ...)) ... ...])
  (progn ...)
  (if ... ...)
  (lambda ... ... ...)(--host-- --kernel-- --channel--)
  apply((lambda ... ... ...) --host-- --kernel-- --channel-- nil)
  (lambda ... ...)()
  apply((lambda ... ...) nil)
  (if it ...)
  (let ... ...)
  (let ... ...)
  (lambda ... ...)([cl-struct-websocket open [cl-struct-ein:$websocket #0 ... nil ein:kernel--ws-closed-callback ... ... nil nil] ... ... ... websocket-default-error-handler nil nil nil "ws://127.0.0.1:8888/kernels/bbbb69e9-11e1-4b50-ae1d-97f829d6a06b/iopub" nil nil #<process websocket to ws://127.0.0.1:8888/kernels/bbbb69e9-11e1-4b50-ae1d-97f829d6a06b/iopub> nil "YGKj8YOByrL0iQSAr2TIWDcMQVs=" nil])
  apply((lambda ... ...) [cl-struct-websocket open [cl-struct-ein:$websocket #0 ... nil ein:kernel--ws-closed-callback ... ... nil nil] ... ... ... websocket-default-error-handler nil nil nil "ws://127.0.0.1:8888/kernels/bbbb69e9-11e1-4b50-ae1d-97f829d6a06b/iopub" nil nil #<process websocket to ws://127.0.0.1:8888/kernels/bbbb69e9-11e1-4b50-ae1d-97f829d6a06b/iopub> nil "YGKj8YOByrL0iQSAr2TIWDcMQVs=" nil])
  (condition-case err ... ...)
  (if websocket-callback-debug-on-error ... ...)
  (let ... ... ...)
  websocket-try-callback(websocket-on-open on-open [cl-struct-websocket open [cl-struct-ein:$websocket #0 ... nil ein:kernel--ws-closed-callback ... ... nil nil] ... ... ... websocket-default-error-handler nil nil nil "ws://127.0.0.1:8888/kernels/bbbb69e9-11e1-4b50-ae1d-97f829d6a06b/iopub" nil nil #<process websocket to ws://127.0.0.1:8888/kernels/bbbb69e9-11e1-4b50-ae1d-97f829d6a06b/iopub> nil "YGKj8YOByrL0iQSAr2TIWDcMQVs=" nil])
  (progn ... ... ...)
  (if ... ...)
  (let ... ... ... ...)
  websocket-outer-filter([cl-struct-websocket open [cl-struct-ein:$websocket #0 ... nil ein:kernel--ws-closed-callback ... ... nil nil] ... ... ... websocket-default-error-handler nil nil nil "ws://127.0.0.1:8888/kernels/bbbb69e9-11e1-4b50-ae1d-97f829d6a06b/iopub" nil nil #<process websocket to ws://127.0.0.1:8888/kernels/bbbb69e9-11e1-4b50-ae1d-97f829d6a06b/iopub> nil "YGKj8YOByrL0iQSAr2TIWDcMQVs=" nil] "HTTP/1.1 101 Switching Protocols
\nUpgrade: websocket
\nConnection: Upgrade
\nSec-WebSocket-Accept: YGKj8YOByrL0iQSAr2TIWDcMQVs=
\n
\n")
  (let ... ...)
  (lambda ... ...)(#<process websocket to ws://127.0.0.1:8888/kernels/bbbb69e9-11e1-4b50-ae1d-97f829d6a06b/iopub> "HTTP/1.1 101 Switching Protocols
\nUpgrade: websocket
\nConnection: Upgrade
\nSec-WebSocket-Accept: YGKj8YOByrL0iQSAr2TIWDcMQVs=
\n
\n")

Here's the websocket shell debug:

[WS] Sending handshake, key: CyJnm9p1cLD0jUR4rxaQ7A==, acceptance: mIfpALeoarjg7JP8/W9C5g0a40Q=
[WS] Websocket opened
[WS] Received: HTTP/1.1 101 Switching Protocols
Upgrade: websocket
Connection: Upgrade
Sec-WebSocket-Accept: mIfpALeoarjg7JP8/W9C5g0a40Q=


[WS] Checking for accept header: Sec-WebSocket-Accept: mIfpALeoarjg7JP8/W9C5g0a40Q=
[WS] Checking for upgrade header
[WS] Checking for connection header
[WS] Sending frame, opcode: text payload: username=
[WS] Sending frame, opcode: text payload: {"header":{"msg_id":"f78b0588-7ea8-4821-b6df-a7a44d2e5568","username":"username","session":"38e0581a-3a4e-430e-9d4a-0775ef025c8d","msg_type":"execute_request"},"metadata":{},"content":{"code":"__import__('sys').stdout.write(__import__('os').getcwd())","silent":true,"user_variables":[],"user_expressions":{},"allow_stdin":false},"parent_header":{}}
[WS] Closing websocket
[WS] State change to deleted

[WS] Sending handshake, key: dSC1ld/DadstRghnU0fezQ==, acceptance: 68PV+c4jKqWUIu78YIKhlzj6bEo=
[WS] Websocket opened
[WS] Received: HTTP/1.1 101 Switching Protocols
Upgrade: websocket
Connection: Upgrade
Sec-WebSocket-Accept: 68PV+c4jKqWUIu78YIKhlzj6bEo=


[WS] Checking for accept header: Sec-WebSocket-Accept: 68PV+c4jKqWUIu78YIKhlzj6bEo=
[WS] Checking for upgrade header
[WS] Checking for connection header

@tkf
Copy link
Owner

tkf commented Feb 23, 2013

Please use triple backquotes when pasting backtrace and logs, otherwise they are not readable. I edited your comment above.

You should have two WS logs "shell" and "iopub". You can open them using ein:dev-pop-to-debug-shell and ein:dev-pop-to-debug-iopub. I suppose you pasted shell one. Can you paste the iopub one (or both and backtrace, if you already closed the Emacs process)?

But I don't know what is happning here. websocket-closed error is raised even though websocket-send is called from on-open callback.

Here is a somewhat brute force fix. What happens if you evaluate the following and then open the notebook? Do you still get the error?

(defun ein:kernelinfo-new (kernel get-buffers)
  )

This code just skips extra stuff going on in on-open callback. Normally you should be able to use EIN without steps in this function.

@ebrevdo
Copy link
Author

ebrevdo commented Feb 23, 2013

Here's the iopub debug:

[WS] Sending handshake, key: 8CjdFVYxW/zgzfma37hEng==, acceptance: YGKj8YOByrL0iQSAr2TIWDcMQVs=
[WS] Websocket opened
[WS] Received: HTTP/1.1 101 Switching Protocols
Upgrade: websocket
Connection: Upgrade
Sec-WebSocket-Accept: YGKj8YOByrL0iQSAr2TIWDcMQVs=


[WS] Checking for accept header: Sec-WebSocket-Accept: YGKj8YOByrL0iQSAr2TIWDcMQVs=
[WS] Checking for upgrade header
[WS] Checking for connection header
[WS] Sending frame, opcode: text payload: username=

When I create an empty kernelinfo-new, here's the new backtrace:

Debugger entered--Lisp error: (error "ein:$websocket-onclose accessing a non-ein:$websocket")
  signal(error ("ein:$websocket-onclose accessing a non-ein:$websocket"))
  error("%s accessing a non-%s" ein:$websocket-onclose ein:$websocket)
  (or ... ...)
  (progn ... ...)
  (let ... ...)
  (let ... ...)
  (lambda ... ...)([cl-struct-websocket open nil ... ... ... websocket-default-error-handler nil nil nil "ws://127.0.0.1:8888/kernels/bbbb69e9-11e1-4b50-ae1d-97f829d6a06b/shell" nil nil #<process websocket to ws://127.0.0.1:8888/kernels/bbbb69e9-11e1-4b50-ae1d-97f829d6a06b/shell> nil "KK/EAyM/9UTFGhJjgv4jbrJcFHo=" nil])
  apply((lambda ... ...) [cl-struct-websocket open nil ... ... ... websocket-default-error-handler nil nil nil "ws://127.0.0.1:8888/kernels/bbbb69e9-11e1-4b50-ae1d-97f829d6a06b/shell" nil nil #<process websocket to ws://127.0.0.1:8888/kernels/bbbb69e9-11e1-4b50-ae1d-97f829d6a06b/shell> nil "KK/EAyM/9UTFGhJjgv4jbrJcFHo=" nil])
  (condition-case err ... ...)
  (if websocket-callback-debug-on-error ... ...)
  (let ... ... ...)
  websocket-try-callback(websocket-on-close on-close [cl-struct-websocket open nil ... ... ... websocket-default-error-handler nil nil nil "ws://127.0.0.1:8888/kernels/bbbb69e9-11e1-4b50-ae1d-97f829d6a06b/shell" nil nil #<process websocket to ws://127.0.0.1:8888/kernels/bbbb69e9-11e1-4b50-ae1d-97f829d6a06b/shell> nil "KK/EAyM/9UTFGhJjgv4jbrJcFHo=" nil])
  (if ... nil ...)
  (let ... ... ...)
  (lambda ... ...)(#<process websocket to ws://127.0.0.1:8888/kernels/bbbb69e9-11e1-4b50-ae1d-97f829d6a06b/shell> "deleted\n")
  kill-buffer(#<buffer  *websocket to ws://127.0.0.1:8888/kernels/bbbb69e9-11e1-4b50-ae1d-97f829d6a06b/shell*>)
  (let ... ... ...)
  websocket-close([cl-struct-websocket open [cl-struct-ein:$websocket #0 ... nil ein:kernel--ws-closed-callback ... ... nil nil] ... ... ... websocket-default-error-handler nil nil nil "ws://127.0.0.1:8888/kernels/bbbb69e9-11e1-4b50-ae1d-97f829d6a06b/shell" nil nil #<process websocket to ws://127.0.0.1:8888/kernels/bbbb69e9-11e1-4b50-ae1d-97f829d6a06b/shell<1>> nil "zYZQQL8oEhePmFXWEgXqCzAONb8=" nil])
  (if ... nil ... ...)
  websocket-ensure-connected([cl-struct-websocket open [cl-struct-ein:$websocket #0 ... nil ein:kernel--ws-closed-callback ... ... nil nil] ... ... ... websocket-default-error-handler nil nil nil "ws://127.0.0.1:8888/kernels/bbbb69e9-11e1-4b50-ae1d-97f829d6a06b/shell" nil nil #<process websocket to ws://127.0.0.1:8888/kernels/bbbb69e9-11e1-4b50-ae1d-97f829d6a06b/shell<1>> nil "zYZQQL8oEhePmFXWEgXqCzAONb8=" nil])
  websocket-send([cl-struct-websocket open [cl-struct-ein:$websocket #0 ... nil ein:kernel--ws-closed-callback ... ... nil nil] ... ... ... websocket-default-error-handler nil nil nil "ws://127.0.0.1:8888/kernels/bbbb69e9-11e1-4b50-ae1d-97f829d6a06b/shell" nil nil #<process websocket to ws://127.0.0.1:8888/kernels/bbbb69e9-11e1-4b50-ae1d-97f829d6a06b/shell<1>> nil "zYZQQL8oEhePmFXWEgXqCzAONb8=" nil] [cl-struct-websocket-frame text "{\"header\":{\"msg_id\":\"ab0ee531-54b5-4436-ae71-e06f2fdfcf90\",\"username\":\"username\",\"session\":\"08cd602f-28c5-4261-bfb4-734f18564c7a\",\"msg_type\":\"execute_request\"},\"metadata\":{},\"content\":{\"code\":\"__import__('sys').path.append('\\/tmp\\/emacs-ipython-notebook\\/lisp\\/')\",\"silent\":true,\"user_variables\":[],\"user_expressions\":{},\"allow_stdin\":false},\"parent_header\":{}}" nil t])
  websocket-send-text([cl-struct-websocket open [cl-struct-ein:$websocket #0 ... nil ein:kernel--ws-closed-callback ... ... nil nil] ... ... ... websocket-default-error-handler nil nil nil "ws://127.0.0.1:8888/kernels/bbbb69e9-11e1-4b50-ae1d-97f829d6a06b/shell" nil nil #<process websocket to ws://127.0.0.1:8888/kernels/bbbb69e9-11e1-4b50-ae1d-97f829d6a06b/shell<1>> nil "zYZQQL8oEhePmFXWEgXqCzAONb8=" nil] "{\"header\":{\"msg_id\":\"ab0ee531-54b5-4436-ae71-e06f2fdfcf90\",\"username\":\"username\",\"session\":\"08cd602f-28c5-4261-bfb4-734f18564c7a\",\"msg_type\":\"execute_request\"},\"metadata\":{},\"content\":{\"code\":\"__import__('sys').path.append('\\/tmp\\/emacs-ipython-notebook\\/lisp\\/')\",\"silent\":true,\"user_variables\":[],\"user_expressions\":{},\"allow_stdin\":false},\"parent_header\":{}}")
  ein:websocket-send([cl-struct-ein:$websocket [cl-struct-websocket open #0 ... ... ... websocket-default-error-handler nil nil nil "ws://127.0.0.1:8888/kernels/bbbb69e9-11e1-4b50-ae1d-97f829d6a06b/shell" nil nil #<process websocket to ws://127.0.0.1:8888/kernels/bbbb69e9-11e1-4b50-ae1d-97f829d6a06b/shell<1>> nil "zYZQQL8oEhePmFXWEgXqCzAONb8=" nil] ... nil ein:kernel--ws-closed-callback ... ... nil nil] "{\"header\":{\"msg_id\":\"ab0ee531-54b5-4436-ae71-e06f2fdfcf90\",\"username\":\"username\",\"session\":\"08cd602f-28c5-4261-bfb4-734f18564c7a\",\"msg_type\":\"execute_request\"},\"metadata\":{},\"content\":{\"code\":\"__import__('sys').path.append('\\/tmp\\/emacs-ipython-notebook\\/lisp\\/')\",\"silent\":true,\"user_variables\":[],\"user_expressions\":{},\"allow_stdin\":false},\"parent_header\":{}}")
  (let* ... ... ... ... msg-id)
  (progn ... ...)
  (let* ... ... ...)
  ein:kernel-execute([cl-struct-ein:$kernel 8888 [object ein:events "ein:events" #s(hash-table size 65 test eq rehash-size 1.5 rehash-threshold 0.8 data (maybe_reset_undo\.Worksheet ... set_next_input\.Worksheet ... set_dirty\.Worksheet ... open_with_text\.Pager ... status_idle\.Kernel ... status_busy\.Kernel ... status_dead\.Kernel ... notebook_saving\.Notebook ... notebook_saved\.Notebook ... notebook_save_failed\.Notebook ... execution_count\.Kernel ... status_restarting\.Kernel ... ...))] "bbbb69e9-11e1-4b50-ae1d-97f829d6a06b" [cl-struct-ein:$websocket [cl-struct-websocket open #1 ... ... ... websocket-default-error-handler nil nil nil "ws://127.0.0.1:8888/kernels/bbbb69e9-11e1-4b50-ae1d-97f829d6a06b/shell" nil nil #<process websocket to ws://127.0.0.1:8888/kernels/bbbb69e9-11e1-4b50-ae1d-97f829d6a06b/shell<1>> nil "zYZQQL8oEhePmFXWEgXqCzAONb8=" nil] ... nil ein:kernel--ws-closed-callback ... ... nil nil] [cl-struct-ein:$websocket [cl-struct-websocket open #1 ... ... ... websocket-default-error-handler nil nil nil "ws://127.0.0.1:8888/kernels/bbbb69e9-11e1-4b50-ae1d-97f829d6a06b/iopub" nil nil #<process websocket to ws://127.0.0.1:8888/kernels/bbbb69e9-11e1-4b50-ae1d-97f829d6a06b/iopub> nil "PFIrL/4DDcV4HC2mYv863yP1J68=" nil] ... nil ein:kernel--ws-closed-callback ... ... nil nil] "/kernels" "/kernels/bbbb69e9-11e1-4b50-ae1d-97f829d6a06b" "ws://127.0.0.1:8888" t "username" "08cd602f-28c5-4261-bfb4-734f18564c7a" #s(hash-table size 65 test equal rehash-size 1.5 rehash-threshold 0.8 data ( ...)) ... nil] "__import__('sys').path.append('/tmp/emacs-ipython-notebook/lisp/')")
  ein:pytools-add-sys-path([cl-struct-ein:$kernel 8888 [object ein:events "ein:events" #s(hash-table size 65 test eq rehash-size 1.5 rehash-threshold 0.8 data (maybe_reset_undo\.Worksheet ... set_next_input\.Worksheet ... set_dirty\.Worksheet ... open_with_text\.Pager ... status_idle\.Kernel ... status_busy\.Kernel ... status_dead\.Kernel ... notebook_saving\.Notebook ... notebook_saved\.Notebook ... notebook_save_failed\.Notebook ... execution_count\.Kernel ... status_restarting\.Kernel ... ...))] "bbbb69e9-11e1-4b50-ae1d-97f829d6a06b" [cl-struct-ein:$websocket [cl-struct-websocket open #1 ... ... ... websocket-default-error-handler nil nil nil "ws://127.0.0.1:8888/kernels/bbbb69e9-11e1-4b50-ae1d-97f829d6a06b/shell" nil nil #<process websocket to ws://127.0.0.1:8888/kernels/bbbb69e9-11e1-4b50-ae1d-97f829d6a06b/shell<1>> nil "zYZQQL8oEhePmFXWEgXqCzAONb8=" nil] ... nil ein:kernel--ws-closed-callback ... ... nil nil] [cl-struct-ein:$websocket [cl-struct-websocket open #1 ... ... ... websocket-default-error-handler nil nil nil "ws://127.0.0.1:8888/kernels/bbbb69e9-11e1-4b50-ae1d-97f829d6a06b/iopub" nil nil #<process websocket to ws://127.0.0.1:8888/kernels/bbbb69e9-11e1-4b50-ae1d-97f829d6a06b/iopub> nil "PFIrL/4DDcV4HC2mYv863yP1J68=" nil] ... nil ein:kernel--ws-closed-callback ... ... nil nil] "/kernels" "/kernels/bbbb69e9-11e1-4b50-ae1d-97f829d6a06b" "ws://127.0.0.1:8888" t "username" "08cd602f-28c5-4261-bfb4-734f18564c7a" #s(hash-table size 65 test equal rehash-size 1.5 rehash-threshold 0.8 data ( ...)) ... nil])
  apply(ein:pytools-add-sys-path [cl-struct-ein:$kernel 8888 [object ein:events "ein:events" #s(hash-table size 65 test eq rehash-size 1.5 rehash-threshold 0.8 data (maybe_reset_undo\.Worksheet ... set_next_input\.Worksheet ... set_dirty\.Worksheet ... open_with_text\.Pager ... status_idle\.Kernel ... status_busy\.Kernel ... status_dead\.Kernel ... notebook_saving\.Notebook ... notebook_saved\.Notebook ... notebook_save_failed\.Notebook ... execution_count\.Kernel ... status_restarting\.Kernel ... ...))] "bbbb69e9-11e1-4b50-ae1d-97f829d6a06b" [cl-struct-ein:$websocket [cl-struct-websocket open #1 ... ... ... websocket-default-error-handler nil nil nil "ws://127.0.0.1:8888/kernels/bbbb69e9-11e1-4b50-ae1d-97f829d6a06b/shell" nil nil #<process websocket to ws://127.0.0.1:8888/kernels/bbbb69e9-11e1-4b50-ae1d-97f829d6a06b/shell<1>> nil "zYZQQL8oEhePmFXWEgXqCzAONb8=" nil] ... nil ein:kernel--ws-closed-callback ... ... nil nil] [cl-struct-ein:$websocket [cl-struct-websocket open #1 ... ... ... websocket-default-error-handler nil nil nil "ws://127.0.0.1:8888/kernels/bbbb69e9-11e1-4b50-ae1d-97f829d6a06b/iopub" nil nil #<process websocket to ws://127.0.0.1:8888/kernels/bbbb69e9-11e1-4b50-ae1d-97f829d6a06b/iopub> nil "PFIrL/4DDcV4HC2mYv863yP1J68=" nil] ... nil ein:kernel--ws-closed-callback ... ... nil nil] "/kernels" "/kernels/bbbb69e9-11e1-4b50-ae1d-97f829d6a06b" "ws://127.0.0.1:8888" t "username" "08cd602f-28c5-4261-bfb4-734f18564c7a" #s(hash-table size 65 test equal rehash-size 1.5 rehash-threshold 0.8 data ( ...)) ... nil] nil)
  ein:funcall-packed((ein:pytools-add-sys-path . [cl-struct-ein:$kernel 8888 [object ein:events "ein:events" #s(hash-table size 65 test eq rehash-size 1.5 rehash-threshold 0.8 data (maybe_reset_undo\.Worksheet ... set_next_input\.Worksheet ... set_dirty\.Worksheet ... open_with_text\.Pager ... status_idle\.Kernel ... status_busy\.Kernel ... status_dead\.Kernel ... notebook_saving\.Notebook ... notebook_saved\.Notebook ... notebook_save_failed\.Notebook ... execution_count\.Kernel ... status_restarting\.Kernel ... ...))] "bbbb69e9-11e1-4b50-ae1d-97f829d6a06b" [cl-struct-ein:$websocket [cl-struct-websocket open #2 ... ... ... websocket-default-error-handler nil nil nil "ws://127.0.0.1:8888/kernels/bbbb69e9-11e1-4b50-ae1d-97f829d6a06b/shell" nil nil #<process websocket to ws://127.0.0.1:8888/kernels/bbbb69e9-11e1-4b50-ae1d-97f829d6a06b/shell<1>> nil "zYZQQL8oEhePmFXWEgXqCzAONb8=" nil] ... nil ein:kernel--ws-closed-callback ... ... nil nil] [cl-struct-ein:$websocket [cl-struct-websocket open #2 ... ... ... websocket-default-error-handler nil nil nil "ws://127.0.0.1:8888/kernels/bbbb69e9-11e1-4b50-ae1d-97f829d6a06b/iopub" nil nil #<process websocket to ws://127.0.0.1:8888/kernels/bbbb69e9-11e1-4b50-ae1d-97f829d6a06b/iopub> nil "PFIrL/4DDcV4HC2mYv863yP1J68=" nil] ... nil ein:kernel--ws-closed-callback ... ... nil nil] "/kernels" "/kernels/bbbb69e9-11e1-4b50-ae1d-97f829d6a06b" "ws://127.0.0.1:8888" t "username" "08cd602f-28c5-4261-bfb4-734f18564c7a" #s(hash-table size 65 test equal rehash-size 1.5 rehash-threshold 0.8 data ( ...)) ... nil]))
  mapc(ein:funcall-packed (...))
  ein:kernel-run-after-start-hook([cl-struct-ein:$kernel 8888 [object ein:events "ein:events" #s(hash-table size 65 test eq rehash-size 1.5 rehash-threshold 0.8 data (maybe_reset_undo\.Worksheet ... set_next_input\.Worksheet ... set_dirty\.Worksheet ... open_with_text\.Pager ... status_idle\.Kernel ... status_busy\.Kernel ... status_dead\.Kernel ... notebook_saving\.Notebook ... notebook_saved\.Notebook ... notebook_save_failed\.Notebook ... execution_count\.Kernel ... status_restarting\.Kernel ... ...))] "bbbb69e9-11e1-4b50-ae1d-97f829d6a06b" [cl-struct-ein:$websocket [cl-struct-websocket open #1 ... ... ... websocket-default-error-handler nil nil nil "ws://127.0.0.1:8888/kernels/bbbb69e9-11e1-4b50-ae1d-97f829d6a06b/shell" nil nil #<process websocket to ws://127.0.0.1:8888/kernels/bbbb69e9-11e1-4b50-ae1d-97f829d6a06b/shell<1>> nil "zYZQQL8oEhePmFXWEgXqCzAONb8=" nil] ... nil ein:kernel--ws-closed-callback ... ... nil nil] [cl-struct-ein:$websocket [cl-struct-websocket open #1 ... ... ... websocket-default-error-handler nil nil nil "ws://127.0.0.1:8888/kernels/bbbb69e9-11e1-4b50-ae1d-97f829d6a06b/iopub" nil nil #<process websocket to ws://127.0.0.1:8888/kernels/bbbb69e9-11e1-4b50-ae1d-97f829d6a06b/iopub> nil "PFIrL/4DDcV4HC2mYv863yP1J68=" nil] ... nil ein:kernel--ws-closed-callback ... ... nil nil] "/kernels" "/kernels/bbbb69e9-11e1-4b50-ae1d-97f829d6a06b" "ws://127.0.0.1:8888" t "username" "08cd602f-28c5-4261-bfb4-734f18564c7a" #s(hash-table size 65 test equal rehash-size 1.5 rehash-threshold 0.8 data ( ...)) ... nil])
  (progn ...)
  (if ... ...)
  (lambda ... ... ...)(--host-- --kernel-- --channel--)
  apply((lambda ... ... ...) --host-- --kernel-- --channel-- nil)
  (lambda ... ...)()
  apply((lambda ... ...) nil)
  (if it ...)
  (let ... ...)
  (let ... ...)
  (lambda ... ...)([cl-struct-websocket open [cl-struct-ein:$websocket #0 ... nil ein:kernel--ws-closed-callback ... ... nil nil] ... ... ... websocket-default-error-handler nil nil nil "ws://127.0.0.1:8888/kernels/bbbb69e9-11e1-4b50-ae1d-97f829d6a06b/iopub" nil nil #<process websocket to ws://127.0.0.1:8888/kernels/bbbb69e9-11e1-4b50-ae1d-97f829d6a06b/iopub> nil "PFIrL/4DDcV4HC2mYv863yP1J68=" nil])
  apply((lambda ... ...) [cl-struct-websocket open [cl-struct-ein:$websocket #0 ... nil ein:kernel--ws-closed-callback ... ... nil nil] ... ... ... websocket-default-error-handler nil nil nil "ws://127.0.0.1:8888/kernels/bbbb69e9-11e1-4b50-ae1d-97f829d6a06b/iopub" nil nil #<process websocket to ws://127.0.0.1:8888/kernels/bbbb69e9-11e1-4b50-ae1d-97f829d6a06b/iopub> nil "PFIrL/4DDcV4HC2mYv863yP1J68=" nil])
  (condition-case err ... ...)
  (if websocket-callback-debug-on-error ... ...)
  (let ... ... ...)
  websocket-try-callback(websocket-on-open on-open [cl-struct-websocket open [cl-struct-ein:$websocket #0 ... nil ein:kernel--ws-closed-callback ... ... nil nil] ... ... ... websocket-default-error-handler nil nil nil "ws://127.0.0.1:8888/kernels/bbbb69e9-11e1-4b50-ae1d-97f829d6a06b/iopub" nil nil #<process websocket to ws://127.0.0.1:8888/kernels/bbbb69e9-11e1-4b50-ae1d-97f829d6a06b/iopub> nil "PFIrL/4DDcV4HC2mYv863yP1J68=" nil])
  (progn ... ... ...)
  (if ... ...)
  (let ... ... ... ...)
  websocket-outer-filter([cl-struct-websocket open [cl-struct-ein:$websocket #0 ... nil ein:kernel--ws-closed-callback ... ... nil nil] ... ... ... websocket-default-error-handler nil nil nil "ws://127.0.0.1:8888/kernels/bbbb69e9-11e1-4b50-ae1d-97f829d6a06b/iopub" nil nil #<process websocket to ws://127.0.0.1:8888/kernels/bbbb69e9-11e1-4b50-ae1d-97f829d6a06b/iopub> nil "PFIrL/4DDcV4HC2mYv863yP1J68=" nil] "HTTP/1.1 101 Switching Protocols
\nUpgrade: websocket
\nConnection: Upgrade
\nSec-WebSocket-Accept: PFIrL/4DDcV4HC2mYv863yP1J68=
\n
\n")
  (let ... ...)
  (lambda ... ...)(#<process websocket to ws://127.0.0.1:8888/kernels/bbbb69e9-11e1-4b50-ae1d-97f829d6a06b/iopub> "HTTP/1.1 101 Switching Protocols
\nUpgrade: websocket
\nConnection: Upgrade
\nSec-WebSocket-Accept: PFIrL/4DDcV4HC2mYv863yP1J68=
\n
\n")

@tkf
Copy link
Owner

tkf commented Feb 23, 2013

Ah, so that was not enough. How about this:

(defun ein:kernel-run-after-start-hook (kernel))

@ebrevdo
Copy link
Author

ebrevdo commented Feb 23, 2013

Redefined both and here's the new backtrace:

Debugger entered--Lisp error: (error "ein:$websocket-onopen accessing a non-ein:$websocket")
  signal(error ("ein:$websocket-onopen accessing a non-ein:$websocket"))
  error("%s accessing a non-%s" ein:$websocket-onopen ein:$websocket)
  (or ... ...)
  (progn ... ...)
  (let ... ...)
  (let ... ...)
  (lambda ... ...)([cl-struct-websocket open nil ... ... ... websocket-default-error-handler nil nil nil "ws://127.0.0.1:8888/kernels/bbbb69e9-11e1-4b50-ae1d-97f829d6a06b/shell" nil nil #<process websocket to ws://127.0.0.1:8888/kernels/bbbb69e9-11e1-4b50-ae1d-97f829d6a06b/shell> nil "FVB2Rp+Yp1Xvf1OInAl3GFoxthw=" nil])
  apply((lambda ... ...) [cl-struct-websocket open nil ... ... ... websocket-default-error-handler nil nil nil "ws://127.0.0.1:8888/kernels/bbbb69e9-11e1-4b50-ae1d-97f829d6a06b/shell" nil nil #<process websocket to ws://127.0.0.1:8888/kernels/bbbb69e9-11e1-4b50-ae1d-97f829d6a06b/shell> nil "FVB2Rp+Yp1Xvf1OInAl3GFoxthw=" nil])
  (condition-case err ... ...)
  (if websocket-callback-debug-on-error ... ...)
  (let ... ... ...)
  websocket-try-callback(websocket-on-open on-open [cl-struct-websocket open nil ... ... ... websocket-default-error-handler nil nil nil "ws://127.0.0.1:8888/kernels/bbbb69e9-11e1-4b50-ae1d-97f829d6a06b/shell" nil nil #<process websocket to ws://127.0.0.1:8888/kernels/bbbb69e9-11e1-4b50-ae1d-97f829d6a06b/shell> nil "FVB2Rp+Yp1Xvf1OInAl3GFoxthw=" nil])
  (progn ... ... ...)
  (if ... ...)
  (let ... ... ... ...)
  websocket-outer-filter([cl-struct-websocket open nil ... ... ... websocket-default-error-handler nil nil nil "ws://127.0.0.1:8888/kernels/bbbb69e9-11e1-4b50-ae1d-97f829d6a06b/shell" nil nil #<process websocket to ws://127.0.0.1:8888/kernels/bbbb69e9-11e1-4b50-ae1d-97f829d6a06b/shell> nil "FVB2Rp+Yp1Xvf1OInAl3GFoxthw=" nil] "HTTP/1.1 101 Switching Protocols
\nUpgrade: websocket
\nConnection: Upgrade
\nSec-WebSocket-Accept: FVB2Rp+Yp1Xvf1OInAl3GFoxthw=
\n
\n")
  (let ... ...)
  (lambda ... ...)(#<process websocket to ws://127.0.0.1:8888/kernels/bbbb69e9-11e1-4b50-ae1d-97f829d6a06b/shell> "HTTP/1.1 101 Switching Protocols
\nUpgrade: websocket
\nConnection: Upgrade
\nSec-WebSocket-Accept: FVB2Rp+Yp1Xvf1OInAl3GFoxthw=
\n
\n")

@ebrevdo
Copy link
Author

ebrevdo commented Feb 23, 2013

After debugging a bit more, it looks like the port I was connected to (8888) was owned by a zombie ipython notebook that was not associated with my uid (which is why I didn't see it earlier). After killing it, all the problems go away. I can use ein in my standard emacs environment with no issue whatsoever. Using ipython notebook --pylab inline works fine too.

Sorry for creating so much trouble! I wonder if the existing debug messages are sufficient to identify when the issue is on the server side? Will close this bug now.

@ebrevdo ebrevdo closed this as completed Feb 23, 2013
tkf added a commit that referenced this issue Feb 23, 2013
to avoid trouble like #104.
@tkf
Copy link
Owner

tkf commented Feb 23, 2013

Well, I learned some lessons and reflected them to the bug report template: 7f17f3b

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

2 participants