coreutils icon indicating copy to clipboard operation
coreutils copied to clipboard

`test_closes_file_descriptors` fails on linux with `Too many open files`

Open sylvestre opened this issue 3 years ago • 2 comments

Seems to be a recent regression


---- test_cp::test_closes_file_descriptors stdout ----
current_directory_resolved: 
run: /home/runner/work/coreutils/coreutils/target/debug/coreutils cp -r --reflink=auto dir_with_10_files/ dir_with_10_files_new/
thread 'test_cp::test_closes_file_descriptors' panicked at 'Command was expected to succeed.
stdout = 
 stderr = cp: '/tmp/.tmptcEL3i/dir_with_10_files/0' -> 'dir_with_10_files_new/0': Too many open files (os error 24)
', tests/common/util.rs:176:9


failures:
    test_cp::test_closes_file_descriptors

sylvestre avatar Sep 03 '22 16:09 sylvestre

Assuming dir_with_10_files/0 is visited first (WalkDir says the order is unspecified, but it seems reasonable to assume considering all of the CI builds have the same error), that means there are already too many file descriptors open by the time the directory traversal starts. Maybe another utility is leaking open file descriptors?

jfinkels avatar Sep 04 '22 18:09 jfinkels

With procfs, I listed the fd opened in the test.


fd_count = Ok(13)
FDInfo { fd: 0, mode: 0700, target: Socket(33323) } READ | WRITE | EXECUTE
FDInfo { fd: 1, mode: 0700, target: Socket(33325) } READ | WRITE | EXECUTE
FDInfo { fd: 2, mode: 0700, target: Socket(33327) } READ | WRITE | EXECUTE
FDInfo { fd: 3, mode: 00, target: Path("/proc/7459") } (empty)
FDInfo { fd: 4, mode: 0700, target: Socket(33345) } READ | WRITE | EXECUTE
FDInfo { fd: 5, mode: 0700, target: Socket(33346) } READ | WRITE | EXECUTE
FDInfo { fd: 6, mode: 0500, target: Path("/proc/7459/fd") } READ | EXECUTE
FDInfo { fd: 7, mode: 0500, target: Pipe(38780) } READ | EXECUTE
FDInfo { fd: 8, mode: 0500, target: Path("/proc/7459/fd") } READ | EXECUTE
FDInfo { fd: 9, mode: 0500, target: Pipe(38781) } READ | EXECUTE
FDInfo { fd: 112, mode: 0500, target: Pipe(32982) } READ | EXECUTE
FDInfo { fd: 115, mode: 0300, target: Pipe(32983) } WRITE | EXECUTE
current_directory_resolved: 
run: /home/runner/work/coreutils/coreutils/target/debug/coreutils cp -r --reflink=auto dir_with_10_files/ dir_with_10_files_new/
thread 'test_cp::test_closes_file_descriptors' panicked at 'Command was expected to succeed.
stdout = 
 stderr = cp: '/tmp/.tmpwdY3WX/dir_with_10_files/0' -> 'dir_with_10_files_new/0': Too many open files (os error 24)
', tests/common/util.rs:176:9

sylvestre avatar Sep 07 '22 11:09 sylvestre

I could run successfully on my local machine and the test currently passes in CI. Is this worth keeping around?

kralo avatar Jun 21 '24 21:06 kralo

No, I don't think it makes sense to keep this issue open, hence closing it.

@kralo thanks for the hint :)

cakebaker avatar Jun 22 '24 12:06 cakebaker