Skip to content

Fix NullReferenceException in TryToCompressRegular method in Span #2602

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

JeremyBessonElastic
Copy link
Collaborator

Fix NullReferenceException in method TryToCompressRegular of Span

Copy link

🤖 GitHub comments

Expand to view the GitHub comments

Just comment with:

  • run docs-build : Re-trigger the docs validation. (use unformatted text in the comment!)

Copy link
Contributor

@gregkalapos gregkalapos left a comment

Choose a reason for hiding this comment

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

Change looks good to me.

It'd be nice to have a test covering this. So far my idea how this could happen: if the span is not sampled, then Context won't be populated. My guess is that the span that causes the nullref here is unsampled. So all the requirements for compression are met, but there is no Context.

@JeremyBessonElastic have you tried reproducing this? I'd try by creating a span that is unsampled, and meets all the requirements for compression (leave span, with short duration).

I'd not spend too much time on it, but maybe worth trying to reproduce it and cover it with a test.

@gregkalapos gregkalapos self-requested a review May 28, 2025 08:02
Copy link
Contributor

@gregkalapos gregkalapos left a comment

Choose a reason for hiding this comment

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

I tried to verify my theory above with unsampled spans - that does not seem to reproduce the issue - this method we fix here is not called for unsampled spans.

With that, I think the best is to merge this and see if this fixes the problem.

@JeremyBessonElastic JeremyBessonElastic merged commit 72774ca into main May 28, 2025
12 of 13 checks passed
@JeremyBessonElastic JeremyBessonElastic deleted the Fix_NullReferenceException_SpanTryToCompressRegular branch May 28, 2025 08:27
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.

2 participants