[英]Cider repl has to be restarted if a promise is incorrectly used
I have the following:我有以下内容:
(defn run [path]
(.readFile fs path
(fn [err data]
(go
(let [model (<p! (.load coco-ssd))
predictions
(.detect model
(tf/browser.toPixels
(clj->js {:data (js/Uint32Array. data)
:height 1000
:width 1000})
)
)]
(js/console.log "predictions " (<p! predictions))
)))))
Basically I'm using the tf/browser.toPixels which returns a promise where.detect expects a tensor.基本上我使用的是 tf/browser.toPixels 它返回一个 promise where.detect 需要一个张量。 However, after this error occurs, I'm unable to load the function again in cider after making the edit, and have to restart the repl.但是,发生此错误后,我无法在进行编辑后再次在苹果酒中加载 function,并且必须重新启动 repl。 When I try to reload after making the correction, I get the following:当我在更正后尝试重新加载时,我得到以下信息:
ERROR: Unhandled REPL handler exception processing message {:ns main.core, :file /Users/prikshetsharma/Desktop/cvjs/src/main/core.cljs, :nrepl.middleware.print/quota 1048576, :nrepl.middleware.print/print cider.nrepl.pprint/pr, :op eval, :column 1, :line 10, :id 208, :code (defn run [path]
(.readFile fs path
(fn [err data]
(go
(let [model (<p! (.load coco-ssd))
predictions
(.detect model
(tf/browser.toPixels
(clj->js {:data (js/Uint32Array. data)
:height 1000
:width 1000})
)
)]
(js/console.log "predictions " (<p! predictions))
)))))
, :nrepl.middleware.print/stream? [], :session 98ba8556-ae75-4a15-89f4-7df971632da7}
java.lang.AssertionError: Assert failed: (some? worker)
at shadow.cljs.devtools.server.repl_impl$do_repl.invokeStatic(repl_impl.clj:19)
at shadow.cljs.devtools.server.repl_impl$do_repl.invoke(repl_impl.clj:19)
at shadow.cljs.devtools.server.nrepl_impl$do_cljs_eval.invokeStatic(nrepl_impl.clj:143)
at shadow.cljs.devtools.server.nrepl_impl$do_cljs_eval.invoke(nrepl_impl.clj:131)
at shadow.cljs.devtools.server.nrepl_impl$handle.invokeStatic(nrepl_impl.clj:216)
at shadow.cljs.devtools.server.nrepl_impl$handle.invoke(nrepl_impl.clj:210)
at shadow.cljs.devtools.server.nrepl$middleware$fn__7121.invoke(nrepl.clj:40)
at nrepl.middleware$wrap_conj_descriptor$fn__6103.invoke(middleware.clj:16)
at cider.nrepl$wrap_xref$fn__7491.invoke(nrepl.clj:473)
at nrepl.middleware$wrap_conj_descriptor$fn__6103.invoke(middleware.clj:16)
at cider.nrepl$wrap_slurp$fn__7311.invoke(nrepl.clj:95)
at nrepl.middleware$wrap_conj_descriptor$fn__6103.invoke(middleware.clj:16)
at cider.nrepl$wrap_out$fn__7403.invoke(nrepl.clj:297)
at nrepl.middleware$wrap_conj_descriptor$fn__6103.invoke(middleware.clj:16)
at nrepl.middleware.session$session$fn__6909.invoke(session.clj:272)
at nrepl.middleware$wrap_conj_descriptor$fn__6103.invoke(middleware.clj:16)
at cider.nrepl$wrap_enlighten$fn__7353.invoke(nrepl.clj:163)
at nrepl.middleware$wrap_conj_descriptor$fn__6103.invoke(middleware.clj:16)
at cider.nrepl$wrap_profile$fn__7411.invoke(nrepl.clj:306)
at nrepl.middleware$wrap_conj_descriptor$fn__6103.invoke(middleware.clj:16)
at nrepl.middleware.print$wrap_print$fn__6311.invoke(print.clj:234)
at nrepl.middleware$wrap_conj_descriptor$fn__6103.invoke(middleware.clj:16)
at cider.nrepl$wrap_resource$fn__7427.invoke(nrepl.clj:369)
at nrepl.middleware$wrap_conj_descriptor$fn__6103.invoke(middleware.clj:16)
at shadow.cljs.devtools.server.nrepl$start$fn__7152.invoke(nrepl.clj:138)
at nrepl.server$handle_STAR_.invokeStatic(server.clj:18)
at nrepl.server$handle_STAR_.invoke(server.clj:15)
at nrepl.server$handle$fn__6946.invoke(server.clj:27)
at clojure.core$binding_conveyor_fn$fn__5754.invoke(core.clj:2030)
at clojure.lang.AFn.call(AFn.java:18)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
How to fix this?如何解决这个问题?
This should be fixed in shadow-cljs
version 2.10.15
.这应该在shadow-cljs
版本2.10.15
中修复。
The issue was that node
crashes when any async code throws an exception.问题是当任何异步代码抛出异常时node
崩溃。 shadow-cljs
did not correctly detect that crash and the nREPL session was stuck trying to talk to it. shadow-cljs
没有正确检测到该崩溃,并且 nREPL session 被卡在试图与之交谈。 Now the crashed node
process will be restarted when using node-repl
.现在使用node-repl
时崩溃的node
进程将重新启动。 Your state will still be lost but at least the REPL stays usable.您的 state 仍然会丢失,但至少 REPL 仍然可用。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.