Bulk mode for thread/goroutine stacks

50 views
Skip to first unread message

Dmitry Neverov

unread,
Jul 25, 2020, 4:07:31 AM7/25/20
to delve-dev
Would it be possible to add an ability to retrieve stacktraces in bulk mode?

I'd like to build a UI for stacktrace analysis, currently one have to retrieve stacktraces one by one. Maybe additional options in ListGoroutinesIn, something like FillStacktraces (false by default) and AncestorsCount (0 by default)?

alessandr...@gmail.com

unread,
Aug 3, 2020, 8:40:09 AM8/3/20
to delve-dev, Dmitry Neverov
I don't think it's a good idea to make the API less orthogonal.
> --
> You received this message because you are subscribed to the Google Groups "delve-dev" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to delve-dev+...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/delve-dev/46d128a6-7bfe-4608-9678-4628de6e52e9n%40googlegroups.com.
>

Dmitry Neverov

unread,
Aug 3, 2020, 8:46:46 AM8/3/20
to alessandr...@gmail.com, delve-dev
Is a dedicated bulk API call a better idea?

alessandr...@gmail.com

unread,
Aug 3, 2020, 10:51:53 AM8/3/20
to Dmitry Neverov, delve-dev
Is your thinking that you will get better performance? Because my guess is
that you won't.

Dmitry Neverov

unread,
Aug 4, 2020, 9:31:44 AM8/4/20
to alessandr...@gmail.com, delve-dev
Yes I was hoping it will improve performance. I've built a version which dumps stacks one by one and it tooks around 10 seconds to get ~7000 stacks on a local windows machine. I've used this version to dump delve goroutines while it computes the stacks and the busy goroutine always has a prefix like this:


I thought it would be possible to dump goroutines once using proc.GoroutinesInfo and then fill the stacks without calling proc.FindGouroutine. Since stacks usually contain a lot of repeated file and function names, maybe a bulk api call can send them separately and stacks can use ids instead?

Also I wonder why proc.GoroutinesInfo doesn't use cached goroutines if  the start is 0  and count is less than the size of cached goroutines? 

alessandr...@gmail.com

unread,
Aug 4, 2020, 1:02:54 PM8/4/20
to Dmitry Neverov, delve-dev
Interesting! Can you try https://github.com/go-delve/delve/pull/2118 and see
what the bottleneck is then?

Dmitry Neverov

unread,
Aug 5, 2020, 2:36:24 AM8/5/20
to delve-dev
It works faster, now the busy goroutine is in G.Stacktrace as one would expect.
Reply all
Reply to author
Forward
0 new messages