Skip to content

Conversation

@pmeier
Copy link

@pmeier pmeier commented Oct 28, 2025

Description

Fixes #3254

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

  • unittest

Does This PR Require a Core Repo Change?

  • Yes. - Link to PR:
  • No.

Checklist:

See contributing.md for styleguide, changelog guidelines, and more.

  • Followed the style guidelines of this project
  • Changelogs have been updated
  • Unit tests have been added
  • Documentation has been updated

@pmeier pmeier requested a review from a team as a code owner October 28, 2025 08:48
while spans:
for span in spans:
if not span.parent:
if not span.parent or span.parent.span_id not in span_ids:
Copy link
Author

Choose a reason for hiding this comment

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

Make sure that the parent is part of the spans. If not, treat the child span as root span.

)
trees[trace_id] = Tree(label=f"Trace {trace_id}")
child = trees[trace_id].add(
tree = trees.setdefault(trace_id, Tree(label=f"Trace {trace_id}"))
Copy link
Author

Choose a reason for hiding this comment

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

Avoid recreating the trace tree as now we can enter this branch for multiple spans.

for child in trees[traceid_1].children[0].children
)

def test_no_deadlock(tracer_provider):
Copy link
Author

Choose a reason for hiding this comment

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

This is indeed a non-regression test. However, if you run this with the old version, you will get a deadlock and CI etc. will hang. If that is not acceptable, we should add a timeout mechanism, e.g. pytest-timeout.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah, a quick timeout instead of the longer GH timeout would be nice

Copy link
Author

Choose a reason for hiding this comment

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

Are you ok with me adding pytest-timeout as test dependency?

Copy link
Member

Choose a reason for hiding this comment

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

However, if you run this with the old version, you will get a deadlock and CI etc. will hang. If that is not acceptable

Why wouldn't it be acceptable? Seems OK to me

@xrmx xrmx changed the title prevent deadlock opentelemetry-exporter-richconsole: prevent deadlock Oct 29, 2025

### Fixed

- `opentelemetry-instrumentation-richconsole`: Prevent deadlock when parent span is not part of the batch
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
- `opentelemetry-instrumentation-richconsole`: Prevent deadlock when parent span is not part of the batch
- `opentelemetry-exporter-richconsole`: Prevent deadlock when parent span is not part of the batch

Copy link
Member

@aabmass aabmass left a comment

Choose a reason for hiding this comment

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

Thanks for the clear description and fix!

for child in trees[traceid_1].children[0].children
)

def test_no_deadlock(tracer_provider):
Copy link
Member

Choose a reason for hiding this comment

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

However, if you run this with the old version, you will get a deadlock and CI etc. will hang. If that is not acceptable

Why wouldn't it be acceptable? Seems OK to me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

RichConsoleSpanExporter causes app to freeze

3 participants