bugfindutils - Bugs: bug #39324, exits without error on OOM

 
 

bug #39324: exits without error on OOM

Submitted by:  Andreas Metzler <ametzler>
Submitted on:  Sat 22 Jun 2013 01:55:41 PM UTC  
 
Category:  find Severity:  4 - Important
Item Group:  Wrong result Status:  Fixed
Privacy:  Public Assigned to:  James Youngman <jay>
Originator Name:  Open/Closed:  Closed
Release:  4.4.2 Fixed Release:  4.5.12

Add a New Comment(Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Sun 22 Sep 2013 08:19:05 PM UTC, comment #1:

The bug is fixed by the attached patch, which I just made (to the 4.5.x branch).

(file #29197)

James Youngman <jay>
Project AdministratorIn charge of this item.
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.

Andreas Metzler <ametzler>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by jay (Updated the item)
  •  

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

     

     

    Follow 7 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2013-09-24 jay Open/ClosedOpen => Closed
        Fixed ReleaseNone => 4.5.12
    2013-09-22 jay Attached File- => Added 0001-Issue-an-error-message-when-fts_read-fails.-Fixes-bu.patch, #29197
        Severity3 - Normal => 4 - Important
        StatusNone => Fixed
    2013-09-22 jay Assigned toNone => jay
    2013-06-22 ametzler Carbon-CopyRemoved 20807 => -

    Back to the top


    Powered by Savane 3.3