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

 
 

bug #39324: exits without error on OOM

Submitted by:  Andreas Metzler <ametzler>
Submitted on:  Sat Jun 22 13:55:41 2013  
 
Category: findSeverity: 4 - Important
Item Group: Wrong resultStatus: Fixed
Privacy: PublicAssigned to: James Youngman <jay>
Originator Name: Open/Closed: Closed
Release: 4.4.2Fixed Release: 4.5.12

Add a New Comment (Rich MarkupRich Markup):
   

You are not logged in

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

 

Sun Sep 22 20:19:05 2013, 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 Jun 22 13:55:41 2013, 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 File(s):
   
   
Comment:
   

 

Depends on the following items: None found

Items that depend on this one: None found

 

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

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

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 7 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Tue Sep 24 22:04:28 2013jayOpen/ClosedOpen=>Closed
      Fixed ReleaseNone=>4.5.12
    Sun Sep 22 20:19:05 2013jayAttached File-=>Added 0001-Issue-an-error-message-when-fts_read-fails.-Fixes-bu.patch, #29197
      Severity3 - Normal=>4 - Important
      StatusNone=>Fixed
    Sun Sep 22 10:58:29 2013jayAssigned toNone=>jay
    Sat Jun 22 13:55:55 2013ametzlerCarbon-CopyRemoved 20807=>-

    Back to the top


    Powered by Savane 3.1-cleanup