Skip to content

Serialization of non-ascii characters may result in an incomplete payload being sent across the wire #42

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

Closed
rlubke opened this issue Apr 4, 2022 · 4 comments
Labels
bug Something isn't working

Comments

@rlubke
Copy link
Member

rlubke commented Apr 4, 2022

Describe the bug
When performing a put with a value having a 49308 bytes, appears to be truncated. The client raises "Error: 2 UNKNOWN:".

To Reproduce
Steps to reproduce the behaviour:

Expected behaviour
An error should not be raised.

@rlubke rlubke added the bug Something isn't working label Apr 4, 2022
@rlubke
Copy link
Member Author

rlubke commented Apr 4, 2022

Screen Shot 2022-04-04 at 15 02 07

As can be seen, the message is truncated at line 1e60. On the server side, with coherence.io.json.debug enabled, there is a JSON deserialization error:

UTC notation","pattern":"^20\\d{2}(-|/)((0[1-9])|(1[0-2]))(-|/)((0[1-9])|([1-2][0-9])|(3[0-1]))(T|\\s)(([0-1][0-9])|(2[0-3])):([0-5][0-9]):([0-5][0-9])Z$"}}},"created":{"type":"string","description":"When the event was created"},"changed":{"type":"string","description":"When the event was last changed"},"capacity":{"type":"integer","description":"The maximum number of people who can attend"},"status":{"type":"string","description":"Status of the order","enum":["canceled","live","started","ended","completed","draft"]},"currency":{"description":"The ISO 4217 currency code for this event","type":"string"},"online_event":{"type":"boolean","description":"If this event doesn’t have a venue and is only held online"},"organizer":{"type":"object","description":"Cost object that contains the cost details.","required":["name","gross"],"properties":{"name":{"type":"string","description":"The organizer name"},"description":{"type":"object","description":"The description of the organizer (may be very long and contain significant formatting)","properties":{"text":{"type":"string"},"html":{"type":"string"}}},"url":{"type":"string","description":"The URL to the organizer’s page on Eventbrite"}}},"listed":{"type":"boolean","description":"Listed"},"shareable":{"type":"boolean","description":"Shareable event"},"invite_only":{"type":"boolean","description":"Invite-only"},"show_remaining":{"type":"boolean","description":"Show remaining RSVPs for event"},"tx_time_limit":{"oneOf":[{"type":"integer"},{"type":"null"}],"description":"Time limit"},"logo_id":{"description":"Logo Id","oneOf":[{"type":"string"},{"type":"null"}]},"venue":{"type":"object","description":"Venue"},"category":{"description":"The event’s category (technology, music, science, etc.) ","type":"object"},"subcategory":{"description":"The event’s subcategory","type":"object"},"format":{"description":"The event’s format (type of event: conference, seminar, c

@rlubke
Copy link
Member Author

rlubke commented Apr 4, 2022

Looks like this could be an issue in the grpc C stack. See attached debugging of the http streams. It has the same truncation
Screen Shot 2022-04-04 at 16 08 19

If there is a bug here, it's unlikely to be fixed. We may need to bite the bullet and migrate to the pure Javascript version of the library and verify the behavior there. In the mean time, I'm still investigating possible grpc options that can resolve this.

@rlubke
Copy link
Member Author

rlubke commented Apr 4, 2022

Logged grpc/grpc-node#2079 with the grpc node folks for additional feedback.

@rlubke rlubke closed this as completed Apr 5, 2022
@rlubke rlubke reopened this Apr 5, 2022
@rlubke rlubke changed the title PUT payload may be truncated Serialization of non-ascii characters may result in an incomplete payload being sent across the wire Apr 5, 2022
@rlubke
Copy link
Member Author

rlubke commented Apr 5, 2022

Fix is to no allocate the buffer based on string length and instead call Buffer.from(string) which will produce the expected buffer.

@rlubke rlubke closed this as completed in c141e2a Apr 5, 2022
rlubke added a commit that referenced this issue Apr 5, 2022
…mplete payload being sent across the wire
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant