Manager.Dispose Hangs

6 posts, 0 answers
  1. Aaron
    Aaron avatar
    12 posts
    Member since:
    Apr 2011

    Posted 16 May 2012 Link to this post

    Often times our automation build hangs on random tests.  I have been able to narrow the hang down to the Manager.Dispose function.

    We are automating a Silverlight application in IE.

    When the hang happens there are no instances of IE open and I have to kill the hosting process (nunit-console.exe) in task manager.

    Is this a known issue?  Is there any way for me to work around this?

    I have crash dumps I can make available if necessary.

    Here are some specs of the environment:
    WebAII version: Telerik_Testing_Framework_2011_2_1413_FREE_EDITION
    OS: Windows Server 2003 Service Pack 2 32bit
    Browser: IE 8
    Test Harness: NUnit
    .Net Version: 4.0
    Silverlight Version: 5.0
    Ram: 1gb
    CPU: 1 Cores @ 2.1 Ghz 

    The following is the call stack for the thread that is hung:

    ntdll.dll!_KiFastSystemCallRet@0() 
    ntdll.dll!_NtWaitForMultipleObjects@20()  + 0xc bytes  
    kernel32.dll!_WaitForMultipleObjectsEx@20()  + 0xd2 bytes  
    user32.dll!_RealMsgWaitForMultipleObjectsEx@20()  + 0xbf bytes 
    ole32.dll!CCliModalLoop::BlockFn()  + 0x358 bytes  
    ole32.dll!_CoWaitForMultipleHandles@20()  + 0xb7 bytes 
    [Managed to Native Transition] 
    mscorlib.dll!System.Threading.WaitHandle.InternalWaitOne(System.Runtime.InteropServices.SafeHandle waitableSafeHandle, long millisecondsTimeout, bool hasThreadAffinity, bool exitContext) + 0x2b bytes
    mscorlib.dll!System.Threading.WaitHandle.WaitOne(System.TimeSpan timeout, bool exitContext) + 0x6e bytes   
    WindowsBase.dll!System.Windows.Threading.DispatcherOperation.DispatcherOperationEvent.WaitOne() + 0x35 bytes   
    WindowsBase.dll!System.Windows.Threading.DispatcherOperation.Wait(System.TimeSpan timeout) + 0x87 bytes
    WindowsBase.dll!System.Windows.Threading.Dispatcher.InvokeImpl(System.Windows.Threading.DispatcherPriority priority, System.TimeSpan timeout, System.Delegate method, object args, int numArgs) + 0xdb bytes   
    WindowsBase.dll!System.Windows.Threading.Dispatcher.CriticalInvokeShutdown() + 0x63 bytes  
    ArtOfTest.WebAii.dll!ArtOfTest.WebAii.Win32.UIADispatcherProvider.ClearDispatcher() + 0x47 bytes   
    ArtOfTest.WebAii.dll!ArtOfTest.WebAii.Core.Manager.End() + 0x37c bytes 
    ArtOfTest.WebAii.dll!ArtOfTest.WebAii.Core.Manager.Dispose(bool disposing) + 0x1c bytes
    WebWise.Automation.Framework.DLL!WebWise.Automation.Framework.WebWiseAutomationClient.Dispose() Line 144 + 0x1c bytes   C#
    WebWise.Automation.Tests.DLL!WebWise.Automation.Tests.BaseAutomationFixture.FixtureTearDown() Line 43 + 0x49 bytes  C#
    [Native to Managed Transition] 
    [Managed to Native Transition] 
    nunit.core.DLL!NUnit.Core.Reflect.InvokeMethod(System.Reflection.MethodInfo method, object fixture, object[] args) + 0x39 bytes
    nunit.core.DLL!NUnit.Core.TestSuite.DoOneTimeTearDown(NUnit.Core.TestResult suiteResult = {NUnit.Core.TestResult}) + 0x92 bytes
    nunit.core.DLL!NUnit.Core.NUnitTestFixture.DoOneTimeTearDown(NUnit.Core.TestResult suiteResult = {NUnit.Core.TestResult}) + 0xf bytes  
    nunit.core.DLL!NUnit.Core.TestSuite.RunSuite(NUnit.Core.EventListener listener, NUnit.Core.ITestFilter filter) + 0x20d bytes   
    nunit.core.DLL!NUnit.Core.TestSuite.RunSuiteInContext(NUnit.Core.EventListener listener, NUnit.Core.ITestFilter filter) + 0x43 bytes   
    nunit.core.DLL!NUnit.Core.TestSuite.Run(NUnit.Core.EventListener listener = {NUnit.Core.QueuingEventListener}, NUnit.Core.ITestFilter filter) + 0x67 bytes 
    nunit.core.DLL!NUnit.Core.TestFixture.Run(NUnit.Core.EventListener listener, NUnit.Core.ITestFilter filter) + 0x61 bytes   
    nunit.core.DLL!NUnit.Core.TestSuite.RunAllTests(NUnit.Core.TestResult suiteResult = {NUnit.Core.TestResult}, NUnit.Core.EventListener listener = {NUnit.Core.QueuingEventListener}, NUnit.Core.ITestFilter filter = {NUnit.Core.TestFilter.EmptyFilter}) + 0x188 bytes 
    nunit.core.DLL!NUnit.Core.TestSuite.RunSuite(NUnit.Core.EventListener listener, NUnit.Core.ITestFilter filter) + 0x1dc bytes   
    nunit.core.DLL!NUnit.Core.TestSuite.RunSuiteInContext(NUnit.Core.EventListener listener, NUnit.Core.ITestFilter filter) + 0x43 bytes   
    nunit.core.DLL!NUnit.Core.TestSuite.Run(NUnit.Core.EventListener listener = {NUnit.Core.QueuingEventListener}, NUnit.Core.ITestFilter filter) + 0x67 bytes 
    nunit.core.DLL!NUnit.Core.TestSuite.RunAllTests(NUnit.Core.TestResult suiteResult = {NUnit.Core.TestResult}, NUnit.Core.EventListener listener = {NUnit.Core.QueuingEventListener}, NUnit.Core.ITestFilter filter = {NUnit.Core.TestFilter.EmptyFilter}) + 0x188 bytes 
    nunit.core.DLL!NUnit.Core.TestSuite.RunSuite(NUnit.Core.EventListener listener, NUnit.Core.ITestFilter filter) + 0x1dc bytes   
    nunit.core.DLL!NUnit.Core.TestSuite.RunSuiteInContext(NUnit.Core.EventListener listener, NUnit.Core.ITestFilter filter) + 0x43 bytes   
    nunit.core.DLL!NUnit.Core.TestSuite.Run(NUnit.Core.EventListener listener = {NUnit.Core.QueuingEventListener}, NUnit.Core.ITestFilter filter) + 0x67 bytes 
    nunit.core.DLL!NUnit.Core.TestSuite.RunAllTests(NUnit.Core.TestResult suiteResult = {NUnit.Core.TestResult}, NUnit.Core.EventListener listener = {NUnit.Core.QueuingEventListener}, NUnit.Core.ITestFilter filter = {NUnit.Core.TestFilter.EmptyFilter}) + 0x188 bytes 
    nunit.core.DLL!NUnit.Core.TestSuite.RunSuite(NUnit.Core.EventListener listener, NUnit.Core.ITestFilter filter) + 0x1dc bytes   
    nunit.core.DLL!NUnit.Core.TestSuite.RunSuiteInContext(NUnit.Core.EventListener listener, NUnit.Core.ITestFilter filter) + 0x43 bytes   
    nunit.core.DLL!NUnit.Core.TestSuite.Run(NUnit.Core.EventListener listener = {NUnit.Core.QueuingEventListener}, NUnit.Core.ITestFilter filter) + 0x67 bytes 
    nunit.core.DLL!NUnit.Core.TestSuite.RunAllTests(NUnit.Core.TestResult suiteResult = {NUnit.Core.TestResult}, NUnit.Core.EventListener listener = {NUnit.Core.QueuingEventListener}, NUnit.Core.ITestFilter filter = {NUnit.Core.TestFilter.EmptyFilter}) + 0x188 bytes 
    nunit.core.DLL!NUnit.Core.TestSuite.RunSuite(NUnit.Core.EventListener listener, NUnit.Core.ITestFilter filter) + 0x1dc bytes   
    nunit.core.DLL!NUnit.Core.TestSuite.RunSuiteInContext(NUnit.Core.EventListener listener, NUnit.Core.ITestFilter filter) + 0x43 bytes   
    nunit.core.DLL!NUnit.Core.TestSuite.Run(NUnit.Core.EventListener listener = {NUnit.Core.QueuingEventListener}, NUnit.Core.ITestFilter filter) + 0x67 bytes 
    nunit.core.DLL!NUnit.Core.TestSuite.RunAllTests(NUnit.Core.TestResult suiteResult = {NUnit.Core.TestResult}, NUnit.Core.EventListener listener = {NUnit.Core.QueuingEventListener}, NUnit.Core.ITestFilter filter = {NUnit.Core.TestFilter.EmptyFilter}) + 0x188 bytes 
    nunit.core.DLL!NUnit.Core.TestSuite.RunSuite(NUnit.Core.EventListener listener, NUnit.Core.ITestFilter filter) + 0x1dc bytes   
    nunit.core.DLL!NUnit.Core.TestSuite.RunSuiteInContext(NUnit.Core.EventListener listener, NUnit.Core.ITestFilter filter) + 0x43 bytes   
    nunit.core.DLL!NUnit.Core.TestSuite.Run(NUnit.Core.EventListener listener = {NUnit.Core.QueuingEventListener}, NUnit.Core.ITestFilter filter) + 0x67 bytes 
    nunit.core.DLL!NUnit.Core.TestSuite.RunAllTests(NUnit.Core.TestResult suiteResult = {NUnit.Core.TestResult}, NUnit.Core.EventListener listener = {NUnit.Core.QueuingEventListener}, NUnit.Core.ITestFilter filter = {NUnit.Core.TestFilter.EmptyFilter}) + 0x188 bytes 
    nunit.core.DLL!NUnit.Core.TestSuite.RunSuite(NUnit.Core.EventListener listener, NUnit.Core.ITestFilter filter) + 0x1dc bytes   
    nunit.core.DLL!NUnit.Core.TestSuite.RunSuiteInContext(NUnit.Core.EventListener listener, NUnit.Core.ITestFilter filter) + 0x43 bytes   
    nunit.core.DLL!NUnit.Core.TestSuite.Run(NUnit.Core.EventListener listener = {NUnit.Core.QueuingEventListener}, NUnit.Core.ITestFilter filter) + 0x67 bytes 
    nunit.core.DLL!NUnit.Core.SetUpFixture.Run(NUnit.Core.EventListener listener, NUnit.Core.ITestFilter filter) + 0x61 bytes  
    nunit.core.DLL!NUnit.Core.TestSuite.RunAllTests(NUnit.Core.TestResult suiteResult = {NUnit.Core.TestResult}, NUnit.Core.EventListener listener = {NUnit.Core.QueuingEventListener}, NUnit.Core.ITestFilter filter = {NUnit.Core.TestFilter.EmptyFilter}) + 0x188 bytes 
    nunit.core.DLL!NUnit.Core.TestSuite.RunSuite(NUnit.Core.EventListener listener, NUnit.Core.ITestFilter filter) + 0x1dc bytes   
    nunit.core.DLL!NUnit.Core.TestSuite.RunSuiteInContext(NUnit.Core.EventListener listener, NUnit.Core.ITestFilter filter) + 0x43 bytes   
    nunit.core.DLL!NUnit.Core.TestSuite.Run(NUnit.Core.EventListener listener = {NUnit.Core.QueuingEventListener}, NUnit.Core.ITestFilter filter) + 0x67 bytes 
    nunit.core.DLL!NUnit.Core.SimpleTestRunner.Run(NUnit.Core.EventListener listener = {NUnit.Core.QueuingEventListener}, NUnit.Core.ITestFilter filter, bool tracing, NUnit.Core.LoggingThreshold logLevel) + 0xaf bytes  
    nunit.core.DLL!NUnit.Core.TestRunnerThread.TestRunnerThreadProc() + 0x47 bytes 
    mscorlib.dll!System.Threading.ThreadHelper.ThreadStart_Context(object state) + 0x63 bytes  
    mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool ignoreSyncCtx) + 0xb0 bytes   
    mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state) + 0x2c bytes   
    mscorlib.dll!System.Threading.ThreadHelper.ThreadStart() + 0x44 bytes  
    [Native to Managed Transition] 
    kernel32.dll!_BaseThreadStart@8()  + 0x34 bytes
  2. Stoich
    Admin
    Stoich avatar
    1 posts

    Posted 21 May 2012 Link to this post

    Hi Aron,
    why do you need to use Manager.Dispose()? What problem are you trying to solve by using it? I was not aware this function was exposed before you brought it up in your ticket.

    I encountered a lot of problems trying to use this function in both a regular and an Nunit test. The consensus among our devs was that you should simply refrain from invoking it.

    Please elaborate on the problem you're trying to address by using Manager.Dispose() so that we may assist you in coming up with an alternative approach.

    Regards,
    Stoich
    the Telerik team
    Quickly become an expert in Test Studio, check out our new training sessions!
    Test Studio Trainings
  3. Stoich
    Admin
    Stoich avatar
    1 posts

    Posted 21 May 2012 Link to this post

    Hello Aaron,
    I apologize - upon further consideration I realized I misunderstood your usecase initially.

    It seems you're not actually invoking Manager.Dispose() manually in code (which does lead to problems as already mentioned).

    Go ahead and send me a test case that runs against a public URL (and hits the issue). We will examine the code you have for any potential problems and we'll use the test to try and get a local repro of the issue.

    Kind regards,
    Stoich
    the Telerik team
    Quickly become an expert in Test Studio, check out our new training sessions!
    Test Studio Trainings
  4. Aaron
    Aaron avatar
    12 posts
    Member since:
    Apr 2011

    Posted 21 May 2012 Link to this post

    Hi Stoich,

    Thank you for your response.

    I am calling Dispose for the following 2 reasons

    1) Manger implements IDisposable and it is standard .net practices to call Dispose when you are done with an instance of an object implementing IDisposable.  Besides if it is not called directly by me when I know I'm done with the instance the garbage collector eventually calls it.

    2) It is outlined in the following telerik documentation to "Shut-down the manager and do all the clean-up".

    Here is the example for your benefit:

    // Initialize the settings you want used.
    Settings mySettings = new Settings(BrowserType.InternetExplorer, @"c:\log\");
       
    // Create the manager object
    Manager myManager = new Manager(mySettings);
       
    // Start the manager
    myManager.Start();
       
    // Launch a new browser instance. [This will launch an IE instance given the setting above]
    myManager.LaunchNewBrowser();
       
    // Navigate to a certain web page
    myManager.ActiveBrowser.NavigateTo("http://www.google.com");
       
    // Perform your automation actions.
    Element mybtn = myManager.ActiveBrowser.Find.ByTagIndex("input", 3);
    myManager.ActiveBrowser.Actions.Click(mybtn);
       
    // Shut-down the manager and do all clean-up
    myManager.Dispose();

  5. Aaron
    Aaron avatar
    12 posts
    Member since:
    Apr 2011

    Posted 21 May 2012 Link to this post

    Hello Stoich,

    I am attempting to figure out how to reliably reproduce this hang in a way that will be consumable by you.  I am not having any luck as of yet.

    However, I do have 2 memory dumps with the process in the hung state that I can make available.  These memory dumps are about 140 mb zipped each so emailing them wont work.  Do you have an FTP site I can upload them to?

    Also, what I can tell you is that when dispose hangs it's always in the tear down of the first fixture and thus the first time Manager.Dispose() gets called.
  6. Stoich
    Admin
    Stoich avatar
    1 posts

    Posted 28 May 2012 Link to this post

    Hi Aaron,
    I apologize for the late response.

    A simple suggestion would be for you to remove Manager.Dispose() from your code. As already mentioned: I can confirm that there is a problem with invoking it (especially in an Nunit test).

    Try removing that line of code and check and see whether it will affect the behavior of your test cases (apart from taking care of the hang problem).

    All the best,
    Stoich
    the Telerik team
    Quickly become an expert in Test Studio, check out our new training sessions!
    Test Studio Trainings
Back to Top