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

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

Closed
glandium opened this issue May 24, 2014 · 10 comments
Closed

Comments

@glandium
Copy link
Contributor

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.

@sfackler
Copy link
Member

What OS and rust version? rustc --version should give that info.

@alexcrichton
Copy link
Member

Closing, this is just the specific example itself. It's not suck in bind, but rather suck in an infinite loop. The for loop in the example is continuously yielding errors which are being ignored.

@huonw
Copy link
Member

huonw commented May 25, 2014

Reopening, because I think the example should either mention that, or handle errors properly, because I'm sure @glandium isn't going to be the only one to hit this.

@huonw huonw reopened this May 25, 2014
@huonw huonw added the A-docs label May 25, 2014
@huonw huonw changed the title Stuck on TcpListener::bind when the underlying bind() syscall fails TcpListener::bind example gets stuck in an infinite loop for non-privileged users May 25, 2014
@huonw
Copy link
Member

huonw commented May 25, 2014

(I updated the title/description.)

@ben0x539
Copy link
Contributor

Maybe incoming should return an empty iterator if called on a an IoResult that's Err(...)?

@glandium
Copy link
Contributor Author

Maybe the example could use try!

@steveklabnik
Copy link
Member

Is this still a relevant issue?

@ben0x539
Copy link
Contributor

It still reproduces.

Using the transparent trait implementations on IoResult like this seem like fairly opaque style.

@aturon
Copy link
Member

aturon commented Aug 22, 2014

cc me

@steveklabnik
Copy link
Member

With new io, this now fails on the unwrap.

bors added a commit to rust-lang-ci/rust that referenced this issue Jun 5, 2023
minor: Add user facing command for reloading proc-macros in VSCode
bors added a commit to rust-lang-ci/rust that referenced this issue Jun 5, 2023
…-reload-proc-macros-command, r=Veykril

finish renaming `rust-analyzer/reloadProcMacros` to `rust-analyzer/rebuildProcMacros`

I was trying out rust-lang#14409, but noticed that actually _running_ that command resulted in VS Code raising an error. This allows me to successfully run `rust-analyzer/rebuildProcMacros`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants