Skip to content

fix(contrib/99designs/gqlgen): fix panic on empty response from response handler#3728

Merged
dd-mergequeue[bot] merged 4 commits into
DataDog:mainfrom
asger-noer:main
Aug 4, 2025
Merged

fix(contrib/99designs/gqlgen): fix panic on empty response from response handler#3728
dd-mergequeue[bot] merged 4 commits into
DataDog:mainfrom
asger-noer:main

Conversation

@asger-noer

Copy link
Copy Markdown
Contributor

The response object was not checked for nil before accessing it in gqlTracer.InterceptOperation. I've added a nil check before checking the length to prevent a panic.

What does this PR do?

Fixes a nil pointer dereference panic in the GraphQL tracer when the response handler returns a nil response. The fix adds a nil check before accessing response.Errors to prevent the panic from occurring.

Motivation

This panic was encountered in production when GraphQL operations were timing out or being cancelled, causing the response handler to return nil. The tracer would then attempt to access response.Errors without checking if response was nil first, leading to a runtime panic.

The issue occurs specifically in scenarios where:

  • GraphQL operations timeout and get cancelled
  • The response handler returns nil due to context cancellation
  • Other error conditions that result in a nil response

This fix ensures the tracer gracefully handles nil responses by checking response != nil before attempting to access its Errors field, consistent with the nil checking pattern used elsewhere in the same function.

…andler

The response object was not checked for nil before accessing it in
`gqlTracer.InterceptOperation`. I've added a nil check before checking
the length to prevent a panic.

@darccio darccio left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM for @DataDog/apm-go

Comment thread contrib/99designs/gqlgen/tracer.go
@rarguelloF
rarguelloF self-requested a review August 4, 2025 12:26
@rarguelloF rarguelloF changed the title contrib/99designs/gqlgen: fix panic on empty response from response handler fix(contrib/99designs/gqlgen): Fix panic on empty response from response handler Aug 4, 2025
@rarguelloF rarguelloF changed the title fix(contrib/99designs/gqlgen): Fix panic on empty response from response handler fix(contrib/99designs/gqlgen): fix panic on empty response from response handler Aug 4, 2025
@rarguelloF

Copy link
Copy Markdown
Contributor

/merge

@dd-devflow-routing-codex

dd-devflow-routing-codex Bot commented Aug 4, 2025

Copy link
Copy Markdown

View all feedbacks in Devflow UI.

2025-08-04 12:28:34 UTC ℹ️ Start processing command /merge


2025-08-04 12:28:44 UTC ℹ️ MergeQueue: waiting for PR to be ready

This merge request is not mergeable yet, because of pending checks/missing approvals. It will be added to the queue as soon as checks pass and/or get approvals.
Note: if you pushed new commits since the last approval, you may need additional approval.
You can remove it from the waiting list with /remove command.


2025-08-04 16:29:07 UTC ⚠️ MergeQueue: This merge request was unqueued

devflow unqueued this merge request: It did not become mergeable within the expected time

@rarguelloF

Copy link
Copy Markdown
Contributor

/merge

@dd-devflow-routing-codex

dd-devflow-routing-codex Bot commented Aug 4, 2025

Copy link
Copy Markdown

View all feedbacks in Devflow UI.

2025-08-04 16:43:52 UTC ℹ️ Start processing command /merge


2025-08-04 16:44:05 UTC ℹ️ MergeQueue: waiting for PR to be ready

This merge request is not mergeable yet, because of pending checks/missing approvals. It will be added to the queue as soon as checks pass and/or get approvals.
Note: if you pushed new commits since the last approval, you may need additional approval.
You can remove it from the waiting list with /remove command.


2025-08-04 16:55:25 UTC ℹ️ MergeQueue: merge request added to the queue

The expected merge time in main is approximately 13m (p90).


2025-08-04 17:07:13 UTC ℹ️ MergeQueue: This merge request was merged

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants