I'm experiencing this weird behavior in my app- when restarting the 
components of my app some have a core.async channel and a go-loop inside.

When trying to close! these channels the cpu usage of my app goes way up, 
and stays up- as if the loop does some polling.

I prepared a minimal example 
here: https://github.com/tuhlmann/async-close-problem

The problem occurs only if the channel has a go-loop or a "while true" loop 
inside, otherwise closing the channel works fine.

I experience the problem on both Windows and Unix.

To reproduce:

git clone https://github.com/tuhlmann/async-close-problem

cd async-close-problem
lein repl
;; open a top or process view in another terminal

(start-chan)
;; confirm used cpu for the Java process is very low

(stop-chan)
;; watch used cpu go way up


The go block is very simple:

(a/go
(while true
(when-let [document (a/<! channel)]
(println "New document to render: " (pr-str document)))))

"channel" is the one I close with (a/close! channel)

In this example I do not send anything into the channel, just starting it 
up and closing it down.

Am I doing something wrong?

Thanks,
Torsten.

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
[email protected]
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 [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to