Bug 197314

Summary: WebKitTestRunner leaks an NSDictionary and multiple JSStringRef objects
Product: WebKit Reporter: David Kilzer (:ddkilzer) <ddkilzer>
Component: Tools / TestsAssignee: David Kilzer (:ddkilzer) <ddkilzer>
Status: RESOLVED FIXED    
Severity: Normal CC: commit-queue, joepeck, lforschler, simon.fraser, webkit-bug-importer, wenson_hsieh
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch v1 none

Description David Kilzer (:ddkilzer) 2019-04-26 09:49:51 PDT
WebKitTestRunner leaks an NSDictionary and multiple JSStringRef objects.

Examples:

STACK OF 1 INSTANCE OF 'ROOT LEAK: <NSDictionary>':
[thread 0x11725ae3c]:
48  WebKitTestRunnerApp                   0x10ca9991e main + 97  mainIOS.mm:72
47  com.apple.UIKitCore                   0x11e24778c UIApplicationMain + 1621
46  com.apple.GraphicsServices            0x110a279f8 GSEventRunModal + 65
45  com.apple.CoreFoundation              0x110dd7296 CFRunLoopRunSpecific + 438
44  com.apple.CoreFoundation              0x110dd7aaf __CFRunLoopRun + 1263
43  com.apple.CoreFoundation              0x110ddcdec __CFRunLoopDoSources0 + 268
42  com.apple.CoreFoundation              0x110ddd5c1 __CFRunLoopDoSource0 + 81
41  com.apple.CoreFoundation              0x110ddd631 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
40  com.apple.Foundation                  0x1104f1fd8 __NSThreadPerformPerform + 259
39  WebKitTestRunnerApp                   0x10ca99828 -[WebKitTestRunnerApp _runTestController] + 40  mainIOS.mm:45
38  WebKitTestRunnerApp                   0x10caa2579 WTR::TestController::TestController(int, char const**) + 395  TestController.cpp:163
37  WebKitTestRunnerApp                   0x10caa9130 WTR::TestController::runTestingServerLoop() + 132  TestController.cpp:1686
36  WebKitTestRunnerApp                   0x10caa8d4b WTR::TestController::runTest(char const*) + 1933  memory:2610
35  WebKitTestRunnerApp                   0x10cab7a78 WTR::TestInvocation::invoke() + 306  TestInvocation.cpp:185
34  WebKitTestRunnerApp                   0x10cab62bb WTR::TestController::platformRunUntil(bool&, WTF::Seconds) + 183  TestControllerCocoa.mm:0
33  com.apple.Foundation                  0x1104dc7c8 -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 211
32  com.apple.CoreFoundation              0x110dd7296 CFRunLoopRunSpecific + 438
31  com.apple.CoreFoundation              0x110dd7aaf __CFRunLoopRun + 1263
30  com.apple.CoreFoundation              0x110ddcd94 __CFRunLoopDoSources0 + 180
29  com.apple.CoreFoundation              0x110ddd5c1 __CFRunLoopDoSource0 + 81
28  com.apple.CoreFoundation              0x110ddd631 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
27  JavaScriptCore                        0x10cdeb902 WTF::RunLoop::performWork(void*) + 34  RunLoopCF.cpp:39
26  JavaScriptCore                        0x10cdeb674 WTF::RunLoop::performWork() + 228  Function.h:0
25  com.apple.WebKit                      0x10f0c619b IPC::Connection::dispatchIncomingMessages() + 375  Connection.cpp:0
24  com.apple.WebKit                      0x10f0c3758 IPC::Connection::dispatchMessage(std::__1::unique_ptr<IPC::Decoder, std::__1::default_delete<IPC::Decoder> >) + 108  memory:2621
23  com.apple.WebKit                      0x10f30812c WebKit::WebProcessProxy::didReceiveMessage(IPC::Connection&, IPC::Decoder&) + 24  WebProcessProxy.cpp:619
22  com.apple.WebKit                      0x10f0d7b2e IPC::MessageReceiverMap::dispatchMessage(IPC::Connection&, IPC::Decoder&) + 114  MessageReceiverMap.cpp:0
21  com.apple.WebKit                      0x10f1124c1 void IPC::handleMessage<Messages::RemoteLayerTreeDrawingAreaProxy::CommitLayerTree, WebKit::RemoteLayerTreeDrawingAreaProxy, void (WebKit::RemoteLayerTreeDrawingAreaProxy::*)(WebKit::RemoteLayerTreeTransaction const&, WebKit::RemoteScrollingCoordinatorTransaction const&)>(IPC::Decoder&, WebKit::RemoteLayerTreeDrawingAreaProxy*, void (WebKit::RemoteLayerTreeDrawingAreaProxy::*)(WebKit::RemoteLayerTreeTransaction const&, WebKit::RemoteScrollingCoordinatorTransaction const&)) + 94  HandleMessage.h:0
20  com.apple.WebKit                      0x10f2b8e2e WebKit::RemoteLayerTreeDrawingAreaProxy::commitLayerTree(WebKit::RemoteLayerTreeTransaction const&, WebKit::RemoteScrollingCoordinatorTransaction const&) + 624  utility:925
19  com.apple.WebKit                      0x10f2b9d68 WebKit::GenericCallback<>::performCallbackWithReturnValue() + 40  memory:2651
18  WebKitTestRunnerApp                   0x10cab9a8f WTR::TestInvocation::runUISideScriptAfterUpdateCallback(OpaqueWKError const*, void*) + 43  WKRetainPtr.h:80
17  WebKitTestRunnerApp                   0x10cabb673 WTR::TestInvocation::runUISideScript(OpaqueWKString const*, unsigned int) + 185  utility:925
16  WebKitTestRunnerApp                   0x10cabdeb6 WTR::UIScriptContext::runUIScript(WTF::String const&, unsigned int) + 116  HashTable.h:399
15  JavaScriptCore                        0x10cfbba43 JSEvaluateScript + 675  NakedPtr.h:53
14  JavaScriptCore                        0x10d5d26cb JSC::evaluate(JSC::ExecState*, JSC::SourceCode const&, JSC::JSValue, WTF::NakedPtr<JSC::Exception>&) + 299  Completion.cpp:141
13  JavaScriptCore                        0x10d35ceb1 JSC::Interpreter::executeProgram(JSC::SourceCode const&, JSC::ExecState*, JSC::JSObject*) + 11361  JITCodeInlines.h:39
12  JavaScriptCore                        0x10cf7b599 vmEntryToJavaScript + 200  LowLevelInterpreter64.asm:293
11  JavaScriptCore                        0x10cf8a9c7 llint_entry + 62084  LowLevelInterpreter.asm:885
10  JavaScriptCore                        0x10cf8a9c7 llint_entry + 62084  LowLevelInterpreter.asm:885
9                                      0x33b691201027 0x33b691201000 + 39
8   JavaScriptCore                        0x10cfbc689 long long JSC::APICallbackFunction::call<JSC::JSCallbackFunction>(JSC::ExecState*) + 489  APICallbackFunction.h:63
7   WebKitTestRunnerApp                   0x10ca9e291 WTR::JSUIScriptController::sendEventStream(OpaqueJSContext const*, OpaqueJSValue*, OpaqueJSValue*, unsigned long, OpaqueJSValue const* const*, OpaqueJSValue const**) + 121  JSUIScriptController.cpp:501
6   WebKitTestRunnerApp                   0x10cac18bf WTR::UIScriptController::sendEventStream(OpaqueJSString*, OpaqueJSValue const*) + 857  UIScriptControllerIOS.mm:0
5   WebKitTestRunnerApp                   0x10ca99527 -[HIDEventGenerator sendEventStream:completionBlock:] + 84  HIDEventGenerator.mm:0
4   com.apple.CoreFoundation              0x110edae90 -[__NSDictionaryM copy] + 96
3   com.apple.CoreFoundation              0x110e74587 +[NSDictionary _alloc] + 55
2   libobjc.A.dylib                       0x110c51692 _objc_rootAllocWithZone + 37
1   libsystem_malloc.dylib                0x1174ce928 calloc + 24
0   libsystem_malloc.dylib                0x1174ce279 malloc_zone_calloc + 139 
====
    43 (1.75K) ROOT LEAK: <NSDictionary 0x600002471360> [32]
       41 (1.70K) <NSDictionary (Storage) 0x600002a1c600> [48]
          40 (1.66K) <NSMutableArray 0x600002a1c570> [48]
             39 (1.61K) <NSMutableArray (Storage) 0x6000026d56b0> [16]
                31 (1.28K) <NSMutableDictionary 0x600002472b00> [32]
                   30 (1.25K) <NSMutableDictionary (Storage) 0x600000fb8230> [112]
                      16 (624 bytes) <NSMutableDictionary 0x600002471560> [32]
                         14 (576 bytes) <NSMutableDictionary (Storage) 0x600002a1cb40> [48]
                            9 (384 bytes) <NSMutableArray 0x600002a1c1b0> [48]
                               8 (336 bytes) <NSMutableArray (Storage) 0x6000026d5170> [16]
                                  7 (320 bytes) <NSMutableDictionary 0x600002470800> [32]
                                     5 (272 bytes) <NSMutableDictionary (Storage) 0x600000fb85b0> [112]
                                        2 (80 bytes) <CFString 0x600002a1c300> [48]
                                           1 (32 bytes) <CFString (Storage) 0x600002470e00> [32]
                                        2 (80 bytes) <CFString 0x600002a1c660> [48]
                                           1 (32 bytes) <CFString (Storage) 0x6000024707e0> [32]
                                     1 (16 bytes) cow --> <NSMutableDictionary.cow (struct __cow_state_t) 0x6000026dd610> [16]
                            2 (80 bytes) <CFString 0x600002a1f2a0> [48]
                               1 (32 bytes) <CFString (Storage) 0x600002473280> [32]
                            1 (32 bytes) <CFString 0x600002472a40> [32]
                            1 (32 bytes) <NSNumber 0x600002473520> [32]
                         1 (16 bytes) cow --> <NSMutableDictionary.cow (struct __cow_state_t) 0x6000026dd990> [16]
                      11 (480 bytes) <NSMutableDictionary 0x600002470ce0> [32]
                         10 (448 bytes) <NSMutableDictionary (Storage) 0x600002a1c5d0> [48]
                            6 (288 bytes) <NSMutableArray 0x600002a1c750> [48]
                               5 (240 bytes) <NSMutableArray (Storage) 0x6000026d58f0> [16]
                                  4 (224 bytes) <NSMutableDictionary 0x600002471ea0> [32]
                                     3 (192 bytes) <NSMutableDictionary (Storage) 0x600000fb8620> [112]
                                        2 (80 bytes) <CFString 0x600002a1f210> [48]
                                           1 (32 bytes) <CFString (Storage) 0x600002473560> [32]
                            2 (80 bytes) <CFString 0x600002a1c3f0> [48]
                               1 (32 bytes) <CFString (Storage) 0x600002470fa0> [32]
                            1 (32 bytes) <CFString 0x600002472c40> [32]
                      1 (32 bytes) <CFString 0x600002473b20> [32]
                      1 (32 bytes) <NSNumber 0x6000024723a0> [32]
                7 (320 bytes) <NSMutableDictionary 0x600002470e80> [32]
                   6 (288 bytes) <NSMutableDictionary (Storage) 0x600002a1ca50> [48]
                      4 (208 bytes) <NSMutableArray 0x600002a1c870> [48]
                         3 (160 bytes) <NSMutableArray (Storage) 0x6000026d4df0> [16]
                            2 (144 bytes) <NSMutableDictionary 0x600002471d00> [32]
                               1 (112 bytes) <NSMutableDictionary (Storage) 0x600000fb8070> [112]
                      1 (32 bytes) <CFString 0x600002470fc0> [32]
       1 (16 bytes) cow --> <NSDictionary.cow (struct __cow_state_t) 0x6000026d5680> [16]

STACK OF 1 INSTANCE OF 'ROOT LEAK: malloc<32>':
[thread 0x11725ae3c]:
46  WebKitTestRunnerApp                   0x10ca9991e main + 97  mainIOS.mm:72
45  com.apple.UIKitCore                   0x11e24778c UIApplicationMain + 1621
44  com.apple.GraphicsServices            0x110a279f8 GSEventRunModal + 65
43  com.apple.CoreFoundation              0x110dd7296 CFRunLoopRunSpecific + 438
42  com.apple.CoreFoundation              0x110dd7aaf __CFRunLoopRun + 1263
41  com.apple.CoreFoundation              0x110ddcdec __CFRunLoopDoSources0 + 268
40  com.apple.CoreFoundation              0x110ddd5c1 __CFRunLoopDoSource0 + 81
39  com.apple.CoreFoundation              0x110ddd631 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
38  com.apple.Foundation                  0x1104f1fd8 __NSThreadPerformPerform + 259
37  WebKitTestRunnerApp                   0x10ca99828 -[WebKitTestRunnerApp _runTestController] + 40  mainIOS.mm:45
36  WebKitTestRunnerApp                   0x10caa2579 WTR::TestController::TestController(int, char const**) + 395  TestController.cpp:163
35  WebKitTestRunnerApp                   0x10caa9130 WTR::TestController::runTestingServerLoop() + 132  TestController.cpp:1686
34  WebKitTestRunnerApp                   0x10caa8d4b WTR::TestController::runTest(char const*) + 1933  memory:2610
33  WebKitTestRunnerApp                   0x10cab7a78 WTR::TestInvocation::invoke() + 306  TestInvocation.cpp:185
32  WebKitTestRunnerApp                   0x10cab62bb WTR::TestController::platformRunUntil(bool&, WTF::Seconds) + 183  TestControllerCocoa.mm:0
31  com.apple.Foundation                  0x1104dc7c8 -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 211
30  com.apple.CoreFoundation              0x110dd7296 CFRunLoopRunSpecific + 438
29  com.apple.CoreFoundation              0x110dd7aaf __CFRunLoopRun + 1263
28  com.apple.CoreFoundation              0x110ddcd94 __CFRunLoopDoSources0 + 180
27  com.apple.CoreFoundation              0x110ddd5c1 __CFRunLoopDoSource0 + 81
26  com.apple.CoreFoundation              0x110ddd631 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
25  JavaScriptCore                        0x10cdeb902 WTF::RunLoop::performWork(void*) + 34  RunLoopCF.cpp:39
24  JavaScriptCore                        0x10cdeb674 WTF::RunLoop::performWork() + 228  Function.h:0
23  com.apple.WebKit                      0x10f0c619b IPC::Connection::dispatchIncomingMessages() + 375  Connection.cpp:0
22  com.apple.WebKit                      0x10f0c3758 IPC::Connection::dispatchMessage(std::__1::unique_ptr<IPC::Decoder, std::__1::default_delete<IPC::Decoder> >) + 108  memory:2621
21  com.apple.WebKit                      0x10f30812c WebKit::WebProcessProxy::didReceiveMessage(IPC::Connection&, IPC::Decoder&) + 24  WebProcessProxy.cpp:619
20  com.apple.WebKit                      0x10f0d7b2e IPC::MessageReceiverMap::dispatchMessage(IPC::Connection&, IPC::Decoder&) + 114  MessageReceiverMap.cpp:0
19  com.apple.WebKit                      0x10f1124c1 void IPC::handleMessage<Messages::RemoteLayerTreeDrawingAreaProxy::CommitLayerTree, WebKit::RemoteLayerTreeDrawingAreaProxy, void (WebKit::RemoteLayerTreeDrawingAreaProxy::*)(WebKit::RemoteLayerTreeTransaction const&, WebKit::RemoteScrollingCoordinatorTransaction const&)>(IPC::Decoder&, WebKit::RemoteLayerTreeDrawingAreaProxy*, void (WebKit::RemoteLayerTreeDrawingAreaProxy::*)(WebKit::RemoteLayerTreeTransaction const&, WebKit::RemoteScrollingCoordinatorTransaction const&)) + 94  HandleMessage.h:0
18  com.apple.WebKit                      0x10f2b8e2e WebKit::RemoteLayerTreeDrawingAreaProxy::commitLayerTree(WebKit::RemoteLayerTreeTransaction const&, WebKit::RemoteScrollingCoordinatorTransaction const&) + 624  utility:925
17  com.apple.WebKit                      0x10f2b9d68 WebKit::GenericCallback<>::performCallbackWithReturnValue() + 40  memory:2651
16  WebKitTestRunnerApp                   0x10cab9a8f WTR::TestInvocation::runUISideScriptAfterUpdateCallback(OpaqueWKError const*, void*) + 43  WKRetainPtr.h:80
15  WebKitTestRunnerApp                   0x10cabb673 WTR::TestInvocation::runUISideScript(OpaqueWKString const*, unsigned int) + 185  utility:925
14  WebKitTestRunnerApp                   0x10cabdeb6 WTR::UIScriptContext::runUIScript(WTF::String const&, unsigned int) + 116  HashTable.h:399
13  JavaScriptCore                        0x10cfbba43 JSEvaluateScript + 675  NakedPtr.h:53
12  JavaScriptCore                        0x10d5d26cb JSC::evaluate(JSC::ExecState*, JSC::SourceCode const&, JSC::JSValue, WTF::NakedPtr<JSC::Exception>&) + 299  Completion.cpp:141
11  JavaScriptCore                        0x10d35ceb1 JSC::Interpreter::executeProgram(JSC::SourceCode const&, JSC::ExecState*, JSC::JSObject*) + 11361  JITCodeInlines.h:39
10  JavaScriptCore                        0x10cf7b599 vmEntryToJavaScript + 200  LowLevelInterpreter64.asm:293
9   JavaScriptCore                        0x10cf8a9c7 llint_entry + 62084  LowLevelInterpreter.asm:885
8   JavaScriptCore                        0x10cf81a19 llint_entry + 25302  LowLevelInterpreter64.asm:342
7   JavaScriptCore                        0x10d456535 llint_slow_path_get_by_id + 2517  JSObjectInlines.h:151
6   JavaScriptCore                        0x10cfbddd6 JSC::JSCallbackObject<JSC::JSDestructibleObject>::getOwnPropertySlot(JSC::JSObject*, JSC::ExecState*, JSC::PropertyName, JSC::PropertySlot&) + 630  JSCJSValueInlines.h:392
5   JavaScriptCore                        0x10cfc38bc JSC::JSCallbackObject<JSC::JSDestructibleObject>::getStaticValue(JSC::ExecState*, JSC::PropertyName) + 364  JSCallbackObjectFunctions.h:629
4   WebKitTestRunnerApp                   0x10caa0051 WTR::JSUIScriptController::scrollingTreeAsText(OpaqueJSContext const*, OpaqueJSValue*, OpaqueJSString*, OpaqueJSValue const**) + 39  JSRetainPtr.h:50
3   WebKitTestRunnerApp                   0x10cac3a49 WTR::UIScriptController::scrollingTreeAsText() const + 45  JSRetainPtr.h:45
2   JavaScriptCore                        0x10cfda508 JSStringCreateWithCFString + 200  ThreadSafeRefCounted.h:37
1   JavaScriptCore                        0x10ce41b90 bmalloc::DebugHeap::malloc(unsigned long, bool) + 16  DebugHeap.cpp:53
0   libsystem_malloc.dylib                0x1174ce11a malloc_zone_malloc + 140 
====
    2 (1.53K) ROOT LEAK: 0x7fdf8e924f80 [32]
       1 (1.50K) 0x7fdf5a801600 [1536]
Comment 1 David Kilzer (:ddkilzer) 2019-04-26 09:50:00 PDT
<rdar://problem/50245252>
Comment 2 David Kilzer (:ddkilzer) 2019-04-26 09:52:05 PDT
Created attachment 368324 [details]
Patch v1
Comment 3 WebKit Commit Bot 2019-04-26 11:32:57 PDT
Comment on attachment 368324 [details]
Patch v1

Clearing flags on attachment: 368324

Committed r244703: <https://trac.webkit.org/changeset/244703>
Comment 4 WebKit Commit Bot 2019-04-26 11:32:58 PDT
All reviewed patches have been landed.  Closing bug.