Fork me on GitHub
#core-async
<
2024-01-18
>
ghaskins14:01:02

Is there any way to introspect/dump parked go routines?

Ben Sless15:01:01

Flow Storm lets you debug go blocks and inspect their state. A bit haphazard but it works

👍 1
😲 2
Rachel Westmacott10:01:12

I have got some info out of core-async in the past by either grabbing the stack traces

(for [[thread stack] (sort-by #(.getName (key %)) (Thread/getAllStackTraces))
        :when (str/starts-with? (.getName thread) "async-")]
    (let [top-frame (first stack)]
      [(str (.getState thread))
       (.getName thread)
       (count stack)
       (str (.getSimpleName (Class/forName (.getClassName ^StackTraceElement top-frame)))
            "."
            (.getMethodName ^StackTraceElement top-frame))]))
or by introspecting the buffers passed into the channels (which are countable iirc) to see which ones are full / empty. As for the go routines themselves, I've not pushed hard into those. I imagine that print statements or setting values into volatiles might be some ways to get information out of them, but of course it may (slightly) affect how the system runs.

ghadi15:01:02

not yet

😁 1