Skip to content

Timeouts when parsing messages in redis/asyncio can corrupt connection #2513

Closed
@kristjanvalur

Description

@kristjanvalur

In pull requests #2295 and #2360 I made significant change on the way timeouts are handled in the async Connection, bringing it more in line with regular Python asyncio practices. In particular, we got rid of the unfortunate can_read() function which was a holdover from the synchronous implementation.

Unfortunately, a problem was introduced:
If an asyncio.TimeoutError was raised during the IO of a message, when using the PythonParser, the connection would be left in an unusable state. This is in constrast to the HiredisParser, where IO and parsing are separate.

The fix is relatively simple. PythonParser needs to be resumable, if it is interrupted in the middle of parsing a single message. Two alternative PRs address this: #2510 and #2512, which differ only in the architectural details of how to achieve this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions