Open Bug 834078 Opened 11 years ago Updated 2 years ago

Memcheck on MacOS crashes when trying to run Firefox: m_syswrap/syswrap-amd64-darwin.c:460 (void wqthread_hijack(Addr, Addr, Addr, Addr, Int, Addr)): Assertion 'VG_(is_valid_tid)(tid)' failed.

Categories

(Core :: General, defect)

x86
macOS
defect

Tracking

()

People

(Reporter: justin.lebar+bug, Unassigned)

Details

I'm running MacOS 10.8.  I can reproduce this crash with valgrind 3.8.1 (macports) and valgrind 3.9 (today's svn tip, r13263).

I'm invoking valgrind with

> $ valgrind --trace-children=yes --dsymutil=yes --smc-check=all-non-file dist/NightlyDebug.app/Contents/MacOS/firefox -P dev -no-remote

My mozconfig is

> export CC="clang -Qunused-arguments"
> export CXX="clang++ -Qunused-arguments"
> 
> . $topsrcdir/browser/config/mozconfig
> mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/../valgrind
> mk_add_options MOZ_MAKE_FLAGS=-j16
> ac_add_options --with-ccache
> ac_add_options --enable-optimize='-g -O2'
> ac_add_options --enable-debug
> ac_add_options --enable-tests
> ac_add_options --disable-jemalloc
> ac_add_options --enable-valgrind

My compiler's version is

> $ clang --version
> Apple clang version 4.0 (tags/Apple/clang-421.0.57) (based on LLVM 3.1svn)
> Target: x86_64-apple-darwin12.2.0
> Thread model: posix

Valgrind's output is:

> ==92916== Memcheck, a memory error detector
> ==92916== Copyright (C) 2002-2012, and GNU GPL'd, by Julian Seward et al.
> ==92916== Using Valgrind-3.8.1 and LibVEX; rerun with -h for copyright info
> ==92916== Command: dist/NightlyDebug.app/Contents/MacOS/firefox -P dev -no-remote
> ==92916== 
> ==92916== WARNING: Support on MacOS 10.8 is experimental and mostly broken.
> ==92916== WARNING: Expect incorrect results, assertions and crashes.
> ==92916== WARNING: In particular, Memcheck on 32-bit programs will fail to
> ==92916== WARNING: detect any errors associated with heap-allocated data.
> ==92916== 
> WARNING: XPCOM objects created/destroyed from static ctor/dtor: file ../../../src/xpcom/base/nsTraceRefcntImpl.cpp, line 141
> WARNING: XPCOM objects created/destroyed from static ctor/dtor: file ../../../src/xpcom/base/nsTraceRefcntImpl.cpp, line 141
> UNKNOWN workq_ops option 32
> 
> valgrind: m_syswrap/syswrap-amd64-darwin.c:460 (void wqthread_hijack(Addr, Addr, Addr, Addr, Int, Addr)): Assertion 'VG_(is_valid_tid)(tid)' failed.
> ==92916==    at 0x23803A18B: ???
> ==92916==    by 0x23803A12A: ???
> ==92916==    by 0x2380DA076: ???
> 
> sched status:
>   running_tid=0
> 
> Thread 1: status = VgTs_WaitSys
> ==92916==    at 0x4282686: mach_msg_trap (in /usr/lib/system/libsystem_kernel.dylib)
> ==92916==    by 0x453A7B9: _scsclient_CreateCacheableFromFrameworkSymbol (in /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/CarbonCore.framework/Versions/A/CarbonCore)
> ==92916==    by 0x453A6D5: SCClientSession::createCacheable(SCCacheableName, char const*) (in /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/CarbonCore.framework/Versions/A/CarbonCore)
> ==92916==    by 0x453A660: SCSession::findOrCreateCacheable(SCCacheableName, char const*) (in /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/CarbonCore.framework/Versions/A/CarbonCore)
> ==92916==    by 0x453A57A: scCreateSystemCacheable (in /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/CarbonCore.framework/Versions/A/CarbonCore)
> ==92916==    by 0x453A540: _CLV_GetCacheableOnce() (in /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/CarbonCore.framework/Versions/A/CarbonCore)
> ==92916==    by 0x411CF8F: pthread_once (in /usr/lib/system/libsystem_c.dylib)
> ==92916==    by 0x453A3D0: _standalone_CopyCheckFixForBundleID (in /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/CarbonCore.framework/Versions/A/CarbonCore)
> ==92916==    by 0x453A2CF: GetBugsForOurBundleIDFromCoreservicesd (in /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/CarbonCore.framework/Versions/A/CarbonCore)
> ==92916==    by 0x4539F7B: _CSCheckFix (in /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/CarbonCore.framework/Versions/A/CarbonCore)
> ==92916==    by 0x454DFD3: _Gestalt_SystemVersion (in /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/CarbonCore.framework/Versions/A/CarbonCore)
> ==92916==    by 0x454DDCB: Gestalt (in /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/CarbonCore.framework/Versions/A/CarbonCore)
> ==92916==    by 0x9AE532C: StackWalkInitCriticalAddress() (nsStackWalk.cpp:76)
> ==92916==    by 0x9ADAE98: NS_LogInit_P (nsTraceRefcntImpl.cpp:900)
> ==92916==    by 0x100001FFF: main (nsBrowserApp.cpp:101)
> 
> 
> 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.
> 
> ==92895== 
> ==92895== HEAP SUMMARY:
> ==92895==     in use at exit: 173,995 bytes in 878 blocks
> ==92895==   total heap usage: 1,496 allocs, 618 frees, 204,787 bytes allocated
> ==92895== 
> ==92895== LEAK SUMMARY:
> ==92895==    definitely lost: 8,624 bytes in 14 blocks
> ==92895==    indirectly lost: 1,168 bytes in 5 blocks
> ==92895==      possibly lost: 4,957 bytes in 68 blocks
> ==92895==    still reachable: 159,246 bytes in 791 blocks
> ==92895==         suppressed: 0 bytes in 0 blocks
> ==92895== Rerun with --leak-check=full to see details of leaked memory
> ==92895== 
> ==92895== For counts of detected and suppressed errors, rerun with: -v
> ==92895== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
Known failure, but so far not much pressure to fix it.  I can 
increase priority of fixing it if you want.
Is there a work-around?  I can try on Linux.
Oh, I should have clarified.  This is a MacOSX 10.8 specific failure
only.  It should work fine on Linux and on MacOSX 10.7.
Okay, I can just use Linux, then.  FWIIW, as more devs upgrade to 10.8, I expect you'll have more pressure to fix this one.
I updated the MDN page; hopefully the big warning will catch people's eyes.

https://developer.mozilla.org/en-US/docs/Debugging_Mozilla_with_Valgrind
Is this really a bug with Firefox? It seems more like an issue with Valgrind still being experimental on MacOSX 10.8.
This has been fixed in Valgrind 3.10.0.  It is able to start Firefox
on MacOSX 10.9.  There are still problems to do with Firefox sometimes
hanging, but that is a different problem, and under investigation.
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.