Hi Ben,

But the example doesn't have any state in def's, hence I thought it did
conform to Stuart's workflow. In my (more) real app I am trying to follow
his workflow protocol and it was reloading fine but now is not maybe i need
to read the link again,

Thanks


On Fri, Sep 27, 2013 at 2:06 PM, Ben Mabey <b...@benmabey.com> wrote:

> Hi Russell,
> This doesn't look like a core.async specific problem, but rather the more
> general problem that protocols and records are not reload safe.  What I
> believe is happening is the TimeoutQueueEntry type is being recompiled when
> you do reload all but old instances with the older compilation remain in
> core.async's DelayQueue.
>
> In order to fix this you would need to recreate the internal DelayQueue
> that core.async uses to store the timeouts.  Luckily, this will happen for
> you automatically if you use tools.namespace and adopt a workflow as
> explained by Stuart Sierra in this blog post:
>
> http://thinkrelevance.com/**blog/2013/06/04/clojure-**workflow-reloaded<http://thinkrelevance.com/blog/2013/06/04/clojure-workflow-reloaded>
>
> Keep in mind that this remove any timeouts you may be awaiting on but I
> think that is probably the desired effect since you are trying to get a
> clean state of the system.
>
> HTH,
> Ben
>
>
> On 9/27/13 11:49 AM, Russell Christopher wrote:
>
>> Anyone encountered after a few reloads at the repl core.async stops
>> working.?
>>
>> Thanks
>>
>> (ns repl.core
>>   (:require [clojure.core.async :refer :all])) ;;0.1.0-SNAPSHOT
>>
>> (defn producer[c]
>>   (Thread/sleep 1000)
>>   (go (>! c true))
>>   (println "sleeping")
>>   (Thread/sleep 10000))
>>
>> (defn consumer [c]
>>   (let [res (alts!! [c (timeout 2000)])]
>>     (if (= c (second res))
>>       (println "true")
>>       (println "timeout"))))
>>
>> (defn main []
>>   (let [c (chan)]
>>     (future (producer c))
>>     (consumer c)))
>>
>> nREPL server started on port 50616 on host 127.0.0.1
>> REPL-y 0.2.1
>> Clojure 1.5.0
>>     Docs: (doc function-name-here)
>>           (find-doc "part-of-name-here")
>>   Source: (source function-name-here)
>>  Javadoc: (javadoc java-object-or-class-here)
>>     Exit: Control+D or (exit) or (quit)
>>
>> user=> (require '[repl.core :as r] :reload-all)
>> nil
>> user=> (r/main)
>> sleeping
>> true
>> nil
>> user=> (require '[repl.core :as r] :reload-all)
>> nil
>> user=> (r/main)
>> sleeping
>> true
>> nil
>> user=> Exception in thread "clojure.core.async.timers/**timeout-daemon"
>> java.lang.ClassCastException: clojure.core.async.i
>> mpl.timers.TimeoutQueueEntry cannot be cast to clojure.core.async.impl.**
>> timers.TimeoutQueueEntry
>>         at clojure.core.async.impl.**timers$timeout_worker.invoke(**
>> timers.clj:61)
>>         at clojure.lang.AFn.run(AFn.java:**24)
>>         at java.lang.Thread.run(Unknown Source)
>>
>>
>> user=> (require '[repl.core :as r] :reload-all)
>> nil
>> user=> (r/main)
>> sleeping
>> true
>> nil
>> user=> (require '[repl.core :as r] :reload-all)
>> nil
>> user=> (r/main)
>>
>> ClassCastException clojure.core.async.impl.**timers.TimeoutQueueEntry
>> cannot be cast to clojure.core.async.impl.**timers.Tim
>> eoutQueueEntry  clojure.core.async.impl.**timers.TimeoutQueueEntry
>> (timers.clj:33)
>> user=> sleeping
>> --
>> --
>> You received this message because you are subscribed to the Google
>> Groups "Clojure" group.
>> To post to this group, send email to clojure@googlegroups.com
>> Note that posts from new members are moderated - please be patient with
>> your first post.
>> To unsubscribe from this group, send email to
>> clojure+unsubscribe@**googlegroups.com<clojure%2bunsubscr...@googlegroups.com>
>> For more options, visit this group at
>> http://groups.google.com/**group/clojure?hl=en<http://groups.google.com/group/clojure?hl=en>
>> ---
>> You received this message because you are subscribed to the Google Groups
>> "Clojure" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to 
>> clojure+unsubscribe@**googlegroups.com<clojure%2bunsubscr...@googlegroups.com>
>> .
>> For more options, visit 
>> https://groups.google.com/**groups/opt_out<https://groups.google.com/groups/opt_out>
>> .
>>
>
> --
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from this group, send email to
> clojure+unsubscribe@**googlegroups.com<clojure%2bunsubscr...@googlegroups.com>
> For more options, visit this group at
> http://groups.google.com/**group/clojure?hl=en<http://groups.google.com/group/clojure?hl=en>
> --- You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to 
> clojure+unsubscribe@**googlegroups.com<clojure%2bunsubscr...@googlegroups.com>
> .
> For more options, visit 
> https://groups.google.com/**groups/opt_out<https://groups.google.com/groups/opt_out>
> .
>

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to