Structured Concurrency - Stacktrace in tree hierarchical structure

Ron Pressler ron.pressler at oracle.com
Wed Nov 27 18:42:58 UTC 2024


Hi.

Capturing the stacks of all “parent” threads when obtaining the stack trace for the current thread is expensive and not trivial.

However, the way *exceptions* are propagated through STS will result in the relevant “parent” stack traces being accumulated (as you’d want) in the process of wrapping the exception and propagating it.

— Ron

> On 27 Nov 2024, at 18:14, Abdul Muneer K <abdul.kolarkunnu at gmail.com> wrote:
> 
> Hi,
> I prepared a StructuredTaskScope in a tree hierarchical structure as below:
>                         TaskA
>                            __|__
>                  TaskB             Tasks
>                ___|__.               __|___
>            TaskD.  TaskE.   TaskF .     TaskG
> 
> [Not sure it will show as a tree while sending email because of formatting, basically it's a three level full tree.]
> 
> I captured the stack trace using the below command while running this sample code with some delays on each task, so that I can capture thread dumps with all of these tasks in the running state.
> I ran below command to get thread dumps in json format:
> jcmd <pid> Thread.dump_to_file -format=json <file>
> 
> I got the thread dump, my expectation was, threads will follow the same tree structure in thread dump also. We can track it based on the fields "owner" and "parent". But, it will be difficult to follow based on these fields if we have too many threads.
> Is it designed like that because of any limitations? Or am I missing an
> 
> Thanks and Regards,
> Muneer
>  



More information about the loom-dev mailing list