Bug 82652 - TestWebKitAPI always crashes in release builds
Summary: TestWebKitAPI always crashes in release builds
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Tools / Tests (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL: http://build.webkit.org/builders/Lion...
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2012-03-29 13:43 PDT by Simon Fraser (smfr)
Modified: 2015-02-17 07:02 PST (History)
11 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Simon Fraser (smfr) 2012-03-29 13:43:00 PDT
This log shows:

** BUILD SUCCEEDED **

TestWebKitAPI(76672) malloc: *** error for object 0x104fd2620: pointer being freed was not allocated
*** set a breakpoint in malloc_error_break to debug
Failed to build list of tests!
program finished with exit code 0

and there's an associated crash log:


s-bot-135:CrashReporter buildbot$ cat TestWebKitAPI_2012-03-29-120650_buildbots-Mac-Pro-49.crash 
Process:         TestWebKitAPI [71902]
Path:            /Volumes/VOLUME/*/TestWebKitAPI
Identifier:      TestWebKitAPI
Version:         ??? (???)
Code Type:       X86-64 (Native)
Parent Process:  perl5.12 [71610]

Date/Time:       2012-03-29 12:06:48.588 -0700
OS Version:      Mac OS X 10.7.3 (11D50)
Report Version:  9

Crashed Thread:  0  Dispatch queue: com.apple.main-thread

Exception Type:  EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000

Application Specific Information:
/Volumes/Data/slave/lion-intel-release-tests-wk2/build/WebKitBuild/Release/TestWebKitAPI
objc[71902]: garbage collection is OFF
*** error for object 0x109f0c620: pointer being freed was not allocated
 

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0   libsystem_kernel.dylib        	0x00007fff96e2782a __kill + 10
1   libsystem_c.dylib             	0x00007fff8f2a8a9c abort + 177
2   libsystem_c.dylib             	0x00007fff8f30784c free + 389
3   TestWebKitAPI                 	0x0000000106f99219 testing::internal::StrStreamToString(testing::internal::StrStream*) + 274
4   TestWebKitAPI                 	0x0000000106fa3174 _ZN7testing8internalL12FlagToEnvVarEPKc + 114
5   TestWebKitAPI                 	0x0000000106f93ca4 testing::internal::BoolFromGTestEnv(char const*, bool) + 26
6   TestWebKitAPI                 	0x0000000106fabc69 _GLOBAL__I_a + 25
7   dyld                          	0x00007fff66b45da6 ImageLoaderMachO::doModInitFunctions(ImageLoader::LinkContext const&) + 218
8   dyld                          	0x00007fff66b45af2 ImageLoaderMachO::doInitialization(ImageLoader::LinkContext const&) + 46
9   dyld                          	0x00007fff66b432e4 ImageLoader::recursiveInitialization(ImageLoader::LinkContext const&, unsigned int, ImageLoader::InitializerTimingList&) + 260
10  dyld                          	0x00007fff66b440b7 ImageLoader::runInitializers(ImageLoader::LinkContext const&, ImageLoader::InitializerTimingList&) + 59
11  dyld                          	0x00007fff66b394dd dyld::initializeMainExecutable() + 206
12  dyld                          	0x00007fff66b3d60b dyld::_main(macho_header const*, unsigned long, int, char const**, char const**, char const**) + 1852
13  dyld                          	0x00007fff66b37059 _dyld_start + 49

Thread 0 crashed with X86 Thread State (64-bit):
  rax: 0x0000000000000000  rbx: 0x00007fff66b34370  rcx: 0x00007fff66b34358  rdx: 0x0000000000000000
  rdi: 0x00000000000118de  rsi: 0x0000000000000006  rbp: 0x00007fff66b34380  rsp: 0x00007fff66b34358
   r8: 0x0000000000000000   r9: 0x00007fff8f31a230  r10: 0x00007fff96e28e62  r11: 0xffffff80002d8220
  r12: 0x000000010708d000  r13: 0x0000000000000003  r14: 0x000000010708e000  r15: 0x0000000000000003
  rip: 0x00007fff96e2782a  rfl: 0x0000000000000206  cr2: 0x000000010708e000
Logical CPU: 0
Comment 1 Radar WebKit Bug Importer 2012-03-29 14:19:19 PDT
<rdar://problem/11149812>
Comment 2 Simon Fraser (smfr) 2012-03-29 14:35:54 PDT
Fixing the script error detection via bug 82659.
Comment 3 Stephanie Lewis 2012-03-29 17:25:04 PDT
Turns out this is the same crashing issue as <rdar://problem/10944309> CrashTracer: [USER] 111 crashes in WebProcess at WebKitTestRunnerInjectedBundle: WTR::InjectedBundle::done + 142.

gtest uses a std::stringstream which at some point call stringstream::str() which allocates a new string with fastMalloc and deallocates with system free.

Unfortunately, making gtest not using the c std library is not a useful option.  I am curious why gtest needs to include fastMalloc and wtf stuff to start with.  If we could remove any internal headers from gtest and TestWebKitAPI we should be able to fix the bug that way.

Another temporary fix would be to go back to the GNU std library.
Comment 4 Stephanie Lewis 2012-03-29 17:42:01 PDT
FastMalloc was added to gtest in http://trac.webkit.org/changeset/104091 because of crashes using fastFree.  

< http://webkit.org/b/66521>
< rdar://problem/10607911>
Comment 5 Csaba Osztrogonác 2015-02-17 07:02:07 PST
Release bots now run API tests without any problem, see bug141518 for details.