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
Socket.readline hangs when encoding is set #942
Comments
|
The code hangs in the I used the following 2 scripts to reproduce the issue:
|
io_readline_encoded_string() used to wait for max_bytes_per_codepoint bytes, which is 4 in case of UTF-8. However, as UTF-8 is variable-length, there's no guarantee that we'll actually receive that many bytes and we might hang until the stream gets closed.
|
Can this issue be closed? |
|
No. The fix that was merged regressed other stuff and has been reverted: While it did fix alway waiting for the maximal length of bytes in case of variable-length codings (and thus potentially blocking indefinitely), it ended up reading not enough in other cases. The (imo) proper fix turned out to be more involved as I folded the logic into EOF handling. See #944. |
In rakudo/rakudo#107 people complain that Rakudo's Socket.get, which calls parrot's Socket.readline, hangs under certain conditions. Removing the code that sets the handle's encoding (UTF-8 by default) fixes the hang, but of course that's not a satisfactory solution (for reasons outline the rakudo pull request).
The text was updated successfully, but these errors were encountered: