Skip to content
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

std::io: retry write operation on ErrorKind::WouldBlock #100594

Closed
wants to merge 1 commit into from

Commits on Aug 15, 2022

  1. std::io: retry write operation on ErrorKind::WouldBlock

    If writing to tty when O_NONBLOCK bit is set and the lock to
    tty is held (e.g. multiple threads writing to console), the Linux kernel
    returns -EAGAIN.
    (https://elixir.bootlin.com/linux/v5.19/source/drivers/tty/tty_io.c#L952)
    
    Not accounting for -EAGAIN (i.e. ErrorKind::WouldBlock), results in
    a panic. Its better to retry the write as the other thread could have
    release the lock by then.
    
    Signed-off-by: Usama Arif <[email protected]>
    Reviewed-by: Fam Zheng <[email protected]>
    uarif1 committed Aug 15, 2022
    Configuration menu
    Copy the full SHA
    eb44672 View commit details
    Browse the repository at this point in the history