Comments (4)
Hi @rschmukler,
thanks for opening an issue. I haven't seen this myself so far while working with and on the stacktrace middleware.
I tried to see what is happening when an exception occurs in the handler. I added a (/ 1 0)
form at the beginning of the handle-analyze-stacktrace-op
and called it with Cider. When this is happening I see the exception in the *nrepl-server*
, but my REPL still stays intact.
If this is an issue with the exception analysis, we need to track down which exception is causing this. Do you see anything in the *nrepl-server*
buffer when this is happening? Something like ERROR: Unhandled REPL handler exception processing message ...
?
If not, could you please try this branch [1] and again look at the *nrepl-server*
buffer. If you find anything there, please post it on this issue.
[1] https://github.com/r0man/cider-nrepl/commits/try-catch
from cider-nrepl.
@r0man thank you so much for taking a look at this. I realize it's a somewhat abstract problem and it may have nothing to do with you; so again, thank you for giving it your attention.
I have a repo / sequence of evaluations in which I can now get it to reliably trigger the error. This enabled me to start adding println
s to everything to see where the error actually arises.
So, as it turns out, there is no exception thrown - instead the function actually freezes.
After a lot of debugging, I have narrowed it down to an interaction between delay
, pmap
and changing the send-off
executor (which is used by pmap
) to the (Executors/newVirtualThreadPerTaskExecutor)
(a JDK 19 preview feature w/ Loom).
This interaction can be seen with the use of pmap inside analyze-stacktrace-data and the delay used by ns-common-prefix in haystack.
I suspect it might be some weird interaction with haystack being an inlined dependency.
Anyway, I believe I created a repo that can be used for a minimal reproduction. Note that you will need OpenJDK 19 to test it. This likely isn't an issue with haystack or nrepl itself - perhaps something w/ Clojure or even the JDK itself. Let me know if you investigate further or have any ideas on how best to proceed.
Thanks again for your time.
from cider-nrepl.
A real time update, just in case anyone happens to be looking:
It looks like the issue is the number of nested pmap
calls (both within haystack and orchard) once the executor has been changed. Still digging further down the call stack, but I can trigger a freeze w/ minimal reproduction for now, w/ JDK 19 with --enable-preview
(let [n 50]
(->> (range n)
(pmap
(fn [_]
(->> (range n)
(pmap (fn [_]
(->> (range n)
(pmap (fn [_]
(pmap identity (range n))))))))
))
(into #{})))
from cider-nrepl.
Probably the final comment w/ regards to cider-nrepl. This looks to be an issue with Project Loom more than anything. As I said above, orchard and haystack make heavy use of pmap
but it seems like recursive thread thread spawning can cause loom to lock up pretty easily. I'll see about how to file an issue with them. A minimal reproduction:
(defn ppmap
[f coll]
(->> coll
(mapv
(fn [x]
(let [cf (java.util.concurrent.CompletableFuture.)]
(Thread/startVirtualThread
(bound-fn []
(try
(.complete cf (f x))
(catch Exception e
(.completeExceptionally cf e)))))
cf)))
(map deref)))
(let [n 4]
(->> (range n)
(ppmap
(fn [_]
(->> (range n)
(ppmap (fn [_]
(->> (range n)
(ppmap (fn [_]
(ppmap identity (range n))))
(apply concat)
(into #{}))))
(apply concat)
(into #{}))))
(apply concat)
(into #{})))
Thanks again for taking a look.
from cider-nrepl.
Related Issues (20)
- Rebind `*print-namespace-maps*` HOT 3
- cider apparently has a dependency on com.billpiel/sayid HOT 8
- Improve `eldoc-reply` with Compliment's type inference
- Implement `cider-doc` for keywords HOT 1
- cider Atom print-method bricking shadow-cljs UI Inspect HOT 11
- `inspect-get-path` op not working as expected HOT 2
- Haystack slow on first hits HOT 1
- Warmup Orchard caches for project Java imports
- CI matrix doesn't hit clojures other than 1.11
- The cache initialized can perform side-effectful `Class/forName`s HOT 5
- Name collision causes an exception during debugging HOT 2
- `make repl` fails to start a REPL with Leiningen 2.11.x HOT 10
- Support for custom `cider-ns-refresh-fn` HOT 15
- info: support custom var-meta whitelists
- nrepl fails with "No such namespace: orchard.java.parser-utils" HOT 2
- `info`: support user-extensible documentation providers HOT 3
- Clojure 1.8 support broken with CI update HOT 3
- The debugger returns the wrong `coor` for atoms HOT 3
- cider-doc: understand http links HOT 2
- `middleware.refresh` / Haystack can get stuck printing HOT 9
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cider-nrepl.