2015-11-13 101 views
3

當在模擬器中本地運行時,web worker工作正常。但是每當我更新了Azure的VM上運行我的網絡工作者我得到在事件查看器和作用,但下列情況除外例外不會啓動:無法啓動Azure工作者角色,異常代碼0xe0434352&0xC0000035

Application: WaWorkerHost.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.AggregateException
Stack: at System.Threading.Tasks.Task.Wait(Int32, System.Threading.CancellationToken) at System.Threading.Tasks.Task.Wait()
at Foo.PushProcess.WorkerRole.Run()
at Microsoft.WindowsAzure.ServiceRuntime.RoleEnvironment.StartRoleInternal() at Microsoft.WindowsAzure.ServiceRuntime.Implementation.Loader.RoleRuntimeBridge.b__2() at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)
at System.Threading.ThreadHelper.ThreadStart()

Inner Exception: A task was canceled.

Faulting application name: WaWorkerHost.exe, version: 2.6.1198.712, time stamp: 0x54eba731
Faulting module name: KERNELBASE.dll, version: 6.3.9600.17415, time stamp: 0x54505737
Exception code: 0xe0434352
Fault offset: 0x0000000000008b9c
Faulting process id: 0xfb8
Faulting application start time: 0x01d11e3128981a5d
Faulting application path: E:\base\x64\WaWorkerHost.exe
Faulting module path: D:\Windows\system32\KERNELBASE.dll
Report Id: 30631c5c-8a25-11e5-80c6-000d3a22f3ec
Faulting package full name:
Faulting package-relative application ID:

Session "MA_ETWSESSION_WAD_415df88f8a0447178dbd4c18f1349f0e_Foo.PushProcess_Foo.PushProcess_IN_0" failed to start with the following error: 0xC0000035

這是相關代碼:

public override void Run() 
{ 
    Trace.TraceInformation("Foo.PushProcess is running"); 

    try 
    { 
     RunAsync(_cancellationTokenSource.Token).Wait(); // This is where the exceptions point to 
    } 
    catch (Exception ex) 
    { 
     Trace.TraceError("[WORKER] Run error: " + ex); 
    } 
    finally 
    { 
     _runCompleteEvent.Set(); 
    } 
} 

public override bool OnStart() 
{ 
    // Set the maximum number of concurrent connections 
    ServicePointManager.DefaultConnectionLimit = 12; 

    // For information on handling configuration changes 
    // see the MSDN topic at http://go.microsoft.com/fwlink/?LinkId=166357. 

    bool result = base.OnStart(); 

    _storageAccount = CloudStorageAccount.Parse(RoleEnvironment.GetConfigurationSettingValue("StorageConnectionString")); 
    var queueClient = _storageAccount.CreateCloudQueueClient(); 
    _pushQueue = queueClient.GetQueueReference("pushes"); 
    _pushQueue.CreateIfNotExists(); 

    CreatePushBroker(); 

    Trace.TraceInformation("Foo.PushProcess has been started"); 

    return result; 
} 

private async Task RunAsync(CancellationToken cancellationToken) 
{ 
    while (!cancellationToken.IsCancellationRequested) 
    { 
     Trace.TraceInformation("Working"); 
     CloudQueueMessage message = null; 
     try 
     { 
      message = _pushQueue.GetMessage(); 
      if (message != null) 
      { 
       ProcessItem(message); 
      } 
     } 
     catch (Exception ex) 
     { 
      if (message != null && message.DequeueCount > 5) 
       _pushQueue.DeleteMessage(message); 

      Trace.TraceError("[WORKER] Retrieval Failure: " + ex); 
     } 

     await Task.Delay(1000, cancellationToken); 
    } 
} 

注意一些代碼已被省略,但是這些代碼都是在初始化之後運行的,理論上這個異常沒有達到。

我完全不知道是什麼原因導致此問題。任何幫助將不勝感激 - 即使只是爲了幫助我得到一個有用的例外。

UPDATE

我現在已經減少了我的代碼以下 - 這是作爲一個網絡工作者都不可能是簡單 - 和我仍然得到例外。我相信無論是老員工都被緩存,還是在部署過程中都有問題。

public override void Run() 
{ 
    Trace.TraceInformation("Foo.PushProcess is running"); 

    try 
    { 
     RunAsync(_cancellationTokenSource.Token).Wait(); // This is where the exceptions point to 
    } 
    catch (Exception ex) 
    { 
     Trace.TraceError("[WORKER] Run error: " + ex); 
    } 
    finally 
    { 
     _runCompleteEvent.Set(); 
    } 
} 

public override bool OnStart() 
{ 
    // Set the maximum number of concurrent connections 
    ServicePointManager.DefaultConnectionLimit = 12; 

    // For information on handling configuration changes 
    // see the MSDN topic at http://go.microsoft.com/fwlink/?LinkId=166357. 

    bool result = base.OnStart(); 

    return result; 
} 

private async Task RunAsync(CancellationToken cancellationToken) 
{ 
    while (!cancellationToken.IsCancellationRequested) 
    { 
     Trace.TraceInformation("Working"); 

     // code removed for testing - no work is being done. 

     await Task.Delay(1000, cancellationToken); 
    } 
} 
+1

嘗試發送鳴叫一個鏈接到這個問題@AzureSupport –

+0

@StenPetrov感謝的是,我現在就發送。 –

+0

現在解決了這個問題 - 我只是刪除了運行這個輔助角色的原始虛擬機,並創建了一個新的虛擬機。代碼然後在新的遠程機器上運行,沒有任何錯誤。不幸的是,我無法解釋爲什麼。 –

回答

0

要解決這個問題,我只是刪除其持有的工作者角色原雲虛擬機實例,重建並重新公佈的作用。從這一點來看,它工作得很好。

我仍然無法確定是什麼原因造成的錯誤,並且已經有過這樣沒有其他問題與任何其他工人的作用。我的假設是,VM存在配置問題,無法通過代碼或Azure門戶進行修改。

0

我給了這個旋轉,並沒有能夠得到這個repro在我的目的。我從部署的.Net Fx版本4.6運行的MSDN Azure映像中獲得VS 2015 Enterprise(14.0.23107.0 D14REL)。我安裝了Azure Tools和SDK 2.8。我使用.NET Fx 4.5.2創建了一個新的Azure雲服務,並添加了一個輔助角色。

我只是跑從你的一些稀疏的代碼模板如下:

public class WorkerRole : RoleEntryPoint 
{ 
    private readonly CancellationTokenSource cancellationTokenSource = new CancellationTokenSource(); 
    private readonly ManualResetEvent runCompleteEvent = new ManualResetEvent(false); 
    private CloudQueue _pushQueue; 
    private CloudStorageAccount _storageAccount; 

    public override void Run() 
    { 
     Trace.TraceInformation("WorkerRole1 is running"); 

     try 
     { 
      this.RunAsync(this.cancellationTokenSource.Token).Wait(); 
     } 
     catch (Exception ex) 
     { 
      Trace.TraceError("[WORKER] Run error: " + ex); 
     } 
     finally 
     { 
      this.runCompleteEvent.Set(); 
     } 
    } 

    public override bool OnStart() 
    { 
     // Set the maximum number of concurrent connections 
     ServicePointManager.DefaultConnectionLimit = 12; 

     // For information on handling configuration changes 
     // see the MSDN topic at http://go.microsoft.com/fwlink/?LinkId=166357. 
     bool result = base.OnStart(); 
     _storageAccount = CloudStorageAccount.Parse(RoleEnvironment.GetConfigurationSettingValue("StorageConnectionString")); 
     var queueClient = _storageAccount.CreateCloudQueueClient(); 
     _pushQueue = queueClient.GetQueueReference("pushes"); 
     _pushQueue.CreateIfNotExists(); 

     CreatePushBroker(); 

     Trace.TraceInformation("Foo.PushProcess has been started"); 

     return result; 

    } 

    private void CreatePushBroker() 
    { 
     return; 
    } 

    public override void OnStop() 
    { 
     Trace.TraceInformation("WorkerRole1 is stopping"); 

     this.cancellationTokenSource.Cancel(); 
     this.runCompleteEvent.WaitOne(); 

     base.OnStop(); 

     Trace.TraceInformation("WorkerRole1 has stopped"); 
    } 

    private async Task RunAsync(CancellationToken cancellationToken) 
    { 
     // TODO: Replace the following with your own logic. 
     while (!cancellationToken.IsCancellationRequested) 
     { 
      Trace.TraceInformation("Working"); 
      CloudQueueMessage message = null; 
      try 
      { 
       message = _pushQueue.GetMessage(); 
       if (message != null) 
       { 
        ProcessItem(message); 
       } 
      } 
      catch (Exception ex) 
      { 
       if (message != null && message.DequeueCount > 5) 
        _pushQueue.DeleteMessage(message); 

       Trace.TraceError("[WORKER] Retrieval Failure: " + ex); 
      } 

      await Task.Delay(1000, cancellationToken); 

     } 
    } 

    private void ProcessItem(CloudQueueMessage message) 
    { 
     return; 
    } 
} 

}

,如果沒有問題,運行在本地模擬器,和我說幹就幹,它使用IntelliTrace部署到美國西部啓用,在一個小型實例VM上,並且有n個部署問題。它運行在WA-GUEST-OS-4.26_201511-0 guest worker角色映像上,並且我能夠將RDP加入到機器中,而且我沒有看到與代碼或機器相關的任何問題。你有沒有其他的二進制文件可能不包括在你的軟件包中,或者有一些依賴沒有被正確定義,或者存儲帳戶命名問題?

這是我的部署日誌。正如你所看到的,我花了大約7分鐘,因爲我從東美國拉存儲只是爲了好玩:

1:11:25 AM - 警告:有包確認警告。 1:11:26 AM - 檢查遠程桌面證書... 1:11:26 AM - 上傳證書... 1:11:42 AM - 應用診斷擴展。 1:12:24 AM - 使用服務管理URL'https://management.core.windows.net/'...準備AzureCloudService1的部署 - 2015/11/24 1:11:19使用訂閱ID'9a4715f5-acb8-4a18-8259-1c28b92XXXXX'... 1 :上午12:24 - 連接... 1:12:24 AM - 驗證存儲帳戶'ericgoleastus'... 1:12:24 AM - 上傳包... 1:12:28 AM - 創建。 .. 1:13:15 AM - 創建的部署ID:c5f26568707b46a3bd42466dd0bf7509。 1:13:15 AM - 角色WorkerRole1的實例0正在創建虛擬機 1:13:15 AM - 開始... 1:13:32 AM - 初始化... 1:14:36 AM - 角色WorkerRole1的實例0被啓動虛擬機 上午01時16分11秒 - 實例0角色的WorkerRole1處於未知狀態 上午1時16分43秒 - 實例0角色的WorkerRole1忙 細節:開始的作用.. 。系統正在初始化。 [2015-11-24T01:16:08Z] 1:19:50 AM - 角色WorkerRole1的實例0準備就緒 1:19:50 AM - 創建的Web應用程序URL:http://quequetest.cloudapp.net/ 1:19:50 AM - 完成。

讓我們知道,如果你可以得到一些更多的細節可能啓用的IntelliTrace。

問候, 埃裏克

+0

感謝您的努力@ericgol。事實上我確實通過拆除原來的虛擬機並創建一個新代碼來實現這個代碼的工作。我不確定問題到底是什麼,但代碼現在運行得非常愉快,沒有任何修改。不幸的是,由於時間限制,我沒有得到充分調查問題。 –