Tuesday, September 15, 2015

Azure WebJobs - HTTP (409) Conflict causing Microsoft.WindowsAzure.Storage.StorageException

Below is another exception which can happen if we are using shared storage resources in WebJobs. HTTP 409 is not commonly implemented by web servers as its reserved for applications to convey specific conflicts in requests.

[07/14/2015 18:28:28 > 65f7a4: SYS INFO] Status changed to Initializing
[07/14/2015 18:28:32 > 65f7a4: SYS INFO] Run script 'AzureWebJob45.exe' with script host - 'WindowsScriptHost'
[07/14/2015 18:28:32 > 65f7a4: SYS INFO] Status changed to Running
[07/14/2015 18:28:33 > 65f7a4: ERR ]
[07/14/2015 18:28:33 > 65f7a4: ERR ] Unhandled Exception: Microsoft.WindowsAzure.Storage.StorageException: The remote server returned an error: (409) Conflict. ---> System.Net.WebException: The remote server returned an error: (409) Conflict.
[07/14/2015 18:28:33 > 65f7a4: ERR ]    at Microsoft.WindowsAzure.Storage.Shared.Protocol.HttpResponseParsers.ProcessExpectedStatusCodeNoException[T](HttpStatusCode expectedStatusCode, HttpStatusCode actualStatusCode, T retVal, StorageCommandBase`1 cmd, Exception ex)
[07/14/2015 18:28:33 > 65f7a4: ERR ]    at Microsoft.WindowsAzure.Storage.Blob.CloudBlobContainer.<CreateContainerImpl>b__27(RESTCommand`1 cmd, HttpWebResponse resp, Exception ex, OperationContext ctx)
[07/14/2015 18:28:33 > 65f7a4: ERR ]    at Microsoft.WindowsAzure.Storage.Core.Executor.Executor.EndGetResponse[T](IAsyncResult getResponseResult)
[07/14/2015 18:28:33 > 65f7a4: ERR ]    --- End of inner exception stack trace ---
[07/14/2015 18:28:33 > 65f7a4: ERR ]    at Microsoft.WindowsAzure.Storage.Core.Util.StorageAsyncResult`1.End()
[07/14/2015 18:28:33 > 65f7a4: ERR ]    at Microsoft.WindowsAzure.Storage.Blob.CloudBlobContainer.EndCreateIfNotExists(IAsyncResult asyncResult)
[07/14/2015 18:28:33 > 65f7a4: ERR ]    at Microsoft.WindowsAzure.Storage.Core.Util.AsyncExtensions.<>c__DisplayClass1`1.<CreateCallback>b__0(IAsyncResult ar)
[07/14/2015 18:28:33 > 65f7a4: ERR ] --- End of stack trace from previous location where exception was thrown ---
[07/14/2015 18:28:33 > 65f7a4: ERR ]    at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
[07/14/2015 18:28:33 > 65f7a4: ERR ]    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
[07/14/2015 18:28:33 > 65f7a4: ERR ]    at Microsoft.Azure.WebJobs.Host.Executors.DynamicHostIdProvider.<TryInitializeIdAsync>d__10.MoveNext()
[07/14/2015 18:28:33 > 65f7a4: ERR ] --- End of stack trace from previous location where exception was thrown ---
[07/14/2015 18:28:33 > 65f7a4: ERR ]    at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
[07/14/2015 18:28:33 > 65f7a4: ERR ]    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
[07/14/2015 18:28:33 > 65f7a4: ERR ]    at Microsoft.Azure.WebJobs.Host.Executors.DynamicHostIdProvider.<GetOrCreateHostIdAsync>d__0.MoveNext()
[07/14/2015 18:28:33 > 65f7a4: ERR ] --- End of stack trace from previous location where exception was thrown ---
[07/14/2015 18:28:33 > 65f7a4: ERR ]    at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
[07/14/2015 18:28:33 > 65f7a4: ERR ]    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
[07/14/2015 18:28:33 > 65f7a4: ERR ]    at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)
[07/14/2015 18:28:33 > 65f7a4: ERR ]    at Microsoft.Azure.WebJobs.Host.Executors.JobHostContext.<CreateAndLogHostStartedAsync>d__2.MoveNext()
[07/14/2015 18:28:33 > 65f7a4: ERR ] --- End of stack trace from previous location where exception was thrown ---
[07/14/2015 18:28:33 > 65f7a4: ERR ]    at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
[07/14/2015 18:28:33 > 65f7a4: ERR ]    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
[07/14/2015 18:28:33 > 65f7a4: ERR ]    at Microsoft.Azure.WebJobs.JobHost.<CreateContextAndLogHostStartedAsync>d__f.MoveNext()
[07/14/2015 18:28:33 > 65f7a4: ERR ] --- End of stack trace from previous location where exception was thrown ---
[07/14/2015 18:28:33 > 65f7a4: ERR ]    at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
[07/14/2015 18:28:33 > 65f7a4: ERR ]    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
[07/14/2015 18:28:33 > 65f7a4: ERR ]    at Microsoft.Azure.WebJobs.JobHost.<StartAsyncCore>d__0.MoveNext()
[07/14/2015 18:28:33 > 65f7a4: ERR ] --- End of stack trace from previous location where exception was thrown ---
[07/14/2015 18:28:33 > 65f7a4: ERR ]    at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
[07/14/2015 18:28:33 > 65f7a4: ERR ]    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
[07/14/2015 18:28:33 > 65f7a4: ERR ]    at Microsoft.Azure.WebJobs.JobHost.Start()
[07/14/2015 18:28:33 > 65f7a4: ERR ]    at Microsoft.Azure.WebJobs.JobHost.RunAndBlock()
[07/14/2015 18:28:33 > 65f7a4: ERR ]    at AzureWebJob45.Program.Main()
[07/14/2015 18:28:33 > 65f7a4: SYS INFO] Status changed to Failed
[07/14/2015 18:28:33 > 65f7a4: SYS ERR ] Job failed due to exit code -532462766

To resolve this in WebJobs
  • Check for any console.logging statements which are supposed to be shared by different WebJob executions. Avoid if any.
  • Also make sure the blobs, tables and all are not shared between the executions. We can share common SQL tables as the concurrency is handled by SQL Server. This is true for other databases such as Oracle and all.

2 comments:

Blogger said...

If you need your ex-girlfriend or ex-boyfriend to come crawling back to you on their knees (even if they're dating somebody else now) you must watch this video
right away...

(VIDEO) Text Your Ex Back?

Blogger said...

eToro is the most recommended forex trading platform for beginning and pro traders.