Bug 196335 - valgrind: m_libcfile.c:73 (vgPlain_safe_fd): Assertion 'newfd >= VG_(fd_hard_limit)' failed.
Summary: valgrind: m_libcfile.c:73 (vgPlain_safe_fd): Assertion 'newfd >= VG_(fd_hard_...
Status: RESOLVED DUPLICATE of bug 465435
Alias: None
Product: valgrind
Classification: Developer tools
Component: general (show other bugs)
Version: 3.5 SVN
Platform: macOS (DMG) macOS
: NOR major
Target Milestone: wanted3.6.0
Assignee: Julian Seward
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-06-13 15:12 UTC by agilesoftware
Modified: 2023-02-22 07:49 UTC (History)
6 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description agilesoftware 2009-06-13 15:12:17 UTC
Running any program with valgrind , I get :

$ valgrind ls

valgrind: m_libcfile.c:73 (vgPlain_safe_fd): Assertion 'newfd >= VG_(fd_hard_limit)' failed.
==11556==    at 0xF00A974D: ???
==11556==    by 0xF00A98E1: ???
==11556==    by 0xF00AA7E2: ???
==11556==    by 0xF00AE970: ???
==11556==    by 0xF00B03D7: ???
==11556==    by 0xF00B3B3C: ???
==11556==    by 0xF012F7F2: ???

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.

My environment:

valgrind 533 $ uname -a
Darwin potian-pro.local 9.7.0 Darwin Kernel Version 9.7.0: Tue Mar 31 22:52:17 PDT 2009; root:xnu-1228.12.14~1/RELEASE_I386 i386
gcc -v
Using built-in specs.
Target: i686-apple-darwin9
Configured with: /var/tmp/gcc/gcc-5490~1/src/configure --disable-checking -enable-werror --prefix=/usr --mandir=/share/man --enable-languages=c,objc,c++,obj-c++ --program-transform-name=/^[cg][^.-]*$/s/$/-4.0/ --with-gxx-include-dir=/include/c++/4.0.0 --with-slibdir=/usr/lib --build=i686-apple-darwin9 --with-arch=apple --with-tune=generic --host=i686-apple-darwin9 --target=i686-apple-darwin9
Thread model: posix
gcc version 4.0.1 (Apple Inc. build 5490)
Comment 1 Nicholas Nethercote 2009-06-24 07:30:21 UTC
Can you rerun using 'valgrind -v -d' ?  Also, it would be helpful if you could add a VG_(printf)() call just before the failing assertion, in order to print out the values of newfd and VG_(fd_hard_limit).

Thanks.
Comment 2 Tom Hughes 2009-07-02 15:04:51 UTC
Oops - closed wrong bug.
Comment 3 Nicholas Nethercote 2009-07-24 08:45:35 UTC
I marked this as blocking3.5.0, but since the reporter hasn't responded with the requested information, and nobody else has reported the problem, I'm downgrading it to wanted3.5.0.  If we don't hear back by the time 3.5.0 is released, I think we should close it as NEEDSINFO.
Comment 4 Tom Hughes 2011-08-11 14:22:46 UTC
Closing as NEEDSINFO as 3.5.0 has been and gone with no further information supplied.
Comment 5 Laurent Bonnaud 2012-04-04 08:39:15 UTC
This bug is a duplicate of bug #288363 (or the contrary).  Since this one is closed I cannot mark it as such.
Comment 6 fbampaloukas 2019-06-16 13:51:20 UTC
Closing as Worksforme due to inactivity for more than 15 days as per:

https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging#Policies

Fanis
Comment 7 fbampaloukas 2019-06-16 13:57:20 UTC
Closing as Worksforme due to inactivity for more than 15 days as per:

https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging#Policies

Fanis
Comment 8 Tom Hughes 2019-06-16 14:29:42 UTC
Please don't apply KDE policies to non-KDE packages.
Comment 9 Thorsten Glaser 2023-02-22 03:36:02 UTC
A colleage could reproduce this bug today:

I have no name!@9019b147885f:/code$ valgrind --track-origins=yes pytest  
                                                                                                                
valgrind: m_libcfile.c:66 (vgPlain_safe_fd): Assertion 'newfd >= VG_(fd_hard_limit)' failed.
Segmentation fault (core dumped)                                                                                

This is a Debian bookworm Docker image under Arch Linux; even “valgrind false” fails like this.
Comment 10 Paul Floyd 2023-02-22 07:47:29 UTC
Closing this as a duplicate of 465435. See the analysis there.

IMO this is a Docker bug. It lies when it tells us what the file descriptor rlimit is. Then when we try to move one of our internal fds out of the way at the top of this range the fcntl dupfd fails.

*** This bug has been marked as a duplicate of bug 465435 ***
Comment 11 Paul Floyd 2023-02-22 07:49:14 UTC
(not to mention that a bug that was for Darwin 9.7 is probably not the same thing as Linux Docker).