Skip to content

fix(profiling): make GenInfo::create non-recursive#17548

Merged
gh-worker-dd-mergequeue-cf854d[bot] merged 2 commits into
mainfrom
kowalski/fix-profiling-make-geninfo-create-non-recursive
Apr 27, 2026
Merged

fix(profiling): make GenInfo::create non-recursive#17548
gh-worker-dd-mergequeue-cf854d[bot] merged 2 commits into
mainfrom
kowalski/fix-profiling-make-geninfo-create-non-recursive

Conversation

@KowalskiThomas

@KowalskiThomas KowalskiThomas commented Apr 15, 2026

Copy link
Copy Markdown
Contributor

Description

This PR fixes the following crash that is still happening in recent versions of ddtrace and that we attribute to small max stack sizes in certain circumstances. The updated version has the same behaviour without needing recursion, at the cost of having to reverse the container before returning.

Error UnixSignal: Process terminated with SEGV_MAPERR (SIGSEGV)
#0   0x00007fc46c0e8b5a GenInfo::create_impl
#1   0x00007fc46c0e8c28 GenInfo::create_impl
#2   0x00007fc46c0e8c28 GenInfo::create_impl
#3   0x00007fc46c0e8c28 GenInfo::create_impl
#4   0x00007fc46c0e8c28 GenInfo::create_impl
#5   0x00007fc46c0e8d2e GenInfo::create
#6   0x00007fc46c0e8da3 TaskInfo::create_impl
#7   0x00007fc46c0e8f90 TaskInfo::create
#8   0x00007fc46c0e911c ThreadInfo::get_all_tasks
#9   0x00007fc46c0e97e2 ThreadInfo::unwind_tasks
#10  0x00007fc46c0edb21 ThreadInfo::sample
#11  0x00007fc46c0edc50 std::_Function_handler<void (_ts*, ThreadInfo&), Datadog::Sampler::sampling_thread(unsigned long)::{lambda(InterpreterInfo&)#1}::operator()(InterpreterInfo&) const::{lambda(_ts*, ThreadInfo&)#1}>::_M_invoke
#12  0x00007fc46c0ea8d0 for_each_thread
#13  0x00007fc46c0ea968 std::_Function_handler<void (InterpreterInfo&), Datadog::Sampler::sampling_thread(unsigned long)::{lambda(InterpreterInfo&)#1}>::_M_invoke
#14  0x00007fc46c0e76ad for_each_interp
#15  0x00007fc46c0ead36 Datadog::Sampler::sampling_thread
#16  0x00007fc46c0eaf9d call_sampling_thread
#17  0x00007fc46eef0ea7 start_thread
#18  0x00007fc46f006adf clone

@KowalskiThomas

Copy link
Copy Markdown
Contributor Author

@codex review

@cit-pr-commenter-54b7da

cit-pr-commenter-54b7da Bot commented Apr 15, 2026

Copy link
Copy Markdown

Codeowners resolved as

ddtrace/internal/datadog/profiling/stack/src/echion/tasks.cc            @DataDog/profiling-python

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 👍

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@KowalskiThomas KowalskiThomas added changelog/no-changelog A changelog entry is not required for this PR. Profiling Continous Profling labels Apr 15, 2026
@KowalskiThomas KowalskiThomas force-pushed the kowalski/fix-profiling-make-geninfo-create-non-recursive branch from 849e827 to edd7420 Compare April 15, 2026 19:55
@datadog-datadog-prod-us1

datadog-datadog-prod-us1 Bot commented Apr 15, 2026

Copy link
Copy Markdown
Contributor

Tests

🎉 All green!

❄️ No new flaky tests detected
🧪 All tests passed

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: 180139b | Docs | Datadog PR Page | Give us feedback!

@KowalskiThomas KowalskiThomas removed the changelog/no-changelog A changelog entry is not required for this PR. label Apr 15, 2026
@KowalskiThomas KowalskiThomas force-pushed the kowalski/fix-profiling-make-geninfo-create-non-recursive branch from edd7420 to 566a997 Compare April 15, 2026 20:58
@KowalskiThomas KowalskiThomas marked this pull request as ready for review April 16, 2026 22:18
@KowalskiThomas KowalskiThomas requested review from a team as code owners April 16, 2026 22:18
@KowalskiThomas KowalskiThomas force-pushed the kowalski/fix-profiling-make-geninfo-create-non-recursive branch 2 times, most recently from 1c83381 to 6f6af88 Compare April 22, 2026 13:50
@KowalskiThomas KowalskiThomas force-pushed the kowalski/fix-profiling-make-geninfo-create-non-recursive branch from 6f6af88 to 180139b Compare April 27, 2026 14:12

@r1viollet r1viollet left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM,
thanks for looking into this and iterating on proposals

@gh-worker-dd-mergequeue-cf854d gh-worker-dd-mergequeue-cf854d Bot merged commit 83bcff4 into main Apr 27, 2026
426 checks passed
@gh-worker-dd-mergequeue-cf854d gh-worker-dd-mergequeue-cf854d Bot deleted the kowalski/fix-profiling-make-geninfo-create-non-recursive branch April 27, 2026 16:54
brettlangdon pushed a commit that referenced this pull request Apr 29, 2026
## Description

This PR fixes the [following crash](https://app.datadoghq.com/error-tracking/issue/a7910426-126f-11f1-8982-da7ad0900002) that is still happening in recent versions of `ddtrace` and that we attribute to small max stack sizes in certain circumstances. The updated version has the same behaviour without needing recursion, at the cost of having to reverse the container before returning. 

```
Error UnixSignal: Process terminated with SEGV_MAPERR (SIGSEGV)
#0   0x00007fc46c0e8b5a GenInfo::create_impl
#1   0x00007fc46c0e8c28 GenInfo::create_impl
#2   0x00007fc46c0e8c28 GenInfo::create_impl
#3   0x00007fc46c0e8c28 GenInfo::create_impl
#4   0x00007fc46c0e8c28 GenInfo::create_impl
#5   0x00007fc46c0e8d2e GenInfo::create
#6   0x00007fc46c0e8da3 TaskInfo::create_impl
#7   0x00007fc46c0e8f90 TaskInfo::create
#8   0x00007fc46c0e911c ThreadInfo::get_all_tasks
#9   0x00007fc46c0e97e2 ThreadInfo::unwind_tasks
#10  0x00007fc46c0edb21 ThreadInfo::sample
#11  0x00007fc46c0edc50 std::_Function_handler<void (_ts*, ThreadInfo&), Datadog::Sampler::sampling_thread(unsigned long)::{lambda(InterpreterInfo&)#1}::operator()(InterpreterInfo&) const::{lambda(_ts*, ThreadInfo&)#1}>::_M_invoke
#12  0x00007fc46c0ea8d0 for_each_thread
#13  0x00007fc46c0ea968 std::_Function_handler<void (InterpreterInfo&), Datadog::Sampler::sampling_thread(unsigned long)::{lambda(InterpreterInfo&)#1}>::_M_invoke
#14  0x00007fc46c0e76ad for_each_interp
#15  0x00007fc46c0ead36 Datadog::Sampler::sampling_thread
#16  0x00007fc46c0eaf9d call_sampling_thread
#17  0x00007fc46eef0ea7 start_thread
#18  0x00007fc46f006adf clone
```


Co-authored-by: thomas.kowalski <thomas.kowalski@datadoghq.com>
emmettbutler pushed a commit that referenced this pull request May 6, 2026
## Description

This PR fixes the [following crash](https://app.datadoghq.com/error-tracking/issue/a7910426-126f-11f1-8982-da7ad0900002) that is still happening in recent versions of `ddtrace` and that we attribute to small max stack sizes in certain circumstances. The updated version has the same behaviour without needing recursion, at the cost of having to reverse the container before returning. 

```
Error UnixSignal: Process terminated with SEGV_MAPERR (SIGSEGV)
#0   0x00007fc46c0e8b5a GenInfo::create_impl
#1   0x00007fc46c0e8c28 GenInfo::create_impl
#2   0x00007fc46c0e8c28 GenInfo::create_impl
#3   0x00007fc46c0e8c28 GenInfo::create_impl
#4   0x00007fc46c0e8c28 GenInfo::create_impl
#5   0x00007fc46c0e8d2e GenInfo::create
#6   0x00007fc46c0e8da3 TaskInfo::create_impl
#7   0x00007fc46c0e8f90 TaskInfo::create
#8   0x00007fc46c0e911c ThreadInfo::get_all_tasks
#9   0x00007fc46c0e97e2 ThreadInfo::unwind_tasks
#10  0x00007fc46c0edb21 ThreadInfo::sample
#11  0x00007fc46c0edc50 std::_Function_handler<void (_ts*, ThreadInfo&), Datadog::Sampler::sampling_thread(unsigned long)::{lambda(InterpreterInfo&)#1}::operator()(InterpreterInfo&) const::{lambda(_ts*, ThreadInfo&)#1}>::_M_invoke
#12  0x00007fc46c0ea8d0 for_each_thread
#13  0x00007fc46c0ea968 std::_Function_handler<void (InterpreterInfo&), Datadog::Sampler::sampling_thread(unsigned long)::{lambda(InterpreterInfo&)#1}>::_M_invoke
#14  0x00007fc46c0e76ad for_each_interp
#15  0x00007fc46c0ead36 Datadog::Sampler::sampling_thread
#16  0x00007fc46c0eaf9d call_sampling_thread
#17  0x00007fc46eef0ea7 start_thread
#18  0x00007fc46f006adf clone
```


Co-authored-by: thomas.kowalski <thomas.kowalski@datadoghq.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Profiling Continous Profling

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants