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

Backwards incompatible change to chunked encoding #495

Closed
jacksontj opened this issue Dec 6, 2017 · 4 comments
Closed

Backwards incompatible change to chunked encoding #495

jacksontj opened this issue Dec 6, 2017 · 4 comments

Comments

@jacksontj
Copy link
Contributor

Recently we attempted to update our dependency on grpc-gateway, but after doing so we noticed that streamed responses where no longer formatted the same on the response. Previously each chunk had a newline at the end, so the clients would simply buffer until a newline, then decode a chunk. After digging into the code it seems that this was changed in b0be3cd -- without much explanation as to why.

The entire commit message is runtime: fix chunk encoding -- which is confusing since it doesn't reference an issue or anything else. At this point this breaks all my clients (meaning I have to remain on an older version) and I'm not even sure this is a change we'd want (as it makes client implementations a bit more of a pain).

I attempted to find an issue explaining the reasoning, but was unsuccessful. IMO that commit should be reverted (although I'd keep the test-- just change it). But if there was a reason to make this change I'd like to understand why.

@achew22
Copy link
Collaborator

achew22 commented Dec 6, 2017

What marshaller are you using? Does it implement the Delimiter interface?

@jacksontj
Copy link
Contributor Author

The default json marshaler. My concern is primarily that the docs say Mapping streaming APIs to newline-delimited JSON streams and upon updating this library (not my code, proto files, or marshaler) there are no longer newlines delimiting chunks. It's also concerning the brevity of the commit message, since it implies that it was fixing something (when it seems to be breaking the documented and previous functionality).

@jacksontj
Copy link
Contributor Author

From looking more in the code it seems that if the json marshaller doesn't implemented the delimited interface it defaults to no delimiter (https://github.com/grpc-ecosystem/grpc-gateway/blob/master/runtime/handler.go#L41) which seems wrong. My expectation would be the default would be a newline (as defined in documentation, and the behavior of previous releases) and if the user wanted to have something else (such as no-delimiter) they'd implement the interface.

jacksontj added a commit to jacksontj/grpc-gateway that referenced this issue Dec 7, 2017
With the addition of the delimiter interface users can now override the
delimiter in the stream. With this additional interface we want to
maintain compatibility-- namely we want to continue using a newline in
the event that the marshaler doesn't implement the new interface (for
backwards compatibility).

Fixes grpc-ecosystem#495
@jacksontj
Copy link
Contributor Author

I've submitted a PR which maintains the new interface, but keeps it backwards compatible.

achew22 pushed a commit that referenced this issue Dec 8, 2017
With the addition of the delimiter interface users can now override the
delimiter in the stream. With this additional interface we want to
maintain compatibility-- namely we want to continue using a newline in
the event that the marshaler doesn't implement the new interface (for
backwards compatibility).

Fixes #495
adasari pushed a commit to adasari/grpc-gateway that referenced this issue Apr 9, 2020
With the addition of the delimiter interface users can now override the
delimiter in the stream. With this additional interface we want to
maintain compatibility-- namely we want to continue using a newline in
the event that the marshaler doesn't implement the new interface (for
backwards compatibility).

Fixes grpc-ecosystem#495
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