Skip to content

Race condition between wait_for and socket.read() #17351

Open
@mzakharo

Description

@mzakharo

Port, board and/or hardware

esp32 esp32c6-devkit-c1

MicroPython version

v1.25.0

Reproduction

await asyncio.wait_for(socket.readexactly(1), 0.01)

Expected behaviour

Either a timeout occurs, or 1 byte is read from socket

Observed behaviour

Occasionally, both 1 byte is read AND immediately timeout occurs. leading to data loss, since Timeout Exception prevents the read byte from being available to the application.

Additional Information

Possibly related to #7386 and #8717

Code of Conduct

Yes, I agree

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