emacs-ipython-notebook icon indicating copy to clipboard operation
emacs-ipython-notebook copied to clipboard

Notebook won't open (ein:content-query-contents--error REQUEST-STATUS timeout DATA interrupt)

Open dickmao opened this issue 3 years ago • 14 comments

I read the docs regarding trust. It's there to prevent random javascript embedded in cell outputs from executing upon notebook-open (another browser-related thing that doesn't apply to EIN). That's why removing outputs cures the problem. One no-going-back way of doing this is:

jupyter nbconvert --clear-output --inplace foo.ipynb

I've found jupyter trust foo.ipynb can be hit or miss on remote servers since the signature file you just re-permissioned is very likely not the one squirreled away in /opt/conda, or whatever arcane directory the remote server is running out of.

This issue remains open insofar as we need to produce a less cryptic error.

Was #773 #361

dickmao avatar Jan 29 '21 13:01 dickmao

jupyter trust does not help

sam-s avatar May 24 '21 19:05 sam-s

I had the same problem, the notebook had 2-3 figures (file is 2 MB). jupyter trust seems to fix it.

impaktor avatar Jun 16 '21 07:06 impaktor

I get

[error] request--callback: peculiar error [4 times]
ein: [error] ein:content-query-contents--error http://dev-dsk-sdsg-1e-cfbb346a.us-east-1.amazon.com:8080/aps-split.ipynb REQUEST-STATUS timeout DATA interrupt: 2

even after

$ jupyter trust aps-split.ipynb 
Signing notebook: aps-split.ipynb

the notebook is 1,740,383 bytes.

sam-s avatar Jun 16 '21 15:06 sam-s

Moreover, file size does not determine success or failure. I just opened a 2.2MB notebook (the one mentioned above, i.e., it failed before!), but failed to open a 722kB one (neither is trusted - the server was rebooted, apparently, jupyter trust does not persist).

sam-s avatar Jul 06 '21 15:07 sam-s

The abovementioned notebook works, but cannot be saved:

Debugger entered--Lisp error: (error "process request curl no longer connected to pipe; ...")
  process-send-region(#<process request curl> 1 2917121)
  request--curl("http://dev-dsk-sdsg-1e-cfbb346a.us-east-1.amazon.c..." :type "PUT" :headers (("Content-Type" . "application/json") ("User-Agent" . "Mozilla/5.0") ("X-XSRFTOKEN" . "2|c1fc5c61|6d0dd2baa4654b678afe8333c038e3cb|162448...")) :data "{\"type\":\"notebook\",\"name\":\"aps-split.ipynb\",\"path\"..." :success #f(compiled-function (&rest args2) #<bytecode -0x2e42f5c1ea266bc>) :error #f(compiled-function (&rest args2) #<bytecode 0xfb274d250702ed7>) :timeout 1.0 :sync nil :encoding binary :url "http://dev-dsk-sdsg-1e-cfbb346a.us-east-1.amazon.c..." :response #s(request-response :status-code nil :history nil :data nil :error-thrown (error "Timeout") :symbol-status timeout :url "http://dev-dsk-sdsg-1e-cfbb346a.us-east-1.amazon.c..." :done-p nil :settings (:type "PUT" :headers (("Content-Type" . "application/json") ("User-Agent" . "Mozilla/5.0") ("X-XSRFTOKEN" . "2|c1fc5c61|6d0dd2baa4654b678afe8333c038e3cb|162448...")) :data "{\"type\":\"notebook\",\"name\":\"aps-split.ipynb\",\"path\"..." :success #f(compiled-function (&rest args2) #<bytecode -0x2e42f5c1ea266bc>) :error #f(compiled-function (&rest args2) #<bytecode 0xfb274d250702ed7>) :timeout 1.0 :sync nil :encoding binary :url "http://dev-dsk-sdsg-1e-cfbb346a.us-east-1.amazon.c..." :response #21) :-buffer #<buffer  *request curl*-809205> :-raw-header nil :-timer [t 24805 63341 922829 nil request-response--timeout-callback (#21) nil 0] :-backend curl))
  apply(request--curl "http://dev-dsk-sdsg-1e-cfbb346a.us-east-1.amazon.c..." (:type "PUT" :headers (("Content-Type" . "application/json") ("User-Agent" . "Mozilla/5.0") ("X-XSRFTOKEN" . "2|c1fc5c61|6d0dd2baa4654b678afe8333c038e3cb|162448...")) :data "{\"type\":\"notebook\",\"name\":\"aps-split.ipynb\",\"path\"..." :success #f(compiled-function (&rest args2) #<bytecode -0x2e42f5c1ea266bc>) :error #f(compiled-function (&rest args2) #<bytecode 0xfb274d250702ed7>) :timeout 1.0 :sync nil :encoding binary :url "http://dev-dsk-sdsg-1e-cfbb346a.us-east-1.amazon.c..." :response #s(request-response :status-code nil :history nil :data nil :error-thrown (error "Timeout") :symbol-status timeout :url "http://dev-dsk-sdsg-1e-cfbb346a.us-east-1.amazon.c..." :done-p nil :settings #3 :-buffer #<buffer  *request curl*-809205> :-raw-header nil :-timer [t 24805 63341 922829 nil request-response--timeout-callback (#23) nil 0] :-backend curl)))
  request("http://dev-dsk-sdsg-1e-cfbb346a.us-east-1.amazon.c..." :type "PUT" :headers (("Content-Type" . "application/json") ("User-Agent" . "Mozilla/5.0") ("X-XSRFTOKEN" . "2|c1fc5c61|6d0dd2baa4654b678afe8333c038e3cb|162448...")) :data "{\"type\":\"notebook\",\"name\":\"aps-split.ipynb\",\"path\"..." :success #f(compiled-function (&rest args2) #<bytecode -0x2e42f5c1ea266bc>) :error #f(compiled-function (&rest args2) #<bytecode 0xfb274d250702ed7>) :timeout 1.0 :sync nil :encoding binary)
  apply(request "http://dev-dsk-sdsg-1e-cfbb346a.us-east-1.amazon.c..." (:type "PUT" :headers (("Content-Type" . "application/json") ("User-Agent" . "Mozilla/5.0") ("X-XSRFTOKEN" . "2|c1fc5c61|6d0dd2baa4654b678afe8333c038e3cb|162448...")) :data "{\"type\":\"notebook\",\"name\":\"aps-split.ipynb\",\"path\"..." :success #f(compiled-function (&rest args2) #<bytecode -0x2e42f5c1ea266bc>) :error #f(compiled-function (&rest args2) #<bytecode 0xfb274d250702ed7>) :timeout 1.0 :sync nil :encoding binary))
  ein:query-singleton-ajax("http://dev-dsk-sdsg-1e-cfbb346a.us-east-1.amazon.c..." :type "PUT" :headers (("Content-Type" . "application/json")) :data "{\"type\":\"notebook\",\"name\":\"aps-split.ipynb\",\"path\"..." :success #f(compiled-function (&rest args2) #<bytecode -0x2e42f5c1ea266bc>) :error #f(compiled-function (&rest args2) #<bytecode 0xfb274d250702ed7>))
  ein:content-save(#s(ein:$content :url-or-port "http://dev-dsk-sdsg-1e-cfb..." :notebook-version 6 :name "aps-split.ipynb" :path "aps-split.ipynb" :type "notebook" :writable nil :created nil :last-modified nil :mimetype nil :raw-content ((nbformat . 4) (nbformat_minor . 5) (metadata :kernelspec ... :language_info ... :name "aps-split.ipynb") (cells . ...)) :format nil :session-p nil) ein:notebook-save-notebook-success (#s(ein:$notebook :url-or-port "http://dev-dsk-sdsg-1e-cfb..." :notebook-id nil :notebook-path "aps-split.ipynb" :kernel #s(ein:$kernel :url-or-port "http://dev-dsk-sdsg-1e-cfb..." :path "aps-split.ipynb" :kernelspec ... :events #<ein:events ein:events-1ffcafeafe78> :api-version 6 :session-id "dd17ee1a-e952-49ec-abdc-73..." :kernel-id "7244d874-6449-4a0e-88c4-65..." :shell-channel nil :iopub-channel nil :websocket ... :base-url "/api/kernels" :kernel-url "/api/kernels/7244d874-6449..." :ws-url "ws://dev-dsk-sdsg-1e-cfbb3..." :username "username" :msg-callbacks #<hash-table equal 33/65 0x1ffcb1e67737> :oinfo-cache #<hash-table equal 0/65 0x1ffcb1e6e36d> :after-start-hook nil :after-execute-hook nil) :kernelinfo #<ein:kernelinfo ein:kernelinfo-1ffcb02211b8> :kernelspec #s(ein:$kernelspec :name "python3" :display-name "Python 3" :resources ... :spec ... :language "python") :pager "*ein:pager http://dev-dsk-..." :dirty nil :metadata (:kernelspec ... :language_info ... :name "aps-split.ipynb") :notebook-name "aps-split.ipynb" :nbformat 4 :nbformat-minor 5 :events #<ein:events ein:events-1ffcafeafe78> :worksheets (#<ein:worksheet ein:worksheet-1ffcb099dbec>) :scratchsheets nil :api-version 6) nil nil) ein:notebook-save-notebook-error (#s(ein:$notebook :url-or-port "http://dev-dsk-sdsg-1e-cfb..." :notebook-id nil :notebook-path "aps-split.ipynb" :kernel #s(ein:$kernel :url-or-port "http://dev-dsk-sdsg-1e-cfb..." :path "aps-split.ipynb" :kernelspec ... :events #<ein:events ein:events-1ffcafeafe78> :api-version 6 :session-id "dd17ee1a-e952-49ec-abdc-73..." :kernel-id "7244d874-6449-4a0e-88c4-65..." :shell-channel nil :iopub-channel nil :websocket ... :base-url "/api/kernels" :kernel-url "/api/kernels/7244d874-6449..." :ws-url "ws://dev-dsk-sdsg-1e-cfbb3..." :username "username" :msg-callbacks #<hash-table equal 33/65 0x1ffcb1e67737> :oinfo-cache #<hash-table equal 0/65 0x1ffcb1e6e36d> :after-start-hook nil :after-execute-hook nil) :kernelinfo #<ein:kernelinfo ein:kernelinfo-1ffcb02211b8> :kernelspec #s(ein:$kernelspec :name "python3" :display-name "Python 3" :resources ... :spec ... :language "python") :pager "*ein:pager http://dev-dsk-..." :dirty nil :metadata (:kernelspec ... :language_info ... :name "aps-split.ipynb") :notebook-name "aps-split.ipynb" :nbformat 4 :nbformat-minor 5 :events #<ein:events ein:events-1ffcafeafe78> :worksheets (#<ein:worksheet ein:worksheet-1ffcb099dbec>) :scratchsheets nil :api-version 6) nil))
  ein:notebook-save-notebook(#s(ein:$notebook :url-or-port "http://dev-dsk-sdsg-1e-cfbb346a.us-east-1.amazon.c..." :notebook-id nil :notebook-path "aps-split.ipynb" :kernel #s(ein:$kernel :url-or-port "http://dev-dsk-sdsg-1e-cfbb346a.us-east-1.amazon.c..." :path "aps-split.ipynb" :kernelspec #s(ein:$kernelspec :name "python3" :display-name "Python 3" :resources (:logo-32x32 "/kernelspecs/python3/logo-32x32.png" :logo-64x64 "/kernelspecs/python3/logo-64x64.png") :spec (:argv ["/usr/bin/python3" "-m" "ipykernel_launcher" "-f" "{connection_file}"] :env nil :display_name "Python 3" :language "python" :interrupt_mode "signal" :metadata nil :name "python3") :language "python") :events #<ein:events ein:events-1ffcafeafe78> :api-version 6 :session-id "dd17ee1a-e952-49ec-abdc-7344dd7ae4f0" :kernel-id "7244d874-6449-4a0e-88c4-656e6f7571d9" :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 -0x196ea8a8587b0861>) :on-message #f(compiled-function (&rest args2) #<bytecode 0x154504bff2cc9863>) :on-close #f(compiled-function (ws) #<bytecode -0x184dd7910c00d38e>) :on-error #f(compiled-function (ws action err) #<bytecode 0x45924031f5b73af>) :negotiated-protocols nil :negotiated-extensions nil :server-p nil :url "ws://dev-dsk-sdsg-1e-cfbb346a.us-east-1.amazon.com..." :protocols nil :extensions nil :conn #<process websocket to ws://dev-dsk-sdsg-1e-cfbb346a.us-east-1.amazon.com:8080/api/kernels/7244d874-6449-4a0e-88c4-656e6f7571d9/channels?session_id=dd17ee1a-e952-49ec-abdc-7344dd7ae4f0> :server-conn nil :accept-string "zR33+3VybAEj0DZFm92ifFgcfO0=" :inflight-input nil) :kernel #2 :closed-by-client nil) :base-url "/api/kernels" :kernel-url "/api/kernels/7244d874-6449-4a0e-88c4-656e6f7571d9" :ws-url "ws://dev-dsk-sdsg-1e-cfbb346a.us-east-1.amazon.com..." :username "username" :msg-callbacks #<hash-table equal 33/65 0x1ffcb1e67737> :oinfo-cache #<hash-table equal 0/65 0x1ffcb1e6e36d> :after-start-hook nil :after-execute-hook nil) :kernelinfo #<ein:kernelinfo ein:kernelinfo-1ffcb02211b8> :kernelspec #s(ein:$kernelspec :name "python3" :display-name "Python 3" :resources (:logo-32x32 "/kernelspecs/python3/logo-32x32.png" :logo-64x64 "/kernelspecs/python3/logo-64x64.png") :spec (:argv ["/usr/bin/python3" "-m" "ipykernel_launcher" "-f" "{connection_file}"] :env nil :display_name "Python 3" :language "python" :interrupt_mode "signal" :metadata nil :name "python3") :language "python") :pager "*ein:pager http://dev-dsk-sdsg-1e-cfbb346a.us-east..." :dirty nil :metadata (:kernelspec (:argv ["/usr/bin/python3" "-m" "ipykernel_launcher" "-f" "{connection_file}"] :env nil :display_name "Python 3" :language "python" :interrupt_mode "signal" :metadata nil :name "python3") :language_info (:codemirror_mode (:name "ipython" :version 3) :file_extension ".py" :mimetype "text/x-python" :name "python" :nbconvert_exporter "python" :pygments_lexer "ipython3" :version "3.7.9") :name "aps-split.ipynb") :notebook-name "aps-split.ipynb" :nbformat 4 :nbformat-minor 5 :events #<ein:events ein:events-1ffcafeafe78> :worksheets (#<ein:worksheet ein:worksheet-1ffcb099dbec>) :scratchsheets nil :api-version 6))

sam-s avatar Jul 07 '21 18:07 sam-s

I've noticed that if I quickly try to open a notebook again when experiencing this issue (by hitting enter twice or clicking repeatedly on the Open link) and trigger a <Notebook name> pending open! Retry? message and then say y, the notebook will open. Seems like there might be some timeout that is ignored if you say you want to retry?

natsirtguy avatar Aug 04 '21 18:08 natsirtguy

Still experiencing this too.

slackline avatar Sep 03 '21 09:09 slackline

For me the trick was clearing all outputs in the notebook 🤷

grantjenks avatar Sep 15 '21 17:09 grantjenks

Clearing outputs allows me to get into the notebook - but I can't save it after re-running the cells. That's not useful. I really was hoping to get away from that clunky web interface. :-\

[error] request--callback: peculiar error
ein: [error] ein:content-save-error: http://127.0.0.1:8888/api/contents/Case_Study1_Notebook.ipynb peculiar error.
ein: [warn] Failed saving notebook!
ein: [warn] ein:cell-append-mime-type: no viewer method found in mailcap
  • Windows 10 Pro
  • GNU Emacs 29.0.50 (build 1, x86_64-w64-mingw32) of 2021-10-12

nyambol avatar Nov 04 '21 18:11 nyambol

I can report that I have the same issue on linux using emacs28. Clearing the notebook also solves the problem, I have the following jupyter packages:

Selected Jupyter core packages... IPython : 7.26.0 ipykernel : 6.4.1 ipywidgets : 7.6.5 jupyter_client : 6.1.12 jupyter_core : 4.8.1 jupyter_server : 1.10.2 jupyterlab : 3.1.9 nbclient : 0.5.4 nbconvert : 6.1.0 nbformat : 5.1.3 notebook : 6.4.4 qtconsole : 5.1.1 traitlets : 5.1.0

acegallagher avatar Nov 16 '21 00:11 acegallagher

Still a problem. After manually start a jupyter notebook on a remote server and trying to open a notebook with emacs26 get this from *ein:log-all* buffer. This notebook seems to be a bit heavy and take few seconds till be available from browser. It is also a trusted notebook.

18:43:43:261: [info] Login to http://10.41.128.71:8835 complete. @#<buffer *GNU Emacs*>
18:43:44:369: [verbose] Opening notebooklist at http://10.41.128.71:8835 @#<buffer *GNU Emacs*>
18:43:49:938: [verbose] Opening notebooklist at http://10.41.128.71:8835/models @#<buffer *ein:notebooklist http://10.41.128.71:8835*>
18:44:06:913: [verbose] Retry content-query-contents #0 in response to nil @#<buffer *ein:notebooklist http://10.41.128.71:8835*>
18:44:08:422: [verbose] Retry content-query-contents #1 in response to nil @#<buffer *ein:notebooklist http://10.41.128.71:8835*>
18:44:10:432: [verbose] Retry content-query-contents #2 in response to nil @#<buffer *ein:notebooklist http://10.41.128.71:8835*>
18:44:12:941: [error] ein:content-query-contents--error http://10.41.128.71:8835/models/XGBoost_V1.ipynb REQUEST-STATUS timeout DATA interrupt
 @#<buffer *ein:notebooklist http://10.41.128.71:8835*>

matheusvcorrea avatar Dec 15 '21 22:12 matheusvcorrea

This works for me: M-x customize-variable RET ein:query-timeout and modify the de default value to something like 100000 ms and apply this.

matheusvcorrea avatar Dec 16 '21 01:12 matheusvcorrea

increasing the value of ein:query-timeout solved this issue for me as well. thank you @matheusvcorrea

psaris avatar Dec 25 '21 04:12 psaris

I set ein:query-timeout to nil and I still get

[error] request--callback: peculiar error: 403
ein: [error] ein:content-save-error: http://127.0.0.1:8888/api/contents/eeg.ipynb peculiar error: 403.
ein: [warn] Failed saving notebook!

in *Messages* and

[W 11:11:20.920 NotebookApp] 403 POST /api/sessions (127.0.0.1): XSRF cookie does not match POST argument
[W 11:11:20.920 NotebookApp] XSRF cookie does not match POST argument
[W 11:11:20.921 NotebookApp] 403 POST /api/sessions (127.0.0.1) 0.910000ms referer=None

in terminal and

11:11:20:913: [verbose] ein:kernel-session-p--success: session-id=6f0fe42c-9b4c-43df-b74a-1ad2546ae531 session-p=t @#<buffer  *ein: http://127.0.0.1:8888/eeg.ipynb*[python]>
11:11:20:925: [verbose] ein:kernel-retrieve-session--error [error], 2 tries left @#<buffer  *ein: http://127.0.0.1:8888/eeg.ipynb*[python]>
11:11:21:455: [verbose] ein:kernel-retrieve-session--error [error], 1 tries left @#<buffer  *ein: http://127.0.0.1:8888/eeg.ipynb*[python]>
11:11:22:477: [verbose] ein:kernel-retrieve-session--error [error], 0 tries left @#<buffer  *ein: http://127.0.0.1:8888/eeg.ipynb*[python]>

in *ein:log-all*

sam-s avatar Sep 25 '22 15:09 sam-s