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

Cider debugger hangs on infinite lazy sequences #2621

Closed
yuhan0 opened this issue Apr 5, 2019 · 7 comments · Fixed by clojure-emacs/cider-nrepl#652
Closed

Cider debugger hangs on infinite lazy sequences #2621

yuhan0 opened this issue Apr 5, 2019 · 7 comments · Fixed by clojure-emacs/cider-nrepl#652
Labels

Comments

@yuhan0
Copy link
Contributor

yuhan0 commented Apr 5, 2019

Expected behavior

Using the debugger to step through intermediate forms which produce infinite lazy sequences should not cause Cider to hang indefinitely.

Actual behavior

The debugger attempts to realize the entire lazy sequence when displaying it, the user cannot continue past that point and has to interrupt the evaluation with C-c C-b.

Steps to reproduce the problem

  • Evaluate the form
(let [n 5]
  #dbg
  (take (inc n) (repeat n)))
  • Press n a couple of times when the debugger is activated to step past the intermediate forms
  • Upon reaching the form (repeat n) which produces an infinite lazy sequence, it hangs indefinitely with no way to step past it to the finite result (via take)

Environment & Version information

CIDER version information

;; CIDER 0.22.0snapshot (package: 20190331.2014), nREPL 0.6.0
;; Clojure 1.10.0, Java 12

Lein/Boot version

-NA-

Emacs version

26.1

Operating system

OS X 10.14.4 "Mojave"

@Malabarba
Copy link
Member

Odd. Cider generally avoids printing sequences indefinitely. It could be something in your config, or it could be some pretty-printing change on our side.

What do you see printed if you evaluate (repeat 1) with C-x C-e?

@yuhan0
Copy link
Contributor Author

yuhan0 commented Apr 6, 2019

It displays a finite sequence of (1 1 1 1 ...) truncated at *print-length*.
All the cider-eval and cider-inspect commands work fine with infinite seqs, it's only the debugger which behaves this way.

@bbatsov
Copy link
Member

bbatsov commented Apr 15, 2019

Likely we forgot to pass some print params to the eval commands used by the debugger. This should be a relatively simple fix once someone gets to investigate the problem.

@bbatsov bbatsov added the bug label May 11, 2019
@stale
Copy link

stale bot commented Aug 9, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contribution and understanding!

@stale stale bot added the stale label Aug 9, 2019
@stale
Copy link

stale bot commented Sep 8, 2019

This issues been automatically closed due to lack of activity. Feel free to re-open it if you ever come back to it.

@stale stale bot closed this as completed Sep 8, 2019
@yuhan0
Copy link
Contributor Author

yuhan0 commented Sep 12, 2019

Can this issue be reopened? It's still an existing pain point I regularly face, not only with lazy sequences but also large data structures.
The debugger tries to print the entire structure every step of the way, which leads to very poor performance:

(let [db (apply hash-map (range 100000))]
  #dbg
  (-> db
    (assoc 0 1.0)
    (dissoc 2)
    (update 4 inc)))

@bbatsov bbatsov reopened this Sep 12, 2019
@stale stale bot removed the stale label Sep 12, 2019
@bbatsov
Copy link
Member

bbatsov commented Sep 12, 2019

Of course. We just need to also find someone to tackle it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants