Closed
Description
Cause
PR 75295 added polls to the standard file descriptors on startup; if they are closed, it attempts to reopen them to /dev/null
. If RLIMIT_NOFILE
is too low, the polling (or opening) will cause an abort.
Reported by @edre on URLO; diagnosed by @cuviper.
The rlimit
could be checked ahead of time.
Code
I tried this Docker configuration
FROM rust:1.48
RUN rustup target add x86_64-unknown-linux-musl
RUN echo 'fn main(){println!("hi");}' > hi.rs; rustc --target x86_64-unknown-linux-musl -o hi hi.rs
RUN python3 -c 'import resource,subprocess;print(subprocess.run(["/hi"],preexec_fn=lambda: resource.setrlimit(resource.RLIMIT_NOFILE, (0,0))))'
I expected to see this happen: Successful execution
Instead, this happened: Process aborted
Version it worked on
It most recently worked on: Rust 1.47
Versions with regression
Rust 1.48 and forward.
Related issues
- Rust's stdio should not ignore EBADF error on non-windows platforms #47271
- Closed standard file descriptors don't generate errors anymore on Unix #88825
@rustbot modify labels: +regression-from-stable-to-stable -regression-untriaged
Metadata
Metadata
Assignees
Labels
Category: This is a bug.Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.Call for participation: Help is requested to fix this issue.Low priorityRelevant to the library API team, which will review and decide on the PR/issue.Performance or correctness regression from one stable version to another.