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

Instrumented function is stopped only once when called by core.async thread/go. #1869

Closed
sjlnk opened this issue Oct 17, 2016 · 2 comments
Closed
Assignees
Labels

Comments

@sjlnk
Copy link

sjlnk commented Oct 17, 2016

Expected behaviour

Get back to the debugger mode after pressing c and calling the instrumented code again from thread or go block. Code should stop on the debugger on each iteration of the loop inside looper function.

Actual behavior

Debugger is initialized only on the first run and cannot be reinitialized again.

Steps to reproduce the problem

(ns tests.core
  (:require
   [clojure.core.async :refer [thread go offer! poll! promise-chan]]))

(defn testfun []
  (println (java.util.Date.)))

(defn looper [exprom]
  (loop []
    (when-not (poll! exprom)
      (testfun)
      (Thread/sleep 3000)
      (recur)))
  (println "exit"))

(comment
  (def exprom (promise-chan))
  (thread (looper exprom))
  (offer! exprom :exit))

Use the snippet above to get into the problematic environment. Call looper in thread or go macro and instrument testfun. After pressing c (for continue) or removing instrumentation (by evaluating testfun definition normally) debugger cannot be reached anymore. I have not found any way to get back to the debugger at this point.

The debugger seems to be working properly when working with java.lang.Thread directly.

Environment & Version information

CIDER version information

commit @0803409

;; CIDER 0.15.0snapshot, nREPL 0.2.12
;; Clojure 1.8.0, Java 1.7.0_111

Lein/Boot version

Leiningen 2.7.1 on Java 1.7.0_111 OpenJDK 64-Bit Server VM

Emacs version

GNU Emacs 25.0.95.1 (x86_64-unknown-linux-gnu, GTK+ Version 3.10.8) of 2016-07-24

Operating system

Linux Mint 17 Qiana, kernel 3.13.0-24-generic

@cch1
Copy link

cch1 commented Aug 4, 2017

I'm seeing something similar with emacs 25 and cider 0.15.0, but core.async is not involved. I'm still trying to find a simple-to-reproduce example, but I thought I'd lend my voice to this issue.

@vspinu
Copy link
Contributor

vspinu commented Aug 4, 2017

I am pretty sure that this is due to the fact how c (continue) is currently implemented within the debugger. In a nutshell, once you press c each time the function is called it's passed through un-entered. There is an issue on this repo talking about "debugger sessions". Should be pretty strightforward to fix as far as I can judge.

@cch1, would be really great if you could isolate an example without core.async.

@expez expez added the debugger label Dec 14, 2017
@vspinu vspinu self-assigned this Oct 15, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants