Support migration output messages containing multibyte characters #542
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The Content-Length header should be the number of bytes in the JSON. Since we're operating in
binmode
, the encoding of the JSON will beASCII-8BIT
, so we can use the bytesize method to get the number of bytes.I noticed this when the LSP crashed while running a migration. Turns out that out migration output contained multibyte characters, and that was breaking the the length of the content that was read. The JSON that was read would be truncated because the content-length that was read was too short.
The easiest way to reproduce the problem would be to test with this migration:
The error looked like that:
I also fixed the runner-client for the same symptoms. However, I'm not sure when that implementation of
send_message
is used and didn't find an easy way to add a test. Let me know if this part of the change is required.