millejoh / emacs-ipython-notebook

Jupyter notebook client in Emacs
http://millejoh.github.io/emacs-ipython-notebook/
GNU General Public License v3.0
1.47k stars 122 forks source link

Ein cell get's corrupted and I can no longer save notebook or remove output from cell. #757

Closed hnisonoff closed 3 years ago

hnisonoff commented 3 years ago

Problem description

Occassionally I get the following error when trying to execute a cell or remove it's output: "ein:worksheet-execute-cell-km: Wrong type argument: arrayp, nil" This seems to happen when a cell is printing out information while running. However, it only happens occassionally. Once this happens I cannot remove the output of the cell and I cannot save my notebook. In this particular instance I am connected to a remote notebook with SSH forwarding, though I do not know if this is part of the cause. Thanks for the great work on this package. It has been really useful to me.

Steps to reproduce the problem

I unfortunately have not come up with a good way to reproduce this, but it sounds like this type of issue has come up in the past so perhaps someone has a sense of what is going on.

System info:

("EIN system info"
 :emacs-version
 "GNU Emacs 27.1 (build 1, x86_64-apple-darwin19.4.0, Carbon Version 162 AppKit 1894.4)
 of 2020-08-19"
 :emacs-bzr-version nil
 :window-system mac
 :emacs-variant nil
 :os
 (:uname
  "Darwin Hunters-MBP-2.fios-router.home 19.4.0 Darwin Kernel Version 19.4.0: Wed Mar  4 22:28:40 PST 2020; root:xnu-6153.101.6~15/RELEASE_X86_64 x86_64
"
  :lsb-release nil)
 :notebook
 "Traceback (most recent call last):
  File \"/usr/local/bin/pip\", line 6, in <module>
    from pip._internal.cli.main import main
ModuleNotFoundError: No module named 'pip._internal.cli.main'
"
 :ipython
 "/usr/local/opt/emacs-mac/Emacs.app/Contents/MacOS/Emacs: /usr/local/bin/ipython: No such file or directory
"
 :image-types
 (svg image-io imagemagick png gif tiff jpeg xpm xbm pbm)
 :image-types-available
 (svg image-io imagemagick png gif tiff jpeg xpm xbm pbm)
 :request
 (:backend curl)
 :ein
 (:version "20201028.1857"
           :source-dir "/Users/hunternisonoff/.emacs.d/elpa/ein-20201028.1857/")
 :lib
 ((:name "websocket"
         :path "~/.emacs.d/elpa/websocket-20200419.2124/websocket.elc"
         :featurep t
         :version-var websocket-version
         :version "1.12")
  (:name "anaphora"
         :path "~/.emacs.d/elpa/anaphora-20180618.2200/anaphora.elc"
         :featurep t
         :version-var nil
         :version nil)
  (:name "request"
         :path "~/.emacs.d/elpa/request-20201026.2324/request.elc"
         :featurep t
         :version-var request-version
         :version "0.3.0")
  (:name "deferred"
         :path "~/.emacs.d/elpa/deferred-20170901.1330/deferred.elc"
         :featurep t
         :version-var deferred:version
         :version "0.5.0")
  (:name "polymode"
         :path "~/.emacs.d/elpa/polymode-20200606.1106/polymode.elc"
         :featurep t
         :version-var nil
         :version nil)
  (:name "exec-path-from-shell"
         :path "~/.emacs.d/elpa/exec-path-from-shell-20200526.324/exec-path-from-shell.elc"
         :featurep t
         :version-var nil
         :version nil)
  (:name "dash"
         :path "~/.emacs.d/elpa/dash-20200803.1520/dash.elc"
         :featurep t
         :version-var nil
         :version nil)
  (:name "with-editor"
         :path "~/.emacs.d/elpa/with-editor-20201026.2027/with-editor.elc"
         :featurep t
         :version-var nil
         :version nil)))
dickmao commented 3 years ago

With commit e8d054a, providing you first set (setq debug-on-error t), that error Wrong type argument: arrayp, nil should now yield a backtrace. Please reopen with that backtrace.

hnisonoff commented 3 years ago

@dickmao here is the traceback. I do not think I am able to re-open the issue.

Debugger entered--Lisp error: (wrong-type-argument arrayp nil)
  ein:cell--ewoc-delete(#s(ewoc :buffer #<buffer *ein: http://127.0.0.1:8084/semisup/Untitled5.ipynb*> :pretty-printer ein:worksheet-pp :header [... ... ... #<marker at 1 in *ein: http://127.0.0.1:8084/semisup/Untitled5.ipynb*>] :footer [... ... "" #<marker at 5341 in *ein: http://127.0.0.1:8084/semisup/Untitled5.ipynb*>] :dll [... ... DL-LIST #<marker at 5341 in *ein: http://127.0.0.1:8084/semisup/Untitled5.ipynb*>] :last-node [... ... ... #<marker at 4181 in *ein: http://127.0.0.1:8084/semisup/Untitled5.ipynb*>] :hf-pp insert) [nil nil #s(ein:$node :path ... :data #<ein:codecell ein:codecell-1fff78cfed4c> :class ...) #<marker in no buffer>] [nil nil #s(ein:$node :path ... :data #<ein:codecell ein:codecell-1fff78cfed4c> :class ...) #<marker in no buffer>] [nil nil #s(ein:$node :path ... :data #<ein:codecell ein:codecell-1fff78cfed4c> :class ...) #<marker in no buffer>] [nil nil #s(ein:$node :path ... :data #<ein:codecell ein:codecell-1fff78cfed4c> :class ...) #<marker in no buffer>] [nil nil #s(ein:$node :path ... :data #<ein:codecell ein:codecell-1fff78cfed4c> :class ...) #<marker in no buffer>] [nil nil #s(ein:$node :path ... :data #<ein:codecell ein:codecell-1fff78cfed4c> :class ...) #<marker in no buffer>] [nil nil #s(ein:$node :path ... :data #<ein:codecell ein:codecell-1fff78cfed4c> :class ...) #<marker in no buffer>] [nil nil #s(ein:$node :path ... :data #<ein:codecell ein:codecell-1fff78cfed4c> :class ...) #<marker in no buffer>] [nil nil #s(ein:$node :path ... :data #<ein:codecell ein:codecell-1fff78cfed4c> :class ...) #<marker in no buffer>] [nil nil #s(ein:$node :path ... :data #<ein:codecell ein:codecell-1fff78cfed4c> :class ...) #<marker in no buffer>] [nil nil #s(ein:$node :path ... :data #<ein:codecell ein:codecell-1fff78cfed4c> :class ...) #<marker in no buffer>] [nil nil #s(ein:$node :path ... :data #<ein:codecell ein:codecell-1fff78cfed4c> :class ...) #<marker in no buffer>] [nil nil #s(ein:$node :path ... :data #<ein:codecell ein:codecell-1fff78cfed4c> :class ...) #<marker in no buffer>] [nil nil #s(ein:$node :path ... :data #<ein:codecell ein:codecell-1fff78cfed4c> :class ...) #<marker in no buffer>] [nil nil #s(ein:$node :path ... :data #<ein:codecell ein:codecell-1fff78cfed4c> :class ...) #<marker in no buffer>] [nil nil #s(ein:$node :path ... :data #<ein:codecell ein:codecell-1fff78cfed4c> :class ...) #<marker in no buffer>] [nil nil #s(ein:$node :path ... :data #<ein:codecell ein:codecell-1fff78cfed4c> :class ...) #<marker in no buffer>] [nil nil #s(ein:$node :path ... :data #<ein:codecell ein:codecell-1fff78cfed4c> :class ...) #<marker in no buffer>] [nil nil #s(ein:$node :path ... :data #<ein:codecell ein:codecell-1fff78cfed4c> :class ...) #<marker in no buffer>] ...)
  apply(ein:cell--ewoc-delete #s(ewoc :buffer #<buffer *ein: http://127.0.0.1:8084/semisup/Untitled5.ipynb*> :pretty-printer ein:worksheet-pp :header [[... #3 DL-LIST #<marker at 5341 in *ein: http://127.0.0.1:8084/semisup/Untitled5.ipynb*>] [#3 ... ... #<marker at 2 in *ein: http://127.0.0.1:8084/semisup/Untitled5.ipynb*>] #("\n" 0 1 ...) #<marker at 1 in *ein: http://127.0.0.1:8084/semisup/Untitled5.ipynb*>] :footer [[... #3 ... #<marker at 5340 in *ein: http://127.0.0.1:8084/semisup/Untitled5.ipynb*>] [#3 ... DL-LIST #<marker at 5341 in *ein: http://127.0.0.1:8084/semisup/Untitled5.ipynb*>] "" #<marker at 5341 in *ein: http://127.0.0.1:8084/semisup/Untitled5.ipynb*>] :dll [[... #3 "" #<marker at 5341 in *ein: http://127.0.0.1:8084/semisup/Untitled5.ipynb*>] [#3 ... ... #<marker at 1 in *ein: http://127.0.0.1:8084/semisup/Untitled5.ipynb*>] DL-LIST #<marker at 5341 in *ein: http://127.0.0.1:8084/semisup/Untitled5.ipynb*>] :last-node [[... #3 ... #<marker at 4173 in *ein: http://127.0.0.1:8084/semisup/Untitled5.ipynb*>] [#3 ... ... #<marker at 4586 in *ein: http://127.0.0.1:8084/semisup/Untitled5.ipynb*>] #s(ein:$node :path ... :data #<ein:codecell ein:codecell-1fff78cfed4c> :class nil) #<marker at 4181 in *ein: http://127.0.0.1:8084/semisup/Untitled5.ipynb*>] :hf-pp insert) ([nil nil #s(ein:$node :path ... :data #<ein:codecell ein:codecell-1fff78cfed4c> :class ...) #<marker in no buffer>] [nil nil #s(ein:$node :path ... :data #<ein:codecell ein:codecell-1fff78cfed4c> :class ...) #<marker in no buffer>] [nil nil #s(ein:$node :path ... :data #<ein:codecell ein:codecell-1fff78cfed4c> :class ...) #<marker in no buffer>] [nil nil #s(ein:$node :path ... :data #<ein:codecell ein:codecell-1fff78cfed4c> :class ...) #<marker in no buffer>] [nil nil #s(ein:$node :path ... :data #<ein:codecell ein:codecell-1fff78cfed4c> :class ...) #<marker in no buffer>] [nil nil #s(ein:$node :path ... :data #<ein:codecell ein:codecell-1fff78cfed4c> :class ...) #<marker in no buffer>] [nil nil #s(ein:$node :path ... :data #<ein:codecell ein:codecell-1fff78cfed4c> :class ...) #<marker in no buffer>] [nil nil #s(ein:$node :path ... :data #<ein:codecell ein:codecell-1fff78cfed4c> :class ...) #<marker in no buffer>] [nil nil #s(ein:$node :path ... :data #<ein:codecell ein:codecell-1fff78cfed4c> :class ...) #<marker in no buffer>] [nil nil #s(ein:$node :path ... :data #<ein:codecell ein:codecell-1fff78cfed4c> :class ...) #<marker in no buffer>] [nil nil #s(ein:$node :path ... :data #<ein:codecell ein:codecell-1fff78cfed4c> :class ...) #<marker in no buffer>] [nil nil #s(ein:$node :path ... :data #<ein:codecell ein:codecell-1fff78cfed4c> :class ...) #<marker in no buffer>] [nil nil #s(ein:$node :path ... :data #<ein:codecell ein:codecell-1fff78cfed4c> :class ...) #<marker in no buffer>] [nil nil #s(ein:$node :path ... :data #<ein:codecell ein:codecell-1fff78cfed4c> :class ...) #<marker in no buffer>] [nil nil #s(ein:$node :path ... :data #<ein:codecell ein:codecell-1fff78cfed4c> :class ...) #<marker in no buffer>] [nil nil #s(ein:$node :path ... :data #<ein:codecell ein:codecell-1fff78cfed4c> :class ...) #<marker in no buffer>] [nil nil #s(ein:$node :path ... :data #<ein:codecell ein:codecell-1fff78cfed4c> :class ...) #<marker in no buffer>] [nil nil #s(ein:$node :path ... :data #<ein:codecell ein:codecell-1fff78cfed4c> :class ...) #<marker in no buffer>] [nil nil #s(ein:$node :path ... :data #<ein:codecell ein:codecell-1fff78cfed4c> :class ...) #<marker in no buffer>] [nil nil #s(ein:$node :path ... :data #<ein:codecell ein:codecell-1fff78cfed4c> :class ...) #<marker in no buffer>] [nil nil #s(ein:$node :path ... :data #<ein:codecell ein:codecell-1fff78cfed4c> :class ...) #<marker in no buffer>] [nil nil #s(ein:$node :path ... :data #<ein:codecell ein:codecell-1fff78cfed4c> :class ...) #<marker in no buffer>] [nil nil #s(ein:$node :path ... :data #<ein:codecell ein:codecell-1fff78cfed4c> :class ...) #<marker in no buffer>] [nil nil #s(ein:$node :path ... :data #<ein:codecell ein:codecell-1fff78cfed4c> :class ...) #<marker in no buffer>] [nil nil #s(ein:$node :path ... :data #<ein:codecell ein:codecell-1fff78cfed4c> :class ...) #<marker in no buffer>] [nil nil #s(ein:$node :path ... :data #<ein:codecell ein:codecell-1fff78cfed4c> :class ...) #<marker in no buffer>] ...))
  #f(compiled-function (cell stdout stderr other) "codecell.js in IPython implements it using timeout and callback.\n  As it is unclear why timeout is needed, just clear output\n  instantaneously for now." #<bytecode 0x1fff774f2f0d>)(#<ein:codecell ein:codecell-1fff78cfed4c> t t t)
  apply(#f(compiled-function (cell stdout stderr other) "codecell.js in IPython implements it using timeout and callback.\n  As it is unclear why timeout is needed, just clear output\n  instantaneously for now." #<bytecode 0x1fff774f2f0d>) #<ein:codecell ein:codecell-1fff78cfed4c> (t t t))
  ein:cell-clear-output(#<ein:codecell ein:codecell-1fff78cfed4c> t t t)
  #f(compiled-function (cell kernel code &rest args) #<bytecode 0x1fff774ed5bd>)(#<ein:codecell ein:codecell-1fff78cfed4c> #s(ein:$kernel :url-or-port "http://127.0.0.1:8084" :path "semisup/Untitled5.ipynb" :kernelspec nil :events #<ein:events ein:events-1fff78c3fe24> :api-version 6 :session-id "9e397bc3-eb53-4162-85c5-4d31dd00a952" :kernel-id "2a38a544-d6f0-4ec3-aad5-84db52be2f8d" :shell-channel nil :iopub-channel nil :websocket #s(ein:$websocket :ws #s(websocket :ready-state open :client-data #3 :on-open #f(compiled-function (&rest args2) #<bytecode 0x1fff773975fd>) :on-message #f(compiled-function (&rest args2) #<bytecode 0x1fff773975dd>) :on-close #f(compiled-function (ws) #<bytecode 0x1fff76e7ddfd>) :on-error #f(compiled-function (ws action err) #<bytecode 0x1fff78c33999>) :negotiated-protocols nil :negotiated-extensions nil :server-p nil :url "ws://127.0.0.1:8084/api/kernels/2a38a544-d6f0-4ec3..." :protocols nil :extensions nil :conn #<process websocket to ws://127.0.0.1:8084/api/kernels/2a38a544-d6f0-4ec3-aad5-84db52be2f8d/channels?session_id=9e397bc3-eb53-4162-85c5-4d31dd00a952> :server-conn nil :accept-string "Yci+bzjg9OlcrS7nN0sjONHhAyc=" :inflight-input nil) :kernel #2 :closed-by-client nil) :base-url "/api/kernels" :kernel-url "/api/kernels/2a38a544-d6f0-4ec3-aad5-84db52be2f8d" :ws-url "ws://127.0.0.1:8084" :stdin-activep nil :username "username" :msg-callbacks #<hash-table equal 34/65 0x1fff775c4535> :oinfo-cache #<hash-table equal 0/65 0x1fff78c3fe5d> :after-start-hook nil :after-execute-hook nil) #("logger = pl.loggers.CSVLogger(\"lightning_logs\", na..." 0 6 (face font-lock-variable-name-face fontified t :pm-mode python-mode :pm-span (body 4182 4586 #<pm-inner-overlay-chunkmode ein-input-cell::>) charset mac-roman) 6 30 (fontified t :pm-mode python-mode :pm-span (body 4182 4586 #<pm-inner-overlay-chunkmode ein-input-cell::>) charset mac-roman) 30 46 (face font-lock-string-face fontified t :pm-mode python-mode :pm-span (body 4182 4586 #<pm-inner-overlay-chunkmode ein-input-cell::>) charset mac-roman) 46 53 (fontified t :pm-mode python-mode :pm-span (body 4182 4586 #<pm-inner-overlay-chunkmode ein-input-cell::>) charset mac-roman) 53 70 (face font-lock-string-face fontified t :pm-mode python-mode :pm-span (body 4182 4586 #<pm-inner-overlay-chunkmode ein-input-cell::>) charset mac-roman) 70 72 (fontified t :pm-mode python-mode :pm-span (body 4182 4586 #<pm-inner-overlay-chunkmode ein-input-cell::>) charset mac-roman) 72 79 (face font-lock-variable-name-face fontified t :pm-mode python-mode :pm-span (body 4182 4586 #<pm-inner-overlay-chunkmode ein-input-cell::>) charset mac-roman) 79 150 (fontified t :pm-mode python-mode :pm-span (body 4182 4586 #<pm-inner-overlay-chunkmode ein-input-cell::>) charset mac-roman) 150 155 (face font-lock-constant-face fontified t :pm-mode python-mode :pm-span (body 4182 4586 #<pm-inner-overlay-chunkmode ein-input-cell::>) charset mac-roman) 155 177 (fontified t :pm-mode python-mode :pm-span (body 4182 4586 #<pm-inner-overlay-chunkmode ein-input-cell::>) charset mac-roman) 177 182 (face font-lock-constant-face fontified t :pm-mode python-mode :pm-span (body 4182 4586 #<pm-inner-overlay-chunkmode ein-input-cell::>) charset mac-roman) 182 288 (fontified t :pm-mode python-mode :pm-span (body 4182 4586 #<pm-inner-overlay-chunkmode ein-input-cell::>) charset mac-roman) 288 293 (face font-lock-variable-name-face fontified t :pm-mode python-mode :pm-span (body 4182 4586 #<pm-inner-overlay-chunkmode ein-input-cell::>) charset mac-roman) 293 328 (fontified t :pm-mode python-mode :pm-span (body 4182 4586 #<pm-inner-overlay-chunkmode ein-input-cell::>) charset mac-roman) 328 332 (face font-lock-constant-face fontified t :pm-mode python-mode :pm-span (body 4182 4586 #<pm-inner-overlay-chunkmode ein-input-cell::>) charset mac-roman) 332 402 (fontified t :pm-mode python-mode :pm-span (body 4182 4586 #<pm-inner-overlay-chunkmode ein-input-cell::>) charset mac-roman) ...) :silent nil)
  apply(#f(compiled-function (cell kernel code &rest args) #<bytecode 0x1fff774ed5bd>) #<ein:codecell ein:codecell-1fff78cfed4c> (#s(ein:$kernel :url-or-port "http://127.0.0.1:8084" :path "semisup/Untitled5.ipynb" :kernelspec nil :events #<ein:events ein:events-1fff78c3fe24> :api-version 6 :session-id "9e397bc3-eb53-4162-85c5-4d31dd00a952" :kernel-id "2a38a544-d6f0-4ec3-aad5-84db52be2f8d" :shell-channel nil :iopub-channel nil :websocket #s(ein:$websocket :ws #s(websocket :ready-state open :client-data #5 :on-open #f(compiled-function (&rest args2) #<bytecode 0x1fff773975fd>) :on-message #f(compiled-function (&rest args2) #<bytecode 0x1fff773975dd>) :on-close #f(compiled-function (ws) #<bytecode 0x1fff76e7ddfd>) :on-error #f(compiled-function (ws action err) #<bytecode 0x1fff78c33999>) :negotiated-protocols nil :negotiated-extensions nil :server-p nil :url "ws://127.0.0.1:8084/api/kernels/2a38a544-d6f0-4ec3..." :protocols nil :extensions nil :conn #<process websocket to ws://127.0.0.1:8084/api/kernels/2a38a544-d6f0-4ec3-aad5-84db52be2f8d/channels?session_id=9e397bc3-eb53-4162-85c5-4d31dd00a952> :server-conn nil :accept-string "Yci+bzjg9OlcrS7nN0sjONHhAyc=" :inflight-input nil) :kernel #4 :closed-by-client nil) :base-url "/api/kernels" :kernel-url "/api/kernels/2a38a544-d6f0-4ec3-aad5-84db52be2f8d" :ws-url "ws://127.0.0.1:8084" :stdin-activep nil :username "username" :msg-callbacks #<hash-table equal 34/65 0x1fff775c4535> :oinfo-cache #<hash-table equal 0/65 0x1fff78c3fe5d> :after-start-hook nil :after-execute-hook nil) #("logger = pl.loggers.CSVLogger(\"lightning_logs\", na..." 0 6 (face font-lock-variable-name-face fontified t :pm-mode python-mode :pm-span (body 4182 4586 #<pm-inner-overlay-chunkmode ein-input-cell::>) charset mac-roman) 6 30 (fontified t :pm-mode python-mode :pm-span (body 4182 4586 #<pm-inner-overlay-chunkmode ein-input-cell::>) charset mac-roman) 30 46 (face font-lock-string-face fontified t :pm-mode python-mode :pm-span (body 4182 4586 #<pm-inner-overlay-chunkmode ein-input-cell::>) charset mac-roman) 46 53 (fontified t :pm-mode python-mode :pm-span (body 4182 4586 #<pm-inner-overlay-chunkmode ein-input-cell::>) charset mac-roman) 53 70 (face font-lock-string-face fontified t :pm-mode python-mode :pm-span (body 4182 4586 #<pm-inner-overlay-chunkmode ein-input-cell::>) charset mac-roman) 70 72 (fontified t :pm-mode python-mode :pm-span (body 4182 4586 #<pm-inner-overlay-chunkmode ein-input-cell::>) charset mac-roman) 72 79 (face font-lock-variable-name-face fontified t :pm-mode python-mode :pm-span (body 4182 4586 #<pm-inner-overlay-chunkmode ein-input-cell::>) charset mac-roman) 79 150 (fontified t :pm-mode python-mode :pm-span (body 4182 4586 #<pm-inner-overlay-chunkmode ein-input-cell::>) charset mac-roman) 150 155 (face font-lock-constant-face fontified t :pm-mode python-mode :pm-span (body 4182 4586 #<pm-inner-overlay-chunkmode ein-input-cell::>) charset mac-roman) 155 177 (fontified t :pm-mode python-mode :pm-span (body 4182 4586 #<pm-inner-overlay-chunkmode ein-input-cell::>) charset mac-roman) 177 182 (face font-lock-constant-face fontified t :pm-mode python-mode :pm-span (body 4182 4586 #<pm-inner-overlay-chunkmode ein-input-cell::>) charset mac-roman) 182 288 (fontified t :pm-mode python-mode :pm-span (body 4182 4586 #<pm-inner-overlay-chunkmode ein-input-cell::>) charset mac-roman) 288 293 (face font-lock-variable-name-face fontified t :pm-mode python-mode :pm-span (body 4182 4586 #<pm-inner-overlay-chunkmode ein-input-cell::>) charset mac-roman) 293 328 (fontified t :pm-mode python-mode :pm-span (body 4182 4586 #<pm-inner-overlay-chunkmode ein-input-cell::>) charset mac-roman) 328 332 (face font-lock-constant-face fontified t :pm-mode python-mode :pm-span (body 4182 4586 #<pm-inner-overlay-chunkmode ein-input-cell::>) charset mac-roman) 332 402 (fontified t :pm-mode python-mode :pm-span (body 4182 4586 #<pm-inner-overlay-chunkmode ein-input-cell::>) charset mac-roman) ...) :silent nil))
  ein:cell-execute-internal(#<ein:codecell ein:codecell-1fff78cfed4c> #s(ein:$kernel :url-or-port "http://127.0.0.1:8084" :path "semisup/Untitled5.ipynb" :kernelspec nil :events #<ein:events ein:events-1fff78c3fe24> :api-version 6 :session-id "9e397bc3-eb53-4162-85c5-4d31dd00a952" :kernel-id "2a38a544-d6f0-4ec3-aad5-84db52be2f8d" :shell-channel nil :iopub-channel nil :websocket #s(ein:$websocket :ws #s(websocket :ready-state open :client-data #3 :on-open #f(compiled-function (&rest args2) #<bytecode 0x1fff773975fd>) :on-message #f(compiled-function (&rest args2) #<bytecode 0x1fff773975dd>) :on-close #f(compiled-function (ws) #<bytecode 0x1fff76e7ddfd>) :on-error #f(compiled-function (ws action err) #<bytecode 0x1fff78c33999>) :negotiated-protocols nil :negotiated-extensions nil :server-p nil :url "ws://127.0.0.1:8084/api/kernels/2a38a544-d6f0-4ec3..." :protocols nil :extensions nil :conn #<process websocket to ws://127.0.0.1:8084/api/kernels/2a38a544-d6f0-4ec3-aad5-84db52be2f8d/channels?session_id=9e397bc3-eb53-4162-85c5-4d31dd00a952> :server-conn nil :accept-string "Yci+bzjg9OlcrS7nN0sjONHhAyc=" :inflight-input nil) :kernel #2 :closed-by-client nil) :base-url "/api/kernels" :kernel-url "/api/kernels/2a38a544-d6f0-4ec3-aad5-84db52be2f8d" :ws-url "ws://127.0.0.1:8084" :stdin-activep nil :username "username" :msg-callbacks #<hash-table equal 34/65 0x1fff775c4535> :oinfo-cache #<hash-table equal 0/65 0x1fff78c3fe5d> :after-start-hook nil :after-execute-hook nil) #("logger = pl.loggers.CSVLogger(\"lightning_logs\", na..." 0 6 (face font-lock-variable-name-face fontified t :pm-mode python-mode :pm-span (body 4182 4586 #<pm-inner-overlay-chunkmode ein-input-cell::>) charset mac-roman) 6 30 (fontified t :pm-mode python-mode :pm-span (body 4182 4586 #<pm-inner-overlay-chunkmode ein-input-cell::>) charset mac-roman) 30 46 (face font-lock-string-face fontified t :pm-mode python-mode :pm-span (body 4182 4586 #<pm-inner-overlay-chunkmode ein-input-cell::>) charset mac-roman) 46 53 (fontified t :pm-mode python-mode :pm-span (body 4182 4586 #<pm-inner-overlay-chunkmode ein-input-cell::>) charset mac-roman) 53 70 (face font-lock-string-face fontified t :pm-mode python-mode :pm-span (body 4182 4586 #<pm-inner-overlay-chunkmode ein-input-cell::>) charset mac-roman) 70 72 (fontified t :pm-mode python-mode :pm-span (body 4182 4586 #<pm-inner-overlay-chunkmode ein-input-cell::>) charset mac-roman) 72 79 (face font-lock-variable-name-face fontified t :pm-mode python-mode :pm-span (body 4182 4586 #<pm-inner-overlay-chunkmode ein-input-cell::>) charset mac-roman) 79 150 (fontified t :pm-mode python-mode :pm-span (body 4182 4586 #<pm-inner-overlay-chunkmode ein-input-cell::>) charset mac-roman) 150 155 (face font-lock-constant-face fontified t :pm-mode python-mode :pm-span (body 4182 4586 #<pm-inner-overlay-chunkmode ein-input-cell::>) charset mac-roman) 155 177 (fontified t :pm-mode python-mode :pm-span (body 4182 4586 #<pm-inner-overlay-chunkmode ein-input-cell::>) charset mac-roman) 177 182 (face font-lock-constant-face fontified t :pm-mode python-mode :pm-span (body 4182 4586 #<pm-inner-overlay-chunkmode ein-input-cell::>) charset mac-roman) 182 288 (fontified t :pm-mode python-mode :pm-span (body 4182 4586 #<pm-inner-overlay-chunkmode ein-input-cell::>) charset mac-roman) 288 293 (face font-lock-variable-name-face fontified t :pm-mode python-mode :pm-span (body 4182 4586 #<pm-inner-overlay-chunkmode ein-input-cell::>) charset mac-roman) 293 328 (fontified t :pm-mode python-mode :pm-span (body 4182 4586 #<pm-inner-overlay-chunkmode ein-input-cell::>) charset mac-roman) 328 332 (face font-lock-constant-face fontified t :pm-mode python-mode :pm-span (body 4182 4586 #<pm-inner-overlay-chunkmode ein-input-cell::>) charset mac-roman) 332 402 (fontified t :pm-mode python-mode :pm-span (body 4182 4586 #<pm-inner-overlay-chunkmode ein-input-cell::>) charset mac-roman) ...) :silent nil)
  #f(compiled-function (cell) #<bytecode 0x1fff774ed59d>)(#<ein:codecell ein:codecell-1fff78cfed4c>)
  apply(#f(compiled-function (cell) #<bytecode 0x1fff774ed59d>) #<ein:codecell ein:codecell-1fff78cfed4c> nil)
  ein:cell-execute(#<ein:codecell ein:codecell-1fff78cfed4c>)
  #f(compiled-function (ws* cell* batch* kernel) #<bytecode 0x1fff78c2f0f1>)(#<ein:worksheet ein:worksheet-1fff77490678> #<ein:codecell ein:codecell-1fff78cfed4c> nil #s(ein:$kernel :url-or-port "http://127.0.0.1:8084" :path "semisup/Untitled5.ipynb" :kernelspec nil :events #<ein:events ein:events-1fff78c3fe24> :api-version 6 :session-id "9e397bc3-eb53-4162-85c5-4d31dd00a952" :kernel-id "2a38a544-d6f0-4ec3-aad5-84db52be2f8d" :shell-channel nil :iopub-channel nil :websocket #s(ein:$websocket :ws #s(websocket :ready-state open :client-data #5 :on-open #f(compiled-function (&rest args2) #<bytecode 0x1fff773975fd>) :on-message #f(compiled-function (&rest args2) #<bytecode 0x1fff773975dd>) :on-close #f(compiled-function (ws) #<bytecode 0x1fff76e7ddfd>) :on-error #f(compiled-function (ws action err) #<bytecode 0x1fff78c33999>) :negotiated-protocols nil :negotiated-extensions nil :server-p nil :url "ws://127.0.0.1:8084/api/kernels/2a38a544-d6f0-4ec3..." :protocols nil :extensions nil :conn #<process websocket to ws://127.0.0.1:8084/api/kernels/2a38a544-d6f0-4ec3-aad5-84db52be2f8d/channels?session_id=9e397bc3-eb53-4162-85c5-4d31dd00a952> :server-conn nil :accept-string "Yci+bzjg9OlcrS7nN0sjONHhAyc=" :inflight-input nil) :kernel #4 :closed-by-client nil) :base-url "/api/kernels" :kernel-url "/api/kernels/2a38a544-d6f0-4ec3-aad5-84db52be2f8d" :ws-url "ws://127.0.0.1:8084" :stdin-activep nil :username "username" :msg-callbacks #<hash-table equal 34/65 0x1fff775c4535> :oinfo-cache #<hash-table equal 0/65 0x1fff78c3fe5d> :after-start-hook nil :after-execute-hook nil))
  apply(#f(compiled-function (ws* cell* batch* kernel) #<bytecode 0x1fff78c2f0f1>) (#<ein:worksheet ein:worksheet-1fff77490678> #<ein:codecell ein:codecell-1fff78cfed4c> nil #s(ein:$kernel :url-or-port "http://127.0.0.1:8084" :path "semisup/Untitled5.ipynb" :kernelspec nil :events #<ein:events ein:events-1fff78c3fe24> :api-version 6 :session-id "9e397bc3-eb53-4162-85c5-4d31dd00a952" :kernel-id "2a38a544-d6f0-4ec3-aad5-84db52be2f8d" :shell-channel nil :iopub-channel nil :websocket #s(ein:$websocket :ws #s(websocket :ready-state open :client-data #7 :on-open #f(compiled-function (&rest args2) #<bytecode 0x1fff773975fd>) :on-message #f(compiled-function (&rest args2) #<bytecode 0x1fff773975dd>) :on-close #f(compiled-function (ws) #<bytecode 0x1fff76e7ddfd>) :on-error #f(compiled-function (ws action err) #<bytecode 0x1fff78c33999>) :negotiated-protocols nil :negotiated-extensions nil :server-p nil :url "ws://127.0.0.1:8084/api/kernels/2a38a544-d6f0-4ec3..." :protocols nil :extensions nil :conn #<process websocket to ws://127.0.0.1:8084/api/kernels/2a38a544-d6f0-4ec3-aad5-84db52be2f8d/channels?session_id=9e397bc3-eb53-4162-85c5-4d31dd00a952> :server-conn nil :accept-string "Yci+bzjg9OlcrS7nN0sjONHhAyc=" :inflight-input nil) :kernel #6 :closed-by-client nil) :base-url "/api/kernels" :kernel-url "/api/kernels/2a38a544-d6f0-4ec3-aad5-84db52be2f8d" :ws-url "ws://127.0.0.1:8084" :stdin-activep nil :username "username" :msg-callbacks #<hash-table equal 34/65 0x1fff775c4535> :oinfo-cache #<hash-table equal 0/65 0x1fff78c3fe5d> :after-start-hook nil :after-execute-hook nil)))
  #f(compiled-function (&rest args2) #<bytecode 0x1fff7aac78e5>)(#s(ein:$kernel :url-or-port "http://127.0.0.1:8084" :path "semisup/Untitled5.ipynb" :kernelspec nil :events #<ein:events ein:events-1fff78c3fe24> :api-version 6 :session-id "9e397bc3-eb53-4162-85c5-4d31dd00a952" :kernel-id "2a38a544-d6f0-4ec3-aad5-84db52be2f8d" :shell-channel nil :iopub-channel nil :websocket #s(ein:$websocket :ws #s(websocket :ready-state open :client-data #2 :on-open #f(compiled-function (&rest args2) #<bytecode 0x1fff773975fd>) :on-message #f(compiled-function (&rest args2) #<bytecode 0x1fff773975dd>) :on-close #f(compiled-function (ws) #<bytecode 0x1fff76e7ddfd>) :on-error #f(compiled-function (ws action err) #<bytecode 0x1fff78c33999>) :negotiated-protocols nil :negotiated-extensions nil :server-p nil :url "ws://127.0.0.1:8084/api/kernels/2a38a544-d6f0-4ec3..." :protocols nil :extensions nil :conn #<process websocket to ws://127.0.0.1:8084/api/kernels/2a38a544-d6f0-4ec3-aad5-84db52be2f8d/channels?session_id=9e397bc3-eb53-4162-85c5-4d31dd00a952> :server-conn nil :accept-string "Yci+bzjg9OlcrS7nN0sjONHhAyc=" :inflight-input nil) :kernel #1 :closed-by-client nil) :base-url "/api/kernels" :kernel-url "/api/kernels/2a38a544-d6f0-4ec3-aad5-84db52be2f8d" :ws-url "ws://127.0.0.1:8084" :stdin-activep nil :username "username" :msg-callbacks #<hash-table equal 34/65 0x1fff775c4535> :oinfo-cache #<hash-table equal 0/65 0x1fff78c3fe5d> :after-start-hook nil :after-execute-hook nil))
  ein:kernel-when-ready(#s(ein:$kernel :url-or-port "http://127.0.0.1:8084" :path "semisup/Untitled5.ipynb" :kernelspec nil :events #<ein:events ein:events-1fff78c3fe24> :api-version 6 :session-id "9e397bc3-eb53-4162-85c5-4d31dd00a952" :kernel-id "2a38a544-d6f0-4ec3-aad5-84db52be2f8d" :shell-channel nil :iopub-channel nil :websocket #s(ein:$websocket :ws #s(websocket :ready-state open :client-data #2 :on-open #f(compiled-function (&rest args2) #<bytecode 0x1fff773975fd>) :on-message #f(compiled-function (&rest args2) #<bytecode 0x1fff773975dd>) :on-close #f(compiled-function (ws) #<bytecode 0x1fff76e7ddfd>) :on-error #f(compiled-function (ws action err) #<bytecode 0x1fff78c33999>) :negotiated-protocols nil :negotiated-extensions nil :server-p nil :url "ws://127.0.0.1:8084/api/kernels/2a38a544-d6f0-4ec3..." :protocols nil :extensions nil :conn #<process websocket to ws://127.0.0.1:8084/api/kernels/2a38a544-d6f0-4ec3-aad5-84db52be2f8d/channels?session_id=9e397bc3-eb53-4162-85c5-4d31dd00a952> :server-conn nil :accept-string "Yci+bzjg9OlcrS7nN0sjONHhAyc=" :inflight-input nil) :kernel #1 :closed-by-client nil) :base-url "/api/kernels" :kernel-url "/api/kernels/2a38a544-d6f0-4ec3-aad5-84db52be2f8d" :ws-url "ws://127.0.0.1:8084" :stdin-activep nil :username "username" :msg-callbacks #<hash-table equal 34/65 0x1fff775c4535> :oinfo-cache #<hash-table equal 0/65 0x1fff78c3fe5d> :after-start-hook nil :after-execute-hook nil) #f(compiled-function (&rest args2) #<bytecode 0x1fff7aac78e5>))
  ein:worksheet-execute-cell(#<ein:worksheet ein:worksheet-1fff77490678> #<ein:codecell ein:codecell-1fff78cfed4c> nil)
  funcall-interactively(ein:worksheet-execute-cell #<ein:worksheet ein:worksheet-1fff77490678> #<ein:codecell ein:codecell-1fff78cfed4c> nil)
  call-interactively(ein:worksheet-execute-cell)
  ein:worksheet-execute-cell-km()
  funcall-interactively(ein:worksheet-execute-cell-km)
  call-interactively(ein:worksheet-execute-cell-km nil nil)
  command-execute(ein:worksheet-execute-cell-km)
dickmao commented 3 years ago

Somehow nodes in https://github.com/millejoh/emacs-ipython-notebook/blob/917f2a0b6ca76ed9e966985ca6f19d8b57690d40/lisp/ein-cell.el#L55 contains a nil.

The only thing to do here is adding (when (memq nil (plist-get (slot-value cell 'element) :output)) (backtrace)) here, here, and here. As in all "heisen-debugging", you have to use EIN frequently enough to trigger the backtrace, and upon getting the backtrace, you still won't know what the problem is -- you'll just have a better feel for the situation.

hnisonoff commented 3 years ago

Thanks @dickmao ! Does (when (memq nil (plist-get (slot-value cell 'element) :output)) (backtrace)) get added to the line after the highlighted line?

dickmao commented 3 years ago

after the highlighted line?

No, before. But you can't take my instructions too literally as cell is not even defined in some of those places. You'd need to spend an hour looking at the code to grok why I suggested what I did.

It's not clear whether you have the time or ability to do that. An alternative is to supply the problematic ipynb and to specify the particular cell that when C-c C-c'ed appears to most frequently crash EIN. This route, while least painful for you, is less likely to be successful since I suspect I won't be able to reproduce the problem, i.e., your individual configuration might be necessary for the failure to manifest.

hnisonoff commented 3 years ago

Unfortunately, I do not have the expertise at the moment to do this. I'll try to look out for a way to reproduce the error. It seems to happen very often for me when I am logging things to the console (e.g. using tqdm).

dickmao commented 3 years ago

One thing you could add to your .emacs that should prevent errors:

(use-package ein
  :config
  (with-eval-after-load 'ein-cell
    (add-function :filter-args (symbol-function 'ein:cell--ewoc-delete)
                  (lambda (args)
                    (cl-destructuring-bind (ewoc &rest nodes) args
                      (let* ((clean (delq nil nodes))
                             (found (- (length nodes) (length clean))))
                        (unless (zerop found)
                          (ein:log 'warn "Found %d nils" found))
                        (setq nodes clean))
                      (let* ((clean (delq nil
                                          (mapcar
                                           (apply-partially #'ewoc--filter-hf-nodes ewoc)
                                           nodes)))
                             (found (- (length nodes) (length clean))))
                        (unless (zerop found)
                          (ein:log 'warn "Found %d hf nodes" found))
                        (setq nodes clean))
                      (cons ewoc nodes))))))

Would be interested to know if you ever see "Found ..." warning in your Messages.

hnisonoff commented 3 years ago

I think this crashed my Emacs. Does that happen to make sense to you? I don't see any error messages, just Illegal instruction: 4 in my terminal.

dickmao commented 3 years ago

Does that happen to make sense?

No, I'm afraid not. Elisp should never crash the emacs C binary.

That emacs exposes so many of its internal knobs is the very reason why its fans swear by it (because everything is mutable), and why it will never appeal to the mainstream (because things are too easily broken).

hnisonoff commented 3 years ago

Thanks -- I'll keep you updated if I get any more info. I really appreciate all the work that you and others do on this package.