Closed GoogleCodeExporter closed 9 years ago
The problem seems to be that execve can do malloc operations, so when you fork,
bot
the parent process and the child process (which is trying to run execve) can
fight
for the lock used by the heap-checker. The fix is to turn off heap-checking in
the
child. I will have that be a part of the next perftools release; it should fix
this
problem.
Original comment by csilv...@gmail.com
on 30 Mar 2009 at 11:21
In my setup (with my libc), you have to turn off the various hooks in the parent
_before_ the fork(); it's not sufficient to turn off in the child after the
fork()
but before the exec().
The fork() itself causes various allocations via the nss_ldap lib (most likely
through getpwuid() or similar).
Original comment by mrab...@gmail.com
on 31 Mar 2009 at 6:18
Ugh, that's too bad. Thanks for the heads up; I'll make the relevant changes.
Original comment by csilv...@gmail.com
on 31 Mar 2009 at 6:20
This is fixed in perftools 1.2, just released.
Original comment by csilv...@gmail.com
on 18 Apr 2009 at 12:15
I still get a freeze with 1.2 with the heap leak checker (freezes on the
HEAPCHECK=normal test). The attached patch fixes the problem for me in 1.2.
Original comment by mrab...@gmail.com
on 11 May 2009 at 11:40
Attachments:
Original comment by csilv...@gmail.com
on 12 May 2009 at 4:14
Doh! -- I see the problem: when I cancel the hooks (in heap-checker.cc), I
neglected
to cancel the Delete hook. In fact, I didn't cancel the new hook correctly
either.
I'm a bit surprised folks don't see a crash there. I think it's because I only
assert() correctness, and most folks don't run with assertions on (maybe?)
I'll fix this for the next release -- hopefully for real, this time!
(btw, the patch you have isn't safe -- users can trigger a leak-check at any
time,
and if they trigger one while other threads are running, then disabling the
hooks at
symbolize time, like you do, will mess up the data-collecting on all other
threads.
For that reason, I ended up with a fix that only disables the hooks for the
end-of-program (atexit) leak-check. My mistake was not disabling all the
hooks.)
Original comment by csilv...@gmail.com
on 12 May 2009 at 4:27
Can you try the following patch, and see if it fixes the problem for you? If
so,
I'll make it part of the next release.
--- /tmp/tmp.20891.15 2009-05-12 16:08:41.000000000 -0700
+++ /home/csilvers/opensource/google-perftools/src/heap-checker.cc 2009-05\
-12 16:06:21.713200000 -0700
@@ -1724,6 +1724,10 @@
// typically only want to report once in a program's run, at the
// very end.
CancelInitialMallocHooks();
+ if (MallocHook::GetNewHook() == NewHook)
+ MallocHook::SetNewHook(NULL);
+ if (MallocHook::GetDeleteHook() == DeleteHook)
+ MallocHook::SetDeleteHook(NULL);
have_disabled_hooks_for_symbolize = true;
leaks->ReportLeaks(name_, pprof_file, true); // true = should_symbolize
} else {
Original comment by csilv...@gmail.com
on 12 May 2009 at 11:09
This patch fixes my problem. All unittests and my test programs pass.
Original comment by mrab...@gmail.com
on 13 May 2009 at 12:12
This should be fixed in perftools 1.3, just released.
Original comment by csilv...@gmail.com
on 10 Jun 2009 at 2:00
Original issue reported on code.google.com by
mrab...@gmail.com
on 29 Mar 2009 at 7:15