Fix executor deadlock when IO doesn't support non-ascii characters#2721
Merged
abn merged 4 commits intopython-poetry:masterfrom Aug 25, 2020
Merged
Fix executor deadlock when IO doesn't support non-ascii characters#2721abn merged 4 commits intopython-poetry:masterfrom
abn merged 4 commits intopython-poetry:masterfrom
Conversation
The exception class is UnicodeDecodeError in these versions and also the preceding whitespace doesn't seem to be there. This change makes the regex pattern more accommodating while still asserting that there was an error related to unicode.
abn
approved these changes
Aug 25, 2020
3 tasks
Merged
|
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
My environment happened to have a faulty locale setup and running
poetry installgot stuck for no apparent reason. This PR makes it so that the command doesn't get stuck in similar situations.How to repro against 1.1.0b2
Expected: fails with a nice error
Actual: gets stuck waiting for a
threading.Lockto become available.strace:
Ctrl-C gets it unstuck, but the new package isn't installed (while it's added to pyproject.toml).
With this fix
Note: the expected output in the new test added by this PR includes information about the exception (the "Unicode\w+Error" part) because the
ioobject used in tests doesn't support ansi.On the other hand, when the
ioobject supports ansi andPYTHONIOENCODING=asciiis set like in the case above, the exception handling code tries to write a message that contains a unicode character that cannot be encoded with ascii (•), resulting in no information about the exception getting logged.PYTHONIOENCODING=ascii poetry add filetype | tee /dev/nullis one way to see the exception.A more thorough 'fix' for environments that don't support non-ascii characters might be to add a check for it somewhere earlier in the app, like click does. I'm leaving such changes out of this PR to keep it focused on fixing the deadlock and also because I'm not sure what the desired behavior would be (the app could exit with an error message, or it could switch to a non-ascii output format).
Pull Request Check List
Resolves: no corresponding issue