Changeset 228983 in webkit
- Timestamp:
- Feb 25, 2018 6:18:24 PM (6 years ago)
- Location:
- trunk/Tools
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Tools/ChangeLog
r228980 r228983 1 2018-02-25 Alexey Proskuryakov <ap@apple.com> 2 3 Various crashes in WebKitTestRunner, especially when system is under heavy load 4 https://bugs.webkit.org/show_bug.cgi?id=183109 5 6 Reviewed by Tim Horton. 7 8 WebKitTestRunner had many places where it sent messages to WebContent with a timeout, 9 but it didn't handle the timeout when it did occur. Nearly all of those would result 10 in logic errors and failing tests, and most would even result in stack corruption, 11 as the response handler modified local variables. 12 13 There is only one timeout scenario that we actually mean to handle in WKTR. That's 14 when a test freezes after it is done (e.g. an infinite loop in beforeunload) - we don't 15 want to blame the next test for freezing, so we silently relaunch WebContent. 16 Everything else is cargo cult code that never worked. 17 18 This patch addresses the crashes, and actually makes tests pass a lot more on an 19 overloaded system. 20 21 * WebKitTestRunner/TestController.cpp: 22 (WTR::TestController::resetStateToConsistentValues): Moved m_doneResetting assignment 23 to where it's actually needed, for clarity. 24 (WTR::TestController::reattachPageToWebProcess): This function used to always hit 25 and ignore message timeout, as m_doneResetting is only updated by navigation callback 26 when the state is Resetting. This change makes it faster. 27 (WTR::TestController::platformResetStateToConsistentValues): Style fix. 28 (WTR::TestController::clearServiceWorkerRegistrations): Timing out here wasn't 29 handled in a meaningful manner, and would even corrupt the stack. 30 (WTR::TestController::clearDOMCache): Ditto. 31 (WTR::TestController::clearDOMCaches): Ditto. 32 (WTR::TestController::hasDOMCache): Ditto. 33 (WTR::TestController::domCacheSize): Ditto. 34 (WTR::TestController::isStatisticsPrevalentResource): Ditto. 35 (WTR::TestController::isStatisticsRegisteredAsSubFrameUnder): Ditto. 36 (WTR::TestController::isStatisticsRegisteredAsRedirectingTo): Ditto. 37 (WTR::TestController::isStatisticsHasHadUserInteraction): Ditto. 38 (WTR::TestController::isStatisticsGrandfathered): Ditto. 39 (WTR::TestController::statisticsUpdateCookiePartitioning): Ditto. 40 (WTR::TestController::statisticsSetShouldPartitionCookiesForHost): Ditto. 41 (WTR::TestController::statisticsClearInMemoryAndPersistentStore): Ditto. 42 (WTR::TestController::statisticsClearInMemoryAndPersistentStoreModifiedSinceHours): Ditto. 43 (WTR::TestController::statisticsClearThroughWebsiteDataRemoval): Ditto. 44 45 * WebKitTestRunner/TestInvocation.cpp: 46 (WTR::TestInvocation::shortTimeout const): Made shortTimeout shorter (on a hunch). 47 (WTR::TestInvocation::invoke): Removed a timeout waiting for initial response. There 48 is never a logical reason for such a timeout, as we always have a new or responsive 49 WebContent process here. 50 (WTR::TestInvocation::dumpResults): Removed another timeout that we don't know how to 51 properly handle. 52 (WTR::TestInvocation::didReceiveMessageFromInjectedBundle): Removed assignment to 53 m_errorMessage, which had no effect in this context. 54 55 * WebKitTestRunner/TestInvocation.h: Removed no longer used code. 56 57 * WebKitTestRunner/cocoa/TestControllerCocoa.mm: 58 (WTR::TestController::cocoaResetStateToConsistentValues): Use a named constant for 59 no timeout. 60 61 * WebKitTestRunner/ios/TestControllerIOS.mm: 62 (WTR::TestController::platformConfigureViewForTest): Removed a useless timeout. 63 Not sure if timing out here would corrupt the stack or not, but there is no reason 64 to impose arbitrary limits on individual steps of a test. 65 66 * WebKitTestRunner/mac/TestControllerMac.mm: 67 (WTR::TestController::platformConfigureViewForTest): Use a named constant for 68 no timeout. 69 1 70 2018-02-25 Ali Juma <ajuma@chromium.org> 2 71 -
trunk/Tools/WebKitTestRunner/TestController.cpp
r228881 r228983 854 854 platformResetStateToConsistentValues(); 855 855 856 // Reset main page back to about:blank857 m_doneResetting = false;858 859 856 m_shouldDecideNavigationPolicyAfterDelay = false; 860 857 … … 867 864 statisticsResetToConsistentState(); 868 865 866 // Reset main page back to about:blank 867 m_doneResetting = false; 869 868 WKPageLoadURL(m_mainWebView->page(), blankURL()); 870 869 runUntil(m_doneResetting, m_currentInvocation->shortTimeout()); … … 880 879 { 881 880 // Loading a web page is the only way to reattach an existing page to a process. 881 SetForScope<State> changeState(m_state, Resetting); 882 882 m_doneResetting = false; 883 883 WKPageLoadURL(m_mainWebView->page(), blankURL()); 884 runUntil(m_doneResetting, m_currentInvocation->shortTimeout());884 runUntil(m_doneResetting, noTimeout); 885 885 } 886 886 … … 2368 2368 void TestController::platformResetStateToConsistentValues() 2369 2369 { 2370 2371 2370 } 2372 2371 … … 2408 2407 2409 2408 WKWebsiteDataStoreRemoveAllServiceWorkerRegistrations(websiteDataStore, &context, clearServiceWorkerRegistrationsCallback); 2410 2411 if (!context.done) 2412 runUntil(context.done, m_currentInvocation->shortTimeout()); 2409 runUntil(context.done, noTimeout); 2413 2410 #endif 2414 2411 } … … 2441 2438 auto cacheOrigin = adoptWK(WKSecurityOriginCreateFromString(origin)); 2442 2439 WKWebsiteDataStoreRemoveFetchCacheForOrigin(websiteDataStore, cacheOrigin.get(), &context, clearDOMCacheCallback); 2443 2444 if (!context.done) 2445 runUntil(context.done, m_currentInvocation->shortTimeout()); 2440 runUntil(context.done, noTimeout); 2446 2441 #endif 2447 2442 } … … 2454 2449 2455 2450 WKWebsiteDataStoreRemoveAllFetchCaches(websiteDataStore, &context, clearDOMCacheCallback); 2456 if (!context.done) 2457 runUntil(context.done, m_currentInvocation->shortTimeout()); 2451 runUntil(context.done, noTimeout); 2458 2452 #endif 2459 2453 } … … 2492 2486 FetchCacheOriginsCallbackContext context(*this, origin); 2493 2487 WKWebsiteDataStoreGetFetchCacheOrigins(dataStore, &context, fetchCacheOriginsCallback); 2494 if (!context.done) 2495 runUntil(context.done, m_currentInvocation->shortTimeout()); 2488 runUntil(context.done, noTimeout); 2496 2489 return context.result; 2497 2490 } … … 2522 2515 FetchCacheSizeForOriginCallbackContext context(*this); 2523 2516 WKWebsiteDataStoreGetFetchCacheSizeForOrigin(dataStore, origin, &context, fetchCacheSizeForOriginCallback); 2524 if (!context.done) 2525 runUntil(context.done, m_currentInvocation->shortTimeout()); 2517 runUntil(context.done, noTimeout); 2526 2518 return context.result; 2527 2519 } … … 2570 2562 ResourceStatisticsCallbackContext context(*this); 2571 2563 WKWebsiteDataStoreIsStatisticsPrevalentResource(dataStore, host, &context, resourceStatisticsBooleanResultCallback); 2572 if (!context.done) 2573 runUntil(context.done, m_currentInvocation->shortTimeout()); 2564 runUntil(context.done, noTimeout); 2574 2565 return context.result; 2575 2566 } … … 2580 2571 ResourceStatisticsCallbackContext context(*this); 2581 2572 WKWebsiteDataStoreIsStatisticsRegisteredAsSubFrameUnder(dataStore, subFrameHost, topFrameHost, &context, resourceStatisticsBooleanResultCallback); 2582 if (!context.done) 2583 runUntil(context.done, m_currentInvocation->shortTimeout()); 2573 runUntil(context.done, noTimeout); 2584 2574 return context.result; 2585 2575 } … … 2590 2580 ResourceStatisticsCallbackContext context(*this); 2591 2581 WKWebsiteDataStoreIsStatisticsRegisteredAsRedirectingTo(dataStore, hostRedirectedFrom, hostRedirectedTo, &context, resourceStatisticsBooleanResultCallback); 2592 if (!context.done) 2593 runUntil(context.done, m_currentInvocation->shortTimeout()); 2582 runUntil(context.done, noTimeout); 2594 2583 return context.result; 2595 2584 } … … 2612 2601 ResourceStatisticsCallbackContext context(*this); 2613 2602 WKWebsiteDataStoreIsStatisticsHasHadUserInteraction(dataStore, host, &context, resourceStatisticsBooleanResultCallback); 2614 if (!context.done) 2615 runUntil(context.done, m_currentInvocation->shortTimeout()); 2603 runUntil(context.done, noTimeout); 2616 2604 return context.result; 2617 2605 } … … 2628 2616 ResourceStatisticsCallbackContext context(*this); 2629 2617 WKWebsiteDataStoreIsStatisticsGrandfathered(dataStore, host, &context, resourceStatisticsBooleanResultCallback); 2630 if (!context.done) 2631 runUntil(context.done, m_currentInvocation->shortTimeout()); 2618 runUntil(context.done, noTimeout); 2632 2619 return context.result; 2633 2620 } … … 2692 2679 ResourceStatisticsCallbackContext context(*this); 2693 2680 WKWebsiteDataStoreStatisticsUpdateCookiePartitioning(dataStore, &context, resourceStatisticsVoidResultCallback); 2694 if (!context.done) 2695 runUntil(context.done, m_currentInvocation->shortTimeout()); 2681 runUntil(context.done, noTimeout); 2696 2682 m_currentInvocation->didSetPartitionOrBlockCookiesForHost(); 2697 2683 } … … 2702 2688 ResourceStatisticsCallbackContext context(*this); 2703 2689 WKWebsiteDataStoreSetStatisticsShouldPartitionCookiesForHost(dataStore, host, value, &context, resourceStatisticsVoidResultCallback); 2704 if (!context.done) 2705 runUntil(context.done, m_currentInvocation->shortTimeout()); 2690 runUntil(context.done, noTimeout); 2706 2691 m_currentInvocation->didSetPartitionOrBlockCookiesForHost(); 2707 2692 } … … 2760 2745 ResourceStatisticsCallbackContext context(*this); 2761 2746 WKWebsiteDataStoreStatisticsClearInMemoryAndPersistentStore(dataStore, &context, resourceStatisticsVoidResultCallback); 2762 if (!context.done) 2763 runUntil(context.done, m_currentInvocation->shortTimeout()); 2747 runUntil(context.done, noTimeout); 2764 2748 m_currentInvocation->didClearStatisticsThroughWebsiteDataRemoval(); 2765 2749 } … … 2770 2754 ResourceStatisticsCallbackContext context(*this); 2771 2755 WKWebsiteDataStoreStatisticsClearInMemoryAndPersistentStoreModifiedSinceHours(dataStore, hours, &context, resourceStatisticsVoidResultCallback); 2772 if (!context.done) 2773 runUntil(context.done, m_currentInvocation->shortTimeout()); 2756 runUntil(context.done, noTimeout); 2774 2757 m_currentInvocation->didClearStatisticsThroughWebsiteDataRemoval(); 2775 2758 } … … 2780 2763 ResourceStatisticsCallbackContext context(*this); 2781 2764 WKWebsiteDataStoreStatisticsClearThroughWebsiteDataRemoval(dataStore, &context, resourceStatisticsVoidResultCallback); 2782 if (!context.done) 2783 runUntil(context.done, m_currentInvocation->shortTimeout()); 2765 runUntil(context.done, noTimeout); 2784 2766 m_currentInvocation->didClearStatisticsThroughWebsiteDataRemoval(); 2785 2767 } -
trunk/Tools/WebKitTestRunner/TestInvocation.cpp
r228587 r228983 110 110 // for each test individually. 111 111 // But there shouldn't be any observable negative consequences from this. 112 return m_timeout / 1000. / 2;112 return m_timeout / 1000. / 4; 113 113 } 114 114 … … 168 168 bool shouldOpenExternalURLs = false; 169 169 170 TestController::singleton().runUntil(m_gotInitialResponse, shortTimeout()); 171 if (!m_gotInitialResponse) { 172 m_errorMessage = "Timed out waiting for initial response from web process\n"; 173 m_webProcessIsUnresponsive = true; 174 goto end; 175 } 170 TestController::singleton().runUntil(m_gotInitialResponse, TestController::noTimeout); 176 171 if (m_error) 177 172 goto end; … … 191 186 #endif // !PLATFORM(IOS) 192 187 193 if (m_webProcessIsUnresponsive) 194 dumpWebProcessUnresponsiveness(); 195 else if (TestController::singleton().resetStateToConsistentValues(m_options)) 188 if (TestController::singleton().resetStateToConsistentValues(m_options)) 196 189 return; 197 190 … … 200 193 // Make sure that we have a process, as invoke() will need one to send bundle messages for the next test. 201 194 TestController::singleton().reattachPageToWebProcess(); 202 }203 204 void TestInvocation::dumpWebProcessUnresponsiveness()205 {206 dumpWebProcessUnresponsiveness(m_errorMessage.c_str());207 195 } 208 196 … … 272 260 m_gotRepaint = false; 273 261 WKPageForceRepaint(TestController::singleton().mainWebView()->page(), this, TestInvocation::forceRepaintDoneCallback); 274 TestController::singleton().runUntil(m_gotRepaint, shortTimeout()); 275 if (!m_gotRepaint) { 276 m_errorMessage = "Timed out waiting for pre-pixel dump repaint\n"; 277 m_webProcessIsUnresponsive = true; 278 return; 279 } 280 262 TestController::singleton().runUntil(m_gotRepaint, TestController::noTimeout); 281 263 dumpPixelsAndCompareWithExpected(SnapshotResultType::WebView, m_repaintRects.get()); 282 264 } … … 326 308 m_gotFinalMessage = true; 327 309 m_error = true; 328 m_errorMessage = "FAIL\n";329 310 TestController::singleton().notifyDone(); 330 311 return; -
trunk/Tools/WebKitTestRunner/TestInvocation.h
r228109 r228983 61 61 WKRetainPtr<WKTypeRef> didReceiveSynchronousMessageFromInjectedBundle(WKStringRef messageName, WKTypeRef messageBody); 62 62 63 void dumpWebProcessUnresponsiveness();64 63 static void dumpWebProcessUnresponsiveness(const char* errorMessage); 65 64 void outputText(const WTF::String&); … … 120 119 bool m_dumpPixels { false }; 121 120 bool m_pixelResultIsPending { false }; 122 bool m_webProcessIsUnresponsive { false };123 121 124 122 StringBuilder m_textOutput; … … 126 124 WKRetainPtr<WKImageRef> m_pixelResult; 127 125 WKRetainPtr<WKArrayRef> m_repaintRects; 128 std::string m_errorMessage;129 126 130 127 std::unique_ptr<UIScriptContext> m_UIScriptContext; -
trunk/Tools/WebKitTestRunner/cocoa/TestControllerCocoa.mm
r228304 r228983 196 196 doneRemoving = true; 197 197 }]; 198 platformRunUntil(doneRemoving, 0);198 platformRunUntil(doneRemoving, noTimeout); 199 199 [[_WKUserContentExtensionStore defaultStore] _removeAllContentExtensions]; 200 200 -
trunk/Tools/WebKitTestRunner/ios/TestControllerIOS.mm
r222890 r228983 120 120 }]; 121 121 122 platformRunUntil(doneResizing, 10); 123 if (!doneResizing) 124 WTFLogAlways("Timed out waiting for view resize to complete in platformConfigureViewForTest()"); 122 platformRunUntil(doneResizing, noTimeout); 125 123 } 126 124 -
trunk/Tools/WebKitTestRunner/mac/TestControllerMac.mm
r226751 r228983 150 150 doneCompiling = true; 151 151 }]; 152 platformRunUntil(doneCompiling, 0);152 platformRunUntil(doneCompiling, noTimeout); 153 153 #endif 154 154 }
Note: See TracChangeset
for help on using the changeset viewer.