Skip to content

TcpListener::bind example gets stuck in an infinite loop for non-privileged users #14409

Closed
@glandium

Description

@glandium

It's just using the trait implementations for IoResult<T>, and not handle the errors, so the repeated .incoming() calls all return None immediately, meaning the loop makes no progress.

It would preferably handle the errors, or at least mention that this might happen.

Old description:

Stuck on TcpListener::bind when the underlying bind() syscall fails

Taking the example on http://doc.rust-lang.org/std/io/net/tcp/struct.TcpListener.html and running it as non privileged user (which can't bind port 80) leads to the program stuck on TcpListener::bind according to gdb. Strace shows the bind() syscall returning EACCES, but the rust program just doesn't move or errors out, or whatever. The same happens for EADDRINUSE.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions