Bug 50722

Summary: [chromium] DRT inspector layout tests are flaky in debug
Product: WebKit Reporter: Tony Chang <tony>
Component: Tools / TestsAssignee: Ilya Tikhonovsky <loislo>
Status: RESOLVED FIXED    
Severity: Normal CC: apavlov, commit-queue, pfeldman, tkent, yurys
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: PC   
OS: OS X 10.5   
Attachments:
Description Flags
[patch] initial version
none
[patch] initial version without changes in test_expectations. none

Description Tony Chang 2010-12-08 16:29:50 PST
We're getting random crashes in with DRT in debug on the Windows bots in inspector tests.  We didn't have this problem with test_shell.

I've been trying to repro locally and have only gotten one stack trace.  It's not obvious to me what's the cause yet.  Maybe we're running a Task after the page has been unloaded?

Backtrace:
	WebCore::CSSStyleDeclaration::getPropertyValue [0x0195D92C+76] (c:\src\chrome\src\third_party\webkit\webcore\css\cssstyledeclaration.cpp:53)
	WebCore::InspectorStyle::buildObjectForStyle [0x01C83DF7+215] (c:\src\chrome\src\third_party\webkit\webcore\inspector\inspectorstylesheet.cpp:141)
	WebCore::InspectorStyleSheet::buildObjectForStyle [0x01C87D2A+442] (c:\src\chrome\src\third_party\webkit\webcore\inspector\inspectorstylesheet.cpp:739)
	WebCore::InspectorCSSAgent::getStylesForNode2 [0x01ADCDFA+170] (c:\src\chrome\src\third_party\webkit\webcore\inspector\inspectorcssagent.cpp:186)
	WebCore::InspectorBackendDispatcher::getStylesForNode2 [0x023767B7+311] (c:\src\chrome\src\webkit\debug\obj\global_intermediate\webcore\inspectorbackenddispatcher.cpp:1762)
	WebCore::InspectorBackendDispatcher::dispatch [0x0237EDAE+8110] (c:\src\chrome\src\webkit\debug\obj\global_intermediate\webcore\inspectorbackenddispatcher.cpp:2678)
	WebKit::WebDevToolsAgentImpl::dispatchOnInspectorBackend [0x0108AFFD+61] (c:\src\chrome\src\third_party\webkit\webkit\chromium\src\webdevtoolsagentimpl.cpp:241)
	DRTDevToolsAgent::call [0x00BAE56C+60] (c:\src\chrome\src\third_party\webkit\webkittools\dumprendertree\chromium\drtdevtoolsagent.cpp:96)
	DRTDevToolsAgent::AsyncCallTask::runIfValid [0x00BAE450+32] (c:\src\chrome\src\third_party\webkit\webkittools\dumprendertree\chromium\drtdevtoolsagent.h:88)
	MethodTask<DRTDevToolsAgent>::run [0x00BAEB27+39] (c:\src\chrome\src\third_party\webkit\webkittools\dumprendertree\chromium\task.h:72)
	invokeTask [0x00BA8E1C+44] (c:\src\chrome\src\third_party\webkit\webkittools\dumprendertree\chromium\task.cpp:61)
	DispatchToFunction<void (__cdecl*)(void *),void *> [0x00F6DE1F+15] (c:\src\chrome\src\base\tuple.h:614)
	RunnableFunction<void (__cdecl*)(void *),Tuple1<void *> >::Run [0x00F6DD2A+42] (c:\src\chrome\src\base\task.h:441)
	MessageLoop::RunTask [0x021ED8C0+272] (c:\src\chrome\src\base\message_loop.cc:423)
	MessageLoop::DeferOrRunPendingTask [0x021ED9F5+53] (c:\src\chrome\src\base\message_loop.cc:435)
	MessageLoop::DoWork [0x021EDF4C+236] (c:\src\chrome\src\base\message_loop.cc:539)
	base::MessagePumpForUI::DoRunLoop [0x02239564+84] (c:\src\chrome\src\base\message_pump_win.cc:201)
	base::MessagePumpWin::RunWithDispatcher [0x02238DB2+130] (c:\src\chrome\src\base\message_pump_win.cc:49)
	base::MessagePumpWin::Run [0x0223901C+28] (c:\src\chrome\src\base\message_pump_win.h:79)
	MessageLoop::RunInternal [0x021ECE76+262] (c:\src\chrome\src\base\message_loop.cc:271)
	MessageLoop::RunHandler [0x021ECC3E+46] (c:\src\chrome\src\base\message_loop.cc:244)
	MessageLoop::Run [0x021ECB2A+58] (c:\src\chrome\src\base\message_loop.cc:222)
	webkit_support::RunMessageLoop [0x00F6B12F+15] (c:\src\chrome\src\webkit\support\webkit_support.cc:328)
	TestShell::waitTestFinished [0x00B7ED9D+141] (c:\src\chrome\src\third_party\webkit\webkittools\dumprendertree\chromium\testshellwin.cpp:106)
	TestShell::runFileTest [0x00B9875B+411] (c:\src\chrome\src\third_party\webkit\webkittools\dumprendertree\chromium\testshell.cpp:187)
	runTest [0x00BAD21D+621] (c:\src\chrome\src\third_party\webkit\webkittools\dumprendertree\chromium\dumprendertree.cpp:92)
	main [0x00BAC9E9+1897] (c:\src\chrome\src\third_party\webkit\webkittools\dumprendertree\chromium\dumprendertree.cpp:193)
	__tmainCRTStartup [0x01127073+563] (f:\dd\vctools\crt_bld\self_x86\crt\src\crt0.c:327)
	mainCRTStartup [0x01126E3D+13] (f:\dd\vctools\crt_bld\self_x86\crt\src\crt0.c:196)
	BaseThreadInitThunk [0x7675ECCB+14]
	RtlCreateUserProcess [0x774AD24D+140]
	RtlCreateProcessParameters [0x774AD45F+78]
Comment 1 Tony Chang 2010-12-08 16:35:04 PST
Here's another stack:
ASSERTION FAILED: style == inlineStyle()
(c:\src\chrome\src\third_party\webkit\webcore\inspector\InspectorStyleSheet.h:245 WebCore::InspectorStyleSheetForInlineStyle::ruleSourceDataFor)
Backtrace:
	WebCore::InspectorStyleSheetForInlineStyle::ruleSourceDataFor [0x012762F7+55] (c:\src\chrome\src\third_party\webkit\webcore\inspector\inspectorstylesheet.h:245)
	WebCore::InspectorStyle::buildObjectForStyle [0x01270665+389] (c:\src\chrome\src\third_party\webkit\webcore\inspector\inspectorstylesheet.cpp:144)
	WebCore::InspectorStyleSheet::buildObjectForStyle [0x012744EA+442] (c:\src\chrome\src\third_party\webkit\webcore\inspector\inspectorstylesheet.cpp:739)
	WebCore::InspectorCSSAgent::getStylesForNode2 [0x010C994A+170] (c:\src\chrome\src\third_party\webkit\webcore\inspector\inspectorcssagent.cpp:186)
	WebCore::InspectorBackendDispatcher::getStylesForNode2 [0x0196D057+311] (c:\src\chrome\src\webkit\debug\obj\global_intermediate\webcore\inspectorbackenddispatcher.cpp:1821)
	WebCore::InspectorBackendDispatcher::dispatch [0x01975D8E+8110] (c:\src\chrome\src\webkit\debug\obj\global_intermediate\webcore\inspectorbackenddispatcher.cpp:2762)
	WebKit::WebDevToolsAgentImpl::dispatchOnInspectorBackend [0x006707AD+61] (c:\src\chrome\src\third_party\webkit\webkit\chromium\src\webdevtoolsagentimpl.cpp:241)
	DRTDevToolsAgent::call [0x0010E49C+60] (c:\src\chrome\src\third_party\webkit\webkittools\dumprendertree\chromium\drtdevtoolsagent.cpp:96)
	DRTDevToolsAgent::AsyncCallTask::runIfValid [0x0010E380+32] (c:\src\chrome\src\third_party\webkit\webkittools\dumprendertree\chromium\drtdevtoolsagent.h:88)
	MethodTask<DRTDevToolsAgent>::run [0x0010EA57+39] (c:\src\chrome\src\third_party\webkit\webkittools\dumprendertree\chromium\task.h:72)
	invokeTask [0x00108E3C+44] (c:\src\chrome\src\third_party\webkit\webkittools\dumprendertree\chromium\task.cpp:61)
	DispatchToFunction<void (__cdecl*)(void *),void *> [0x0055359F+15] (c:\src\chrome\src\base\tuple.h:614)
	RunnableFunction<void (__cdecl*)(void *),Tuple1<void *> >::Run [0x005534AA+42] (c:\src\chrome\src\base\task.h:441)
	MessageLoop::RunTask [0x017E42D0+272] (c:\src\chrome\src\base\message_loop.cc:423)
	MessageLoop::DeferOrRunPendingTask [0x017E4405+53] (c:\src\chrome\src\base\message_loop.cc:435)
	MessageLoop::DoWork [0x017E495C+236] (c:\src\chrome\src\base\message_loop.cc:539)
	base::MessagePumpForUI::DoRunLoop [0x018301C4+84] (c:\src\chrome\src\base\message_pump_win.cc:201)
	base::MessagePumpWin::RunWithDispatcher [0x0182FA12+130] (c:\src\chrome\src\base\message_pump_win.cc:49)
	base::MessagePumpWin::Run [0x0182FC7C+28] (c:\src\chrome\src\base\message_pump_win.h:79)
	MessageLoop::RunInternal [0x017E3886+262] (c:\src\chrome\src\base\message_loop.cc:271)
	MessageLoop::RunHandler [0x017E364E+46] (c:\src\chrome\src\base\message_loop.cc:244)
	MessageLoop::Run [0x017E353A+58] (c:\src\chrome\src\base\message_loop.cc:222)
	webkit_support::RunMessageLoop [0x00550D7F+15] (c:\src\chrome\src\webkit\support\webkit_support.cc:328)
	TestShell::waitTestFinished [0x000DEDDD+141] (c:\src\chrome\src\third_party\webkit\webkittools\dumprendertree\chromium\testshellwin.cpp:106)
	TestShell::runFileTest [0x000F879B+411] (c:\src\chrome\src\third_party\webkit\webkittools\dumprendertree\chromium\testshell.cpp:187)
	runTest [0x0010D14D+621] (c:\src\chrome\src\third_party\webkit\webkittools\dumprendertree\chromium\dumprendertree.cpp:92)
	main [0x0010C919+1897] (c:\src\chrome\src\third_party\webkit\webkittools\dumprendertree\chromium\dumprendertree.cpp:193)
	__tmainCRTStartup [0x0070C443+563] (f:\dd\vctools\crt_bld\self_x86\crt\src\crt0.c:327)
	mainCRTStartup [0x0070C20D+13] (f:\dd\vctools\crt_bld\self_x86\crt\src\crt0.c:196)
	BaseThreadInitThunk [0x7675ECCB+14]
	RtlCreateUserProcess [0x774AD24D+140]
	RtlCreateProcessParameters [0x774AD45F+78]
Comment 2 Alexander Pavlov (apavlov) 2010-12-09 06:09:17 PST
Looks like the inspected page DOM/CSS structures have been destroyed but InspectorCSSAgent is still live (together with InspectorController, I presume) and trying to provide data to the DevTools frontend. Is this situation potentially possible in the new DRT setup (perhaps [abnormal] renderer process termination or something)?
Comment 3 Tony Chang 2010-12-09 17:34:21 PST
(In reply to comment #2)
> Looks like the inspected page DOM/CSS structures have been destroyed but InspectorCSSAgent is still live (together with InspectorController, I presume) and trying to provide data to the DevTools frontend. Is this situation potentially possible in the new DRT setup (perhaps [abnormal] renderer process termination or something)?

I don't think this is possible, but an extra pair of eyes to look at this would be helpful.

It looks like DRTDevToolsAgent keep a pointer to the current page (m_webView).  This webview is set when we start DRT in TestShell() and set to NULL in ~TestShell.  It doesn't look like this webview changes during the life of DRT.  Kent-san, does that sound correct to you?
Comment 4 Tony Chang 2010-12-10 12:07:08 PST
*** Bug 50822 has been marked as a duplicate of this bug. ***
Comment 5 Tony Chang 2010-12-10 12:07:18 PST
*** Bug 50823 has been marked as a duplicate of this bug. ***
Comment 6 Kent Tamura 2010-12-12 22:23:45 PST
(In reply to comment #3)
> (In reply to comment #2)
> > Looks like the inspected page DOM/CSS structures have been destroyed but InspectorCSSAgent is still live (together with InspectorController, I presume) and trying to provide data to the DevTools frontend. Is this situation potentially possible in the new DRT setup (perhaps [abnormal] renderer process termination or something)?
> 
> I don't think this is possible, but an extra pair of eyes to look at this would be helpful.
> 
> It looks like DRTDevToolsAgent keep a pointer to the current page (m_webView).  This webview is set when we start DRT in TestShell() and set to NULL in ~TestShell.  It doesn't look like this webview changes during the life of DRT.  Kent-san, does that sound correct to you?

I think TestShell::m_webView can not be changed.  However the document tree in m_webView is replaced by page transition.
Comment 7 Ilya Tikhonovsky 2010-12-22 08:06:55 PST
Created attachment 77216 [details]
[patch] initial version
Comment 8 Ilya Tikhonovsky 2010-12-22 08:11:17 PST
Created attachment 77217 [details]
[patch] initial version without changes in test_expectations.
Comment 9 Yury Semikhatsky 2010-12-22 08:19:58 PST
Comment on attachment 77217 [details]
[patch] initial version without changes in test_expectations.

View in context: https://bugs.webkit.org/attachment.cgi?id=77217&action=review

> Tools/ChangeLog:7
> +        DevTools window shourd be closed explicitly because it has custom deinitialization code.

typo: shourd->should
Comment 10 Ilya Tikhonovsky 2010-12-22 08:23:45 PST
Comment on attachment 77217 [details]
[patch] initial version without changes in test_expectations.

Committed r74480
	M	Tools/DumpRenderTree/chromium/TestShell.cpp
	M	Tools/ChangeLog
r74480 = cf82d7784f72b8f43fa9d797fb792c9189e26dc3 (refs/remotes/trunk)
Comment 11 Tony Chang 2010-12-26 00:38:25 PST
Thanks for fixing, loislo!  Can we close this bug now?