Fork me on GitHub
#boot
<
2016-06-26
>
richiardiandrea00:06:44

ok so I put (core/cleanup (do (boot.util/warn "Cleanup called\n") (worker-pods :shutdown))) in boot-test and the cleanup code is not called on every watch iteration` but only when exiting the pipeline...there is a :refresh though so pods should be closed there I guess

micha01:06:04

@richiardiandrea: yes we don't want cleanup to be called except when the pipeline finishes

micha01:06:50

cause it's there to clean up the mutable state whose lifetime is one pipeline, like a http server for example

richiardiandrea01:06:15

yes, I figured that out, I went ahead and investigated

richiardiandrea01:06:33

it looks like boot-test is using the pod-pool

richiardiandrea01:06:53

which calls destroy-pod` for each :refresh

richiardiandrea01:06:03

but does not remove them from pod/pods

richiardiandrea01:06:17

it seems like, but I will be sure in a couple of minutes

richiardiandrea01:06:25

might be wrong 😉

micha01:06:43

pod/pods should contain only weak references, i think

richiardiandrea01:06:42

k let me check if that works than

micha01:06:42

but of course if you are looking in pod/pods and holding references to the keys

micha01:06:48

then it can't GC them

richiardiandrea01:06:53

yeah rt.invoke("boot.pod/set-this-pod!", new WeakReference<ClojureRuntimeShim>(rt));

richiardiandrea01:06:42

it is WeakHashMap<ClojureRuntimeShim, Object>

micha01:06:50

yeah i didn't find a weakhashset, which is what we really want

richiardiandrea01:06:30

yeah I saw that new Object()

richiardiandrea01:06:18

if you exec code in the pod in a Thread...and the thread is in a pool...will it keep the references? probably yes

micha01:06:59

man i should have researched that a little more

richiardiandrea01:06:19

it is invoking the operation in a pod in a future...

micha01:06:32

the deref future business is to prevent issues when you call (with-invoke-in p ...) and p is the current pod

micha01:06:08

because calling .invoke avoids some of clojure's thread-local binding machinery

micha01:06:25

and you end up getting a strange error "push without pop"

micha01:06:37

when it tries to pop thread-local bindings twice

micha01:06:45

i mean "pop without push"

micha01:06:26

so we call the pod from another thread, but it should hold references, i wouldn't think

micha01:06:43

ah maybe yeah

richiardiandrea01:06:47

I did a memory dump while the memory was growing and growing and it calls that line...I was investigating the consequences

richiardiandrea01:06:59

maybe I can just spawn a thread there and see what happens

micha01:06:05

clojure futures are run in a cachedthreadpool?

micha01:06:20

maybe the thread is being cached and it's holding a reference

richiardiandrea01:06:30

they run in an agent

richiardiandrea01:06:03

attempting a rough:

(let [pod# ~pod
         value# (atom nil)]
     (if (not= pod# (.get this-pod))
       (.invoke pod# ~(str sym) [email protected])
       (do (doto (Thread. #(reset! value# (.invoke pod# ~(str sym) [email protected])) "My test thread")
             (.start)
             (.join)) 
           value#)))

richiardiandrea01:06:28

uhm scratch that lol

richiardiandrea01:06:36

I am caching myself ahah

richiardiandrea01:06:36

no wait...it should be ok...but still is wrong...

lwhorton04:06:27

hmm I’m not quite sure why, but when trying to include css from cljsjs packages into the target output, nothing seems to work: https://github.com/cljsjs/boot-cljsjs/issues/21 (or) http://hoplon.discoursehosting.net/t/how-do-i-include-the-css-from-a-cljsjs-package/443

lwhorton05:06:06

i tried shift, move, (from-cljsjs), :add-jar, to-resource, but nothing… i dont know if my regex’s are wrong, or i’m configuring things incorrectly, but none of these work:

(from-cljsjs :profile :development) 
    (sift :add-jar {'cljsjs/react-toolbox #".*react-toolbox.css$"})
    (sift :to-resource #{#".*react-toolbox.inc.css"})
    (sift :move {#".*react-toolbox.css$" "css/react-toolbox.css"})