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

server crash if header grpc-accept-encoding is missing #28

Open
truhlik opened this issue Oct 31, 2019 · 2 comments
Open

server crash if header grpc-accept-encoding is missing #28

truhlik opened this issue Oct 31, 2019 · 2 comments

Comments

@truhlik
Copy link

truhlik commented Oct 31, 2019

If client does not send header "grpc-accept-encoding" then the server crash. Bellow is stacktrace:

�[36mmailing_1  |�[0m   File "/usr/local/lib/python3.7/site-packages/eventlet/greenthread.py", line 181, in wait
�[36mmailing_1  |�[0m     return self._exit_event.wait()
�[36mmailing_1  |�[0m   File "/usr/local/lib/python3.7/site-packages/eventlet/event.py", line 132, in wait
�[36mmailing_1  |�[0m     current.throw(*self._exc)
�[36mmailing_1  |�[0m   File "/usr/local/lib/python3.7/site-packages/eventlet/greenthread.py", line 221, in main
�[36mmailing_1  |�[0m     result = function(*args, **kwargs)
�[36mmailing_1  |�[0m   File "/usr/local/lib/python3.7/site-packages/nameko_grpc/connection.py", line 76, in run_forever
�[36mmailing_1  |�[0m     self.request_received(event)
�[36mmailing_1  |�[0m   File "/usr/local/lib/python3.7/site-packages/nameko_grpc/entrypoint.py", line 56, in request_received
�[36mmailing_1  |�[0m     request_stream.headers.get("grpc-encoding"),
�[36mmailing_1  |�[0m   File "/usr/local/lib/python3.7/site-packages/nameko_grpc/compression.py", line 46, in select_algorithm
�[36mmailing_1  |�[0m     if encoding in acceptable_encodings:
�[36mmailing_1  |�[0m TypeError: argument of type 'NoneType' is not iterable

The problem is within this line and is obvious:

if encoding in acceptable_encodings:

I can contribute with PR if you would like to.

@mattbennett
Copy link
Member

@truhlik sorry for not replying to this sooner!

I guess we should assume identity if the header is missing, although I don't know if omitting the header is allowable according to the spec?

@truhlik
Copy link
Author

truhlik commented Feb 8, 2020

I am not well familiar with specs, maybe you are right. The fallback, if header is missing, is up to you.
But the main problem is that nameko fail completely if this request (without header) is received.
I would be OK also with some kind of error message if header is missing.

BTW check frepond@188f9e5

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

No branches or pull requests

2 participants