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

Fix fatal errors during request parsing #45

Conversation

joechild-pace
Copy link
Contributor

@joechild-pace joechild-pace commented Oct 13, 2022

Any error during the parsing of request message for a unary request would be fatal, so we're catching it and returning a GrpcError in line with the grpc library.

I've had to pin importlib-metadata due to a breaking release for python < 3.8. It looks like the issue will be fixed in the next version of kombu celery/kombu#1601

Annoyingly black was failing in CI due to a compatibility issue, so I've upgraded it. Sorry for the messy diff!

message=message,
)
response_stream.close(error)
return
Copy link
Member

Choose a reason for hiding this comment

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

Might be easier and a bit more DRY to catch this exception and then send it to handle_result?

I also don't think it's accurate to always describe the error that could be happening here as a problem deserialising. "Exception calling application" as in handle_result is generic but probably more correct.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We seem to be promising to return the same status error codes as the grpc library - this is enforced by the tests including the one I added.

I initially had something more like what you're describing, but we don't really have the correct inputs for handle_result available at this point, as well as the error code issue.

Copy link
Member

Choose a reason for hiding this comment

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

Ha, I just noticed that the grpc library uses that message. Cool as it is then.

@joechild-pace joechild-pace marked this pull request as ready for review October 14, 2022 09:17
@joechild-pace joechild-pace force-pushed the fix-fatal-errors-during-request-parsing branch from ee6f976 to 3ec3ba0 Compare October 14, 2022 11:39
Copy link
Member

@mattbennett mattbennett left a comment

Choose a reason for hiding this comment

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

Wonderful!

@mattbennett mattbennett merged commit e58a0bf into nameko:master Oct 14, 2022
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.

None yet

2 participants