Skip to content
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

Fixed reflect.Value.Type on zero Value panic when subscription resolver itself panics #417

Conversation

maoueh
Copy link

@maoueh maoueh commented Nov 11, 2020

The internal exec Subscribe method had code to deal with subscription resolver panicking when being called. But when such handling happen, the error is attached to the request object and it never checked later on.

This leads to some zero checks to fail when we try to extract the type from the resolver's channel since this variable was never set. Doing this creates a second panic which is not handled and make the application die.

To fix the issue, we now check if there is errors on the request object before continuing with the rest of the check, if there is errors, it's because a panic occurs and we return the response right away.

…lver itself panicks

The internal exec Subscribe method had code to deal with subscription resolver panicking
when being called. But when such handling happen, the error is attached to the request
object and it never checked later on.

This leads to some zero checks to fail when we try to extract the type from the resolver's
channel since this variable was never set. Doing this creates a second panic which is not
handled and make the application die.

To fix the issue, we now check if there is errors on the request object before continuing
with the rest of the check, if there is errors, it's because a panic occurs and we return
the response right away.
@@ -37,7 +37,7 @@ type extensionser interface {
}

func makePanicError(value interface{}) *errors.QueryError {
return errors.Errorf("graphql: panic occurred: %v", value)
Copy link
Author

Choose a reason for hiding this comment

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

This was causing panic errors to print like graphql: graphql: ... so I removed it. Not other tests failed, so I assume it was never checked.

Can revert is asked for it no problem.

@pavelnikolov
Copy link
Member

@maoueh there seems to be a conflict in this PR. Can you, please, fix it.

@maoueh
Copy link
Author

maoueh commented Nov 12, 2020

Conflicts fixed

@pavelnikolov pavelnikolov merged commit 1f70736 into graph-gophers:master Nov 12, 2020
@pavelnikolov
Copy link
Member

Thank you

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