Valgrind problem: Assertion 'newfd >= VG_(fd_hard_limit)' failed. #30968

Closed
nchelluri opened this Issue Jul 20, 2014 · 3 comments

Projects

None yet

3 participants

@nchelluri

I followed the instructions in https://github.com/Homebrew/homebrew/wiki/troubleshooting . After running brew update and brew doctor (I fixed some issues, had to move a few PCRE dylibs and .la files -- not sure why or what that's about...), here's my debug gist: https://gist.github.com/nchelluri/32f722ec63ce14972897

On http://valgrind.org/docs/manual/quick-start.html I found a sample C program to use for testing. I tried running it using Valgrind and it failed with the assertion described. Here is the output:

testing $ ll
total 8
-rw-r--r--  1 nchelluri  staff  239 20 Jul 01:53 valgrind-test.c
testing $ cat valgrind-test.c 
#include <stdio.h>
#include <stdlib.h>

void f(void)
{
    int* x = malloc(10 * sizeof(int));
    x[10] = 0; // problem 1: heap block overrun
               // problem 2: memory leak -- x not freed
}

int main()
{
    f();
    return 0;
}
testing $ cc valgrind-test.c -o valgrind-test -g
testing $ ll
total 32
-rwxr-xr-x  1 nchelluri  staff  8848 20 Jul 02:10 valgrind-test*
-rw-r--r--  1 nchelluri  staff   239 20 Jul 01:53 valgrind-test.c
drwxr-xr-x  3 nchelluri  staff   102 20 Jul 02:10 valgrind-test.dSYM/
testing $ valgrind ./valgrind-test

valgrind: m_libcfile.c:73 (Int vgPlain_safe_fd(Int)): Assertion 'newfd >= VG_(fd_hard_limit)' failed.
==80571==    at 0x23803B515: ???
==80571==    by 0x23803B4C9: ???
==80571==    by 0x23803B80C: ???
==80571==    by 0x238040F5C: ???
==80571==    by 0x2380405D5: ???
==80571==    by 0x238040543: ???

sched status:
  running_tid=0


Note: see also the FAQ in the source distribution.
It contains workarounds to several common problems.
In particular, if Valgrind aborted or crashed after
identifying problems in your program, there's a good chance
that fixing those problems will prevent Valgrind aborting or
crashing, especially if it happened in m_mallocfree.c.

If that doesn't help, please report this bug to: www.valgrind.org

In the bug report, send all the above text, the valgrind
version, and what OS and version you are using.  Thanks.

testing $ 
@jacknagel

valgrind doesn't officially support 10.9 (they claim only minimal support for 10.9). Compatibility in the formula is provided by an unofficial patch, and is sketchy at best, so I think the best place to report this is to valgrind itself.

@jacknagel

Closing since I don't think we can do anything here until upstream gets their 10.9 story sorted out.

@jacknagel jacknagel closed this Jul 28, 2014
@nchelluri

I just wanted to say, on the same system, today I just ran brew doctor and did some minor cleanup it asked for (brew update, brew prune, brew install of some missing stuff), ran brew install valgrind, compiled the test file, and ran valgrind ./valgrind-test again.

This time it worked perfectly. 👍

EDIT: I just checked, I am on 10.10.5 (14F27) right now. This is the same machine, though, with no formats/reinstalls since the last attempt.

@xu-cheng xu-cheng locked and limited conversation to collaborators Feb 17, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.