Sat 22 Jun 2013 01:55:41 PM UTC, original submission:
Hello,
When find encouters a larger directory which causes an out-of-memory-error in find it exits, without error message and with exitcode 0.
-------------
$ seq -w 0 1914300 | xargs -r touch
$ (ulimit -v 2500 ; exec /usr/bin/find ) ; echo $?
.
0
-------------
This applies to both 4.4.2 and 4.5.11. I have not been able to trigger the behavior with oldfind.
Original report by Ángel González in <http://bugs.debian.org/712792> is quoted below.
cu Andreas
Package: findutils
Version: 4.4.2-4
If a folder has enough entries relative to the available memory, find
doesn't return any of them:
cd folder-with-too-many-entries
$ find
.
$ echo $?
0
$ ls -U | wc -l
1914188
$ ls
ls: memory exhausted
$ find --version
find (GNU findutils) 4.4.2
Copyright (C) 2007 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later
<http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Written by Eric B. Decker, James Youngman, and Kevin Dalley.
Built using GNU gnulib version e5573b1bad88bfabcda181b9e0125fb0c52b7d3b
Features enabled: D_TYPE O_NOFOLLOW(enabled) LEAF_OPTIMISATION FTS()
CBO(level=0)
Other actions are equally oblivious to the contents:
$ find -exec echo '{}' \;
.
Tail of strace find:
...
brk(0x1ad9f000) = 0x1ad9f000
getdents(5, /* 846 entries */, 32768) = 32752
brk(0x1adc0000) = 0x1adc0000
brk(0x1ade1000) = 0x1ade1000
getdents(5, /* 848 entries */, 32768) = 32768
brk(0x1ae02000) = 0x1ae02000
brk(0x1ae23000) = 0x1ae23000
getdents(5, /* 851 entries */, 32768) = 32760
brk(0x1ae44000) = 0x1ae23000
mmap(NULL, 1048576, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS,
-1, 0) = -1 ENOMEM (Cannot allocate memory)
mmap(NULL, 134217728, PROT_NONE,
MAP_PRIVATE|MAP_ANONYMOUS|MAP_NORESERVE, -1, 0) = 0x2b8208005000
munmap(0x2b8208005000, 67088384) = 0
munmap(0x2b8210000000, 20480) = 0
mprotect(0x2b820c000000, 135168, PROT_READ|PROT_WRITE) = -1 ENOMEM
(Cannot allocate memory)
munmap(0x2b820c000000, 67108864) = 0
mmap(NULL, 134217728, PROT_NONE,
MAP_PRIVATE|MAP_ANONYMOUS|MAP_NORESERVE, -1, 0) = 0x2b8208005000
munmap(0x2b8208005000, 67088384) = 0
munmap(0x2b8210000000, 20480) = 0
mprotect(0x2b820c000000, 135168, PROT_READ|PROT_WRITE) = -1 ENOMEM
(Cannot allocate memory)
munmap(0x2b820c000000, 67108864) = 0
brk(0x15285000) = 0x15285000
brk(0x1527d000) = 0x1527d000
close(5) = 0
fchdir(4) = 0
close(4) = 0
close(1) = 0
munmap(0x2b82073d2000, 4096) = 0
close(2) = 0
exit_group(0) = ?
Expected:
find should either run completely or fail with an error on stderr and
non-zero exit code.
|