-
Notifications
You must be signed in to change notification settings - Fork 356
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use provided TextWriter or TraceWriter make webjob crash #1042
Comments
Thanks for filing this -- I want to focus on the TraceWriter issue you're seeing because:
I suspect that you have a different stack when using TraceWriter -- the stack you've included has |
Here is the request trace:
*Microsoft.Azure.WebJobs.Host.FunctionInvocationException*:
Microsoft.Azure.WebJobs.Host.FunctionInvocationException: Exception while
executing function: Functions.ProcessQueueMessage --->
System.ArgumentOutOfRangeException: Index was out of range. Must be
non-negative and less than the size of the collection. Parameter name:
chunkLength at System.Text.StringBuilder.ToString() at
Microsoft.Azure.WebJobs.Host.Bindings.*TextWriterTraceAdapter*.Write(Char
value) at System.IO.TextWriter.Write(Char[] buffer, Int32 index, Int32
count) at System.IO.TextWriter.WriteLine(String value) at
WebJob.Functions.<>c__DisplayClass0_2.<ProcessQueueMessage>b__0() at
System.Threading.Tasks.Task.InnerInvoke() at
System.Threading.Tasks.Task.Execute() --- End of stack trace from previous
location where exception was thrown --- at
System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task
task) at WebJob.Functions.<ProcessQueueMessage>d__0.MoveNext() --- End of
stack trace from previous location where exception was thrown --- at
System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task
task) at
Microsoft.Azure.WebJobs.Host.Executors.FunctionInvoker`1.<InvokeAsync>d__0.MoveNext()
--- End of stack trace from previous location where exception was thrown
--- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task
task) at
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task
task) at
Microsoft.Azure.WebJobs.Host.Executors.FunctionExecutor.<ExecuteWithWatchersAsync>d__31.MoveNext()
--- End of stack trace from previous location where exception was thrown
--- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task
task) at
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task
task) at
Microsoft.Azure.WebJobs.Host.Executors.FunctionExecutor.<ExecuteWithLoggingAsync>d__2c.MoveNext()
--- End of stack trace from previous location where exception was thrown
--- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task
task) at
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task
task) at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)
at
Microsoft.Azure.WebJobs.Host.Executors.FunctionExecutor.<ExecuteWithLoggingAsync>d__13.MoveNext()
--- End of inner exception stack trace --- at
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at
Microsoft.Azure.WebJobs.Host.Executors.FunctionExecutor.<ExecuteWithLoggingAsync>d__13.MoveNext()
--- End of stack trace from previous location where exception was thrown
--- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task
task) at
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task
task) at
Microsoft.Azure.WebJobs.Host.Executors.FunctionExecutor.<TryExecuteAsync>d__1.MoveNext()
…On Mon, Mar 6, 2017 at 3:47 PM, Brett Samblanet ***@***.***> wrote:
Thanks for filing this -- I want to focus on the TraceWriter issue you're
seeing because:
- #675 <#675> isn't
related to this. The message is similar, but this was some internal blob
logging that we were doing, and your stack doesn't match with that code.
- #982 <#982> is
already known -- there is an issue with TextWriter that is not yet fixed.
That explains your TextWriter error (and the stack you have included).
I suspect that you have a different stack when using TraceWriter -- the
stack you've included has TextWriterTraceAdapter in it, which only
happens if you log with the TextWriter. Would you mind retrying this with
TraceWriter and paste that error stack into here? I've taken your code and
run it in a WebJob and it worked as expected.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#1042 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AZAn519leWYRiv3-LWUfUccV6xziqKVqks5rjBxwgaJpZM4MUK7u>
.
|
I still see That being said, I still can't seem to repro this even with TextWriter. If I can do that, it means I've set things up correctly, so I'd like to focus on that first. A couple more questions that may help me set this up:
|
On Mon, Mar 6, 2017 at 6:13 PM, Brett Samblanet ***@***.***> wrote:
I still see TextWriterTraceAdapter in that stack, so something doesn't
look right. Is this for the version that uses TraceWriter?
To be sure Iv'e deleted the WebJob and publish it again. Here is my
callstack
*Microsoft.Azure.WebJobs.Host.FunctionInvocationException*:
Microsoft.Azure.WebJobs.Host.FunctionInvocationException: Exception while
executing function: Functions.ProcessQueueMessage --->
System.ArgumentOutOfRangeException: Index was out of range. Must be
non-negative and less than the size of the collection. Parameter name:
chunkLength at System.Text.StringBuilder.ToString() at
Microsoft.Azure.WebJobs.Host.Bindings.TextWriterTraceAdapter.Write(Char
value) at System.IO.TextWriter.Write(Char[] buffer, Int32 index, Int32
count) at System.IO.TextWriter.WriteLine(String value) at
WebJob.Functions.<>c__DisplayClass0_2.<ProcessQueueMessage>b__0() at
System.Threading.Tasks.Task.InnerInvoke() at
System.Threading.Tasks.Task.Execute() --- End of stack trace from previous
location where exception was thrown --- at
System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task
task) at WebJob.Functions.<ProcessQueueMessage>d__0.MoveNext() --- End of
stack trace from previous location where exception was thrown --- at
System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task
task) at
Microsoft.Azure.WebJobs.Host.Executors.FunctionInvoker`1.<InvokeAsync>d__0.MoveNext()
--- End of stack trace from previous location where exception was thrown
--- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task
task) at
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task
task) at
Microsoft.Azure.WebJobs.Host.Executors.FunctionExecutor.<ExecuteWithWatchersAsync>d__31.MoveNext()
--- End of stack trace from previous location where exception was thrown
--- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task
task) at
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task
task) at
Microsoft.Azure.WebJobs.Host.Executors.FunctionExecutor.<ExecuteWithLoggingAsync>d__2c.MoveNext()
--- End of stack trace from previous location where exception was thrown
--- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task
task) at
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task
task) at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)
at
Microsoft.Azure.WebJobs.Host.Executors.FunctionExecutor.<ExecuteWithLoggingAsync>d__13.MoveNext()
--- End of inner exception stack trace --- at
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at
Microsoft.Azure.WebJobs.Host.Executors.FunctionExecutor.<ExecuteWithLoggingAsync>d__13.MoveNext()
--- End of stack trace from previous location where exception was thrown
--- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task
task) at
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task
task) at
Microsoft.Azure.WebJobs.Host.Executors.FunctionExecutor.<TryExecuteAsync>d__1.MoveNext()
That being said, I still can't seem to repro this even with TextWriter. If
I can do that, it means I've set things up correctly, so I'd like to focus
on that first.
A couple more questions that may help me set this up:
1. You are running this manually via the Dashboard, right? Does it
happen with a single function run? Or do you need to run a bunch of them?
It does not fail every time. Many attempt may be required. Most of the
time it happen when a call manually my function many time, in parallel.
…
1. Where do you find this exception trace? In the output for the
function in the dashboard?
Yes, Azure Webjobs Dashboard said my browser.
1. Just to double-check: you are running on an S1 instance?
Yes
|
You're right, there is something wrong somewhere; I've changed the text in
my log and I still have the old one.
On Mon, Mar 6, 2017 at 6:44 PM, Emmanuel Engel <emmanuel.engel@netgem.com>
wrote:
…
On Mon, Mar 6, 2017 at 6:13 PM, Brett Samblanet ***@***.***>
wrote:
> I still see TextWriterTraceAdapter in that stack, so something doesn't
> look right. Is this for the version that uses TraceWriter?
>
To be sure Iv'e deleted the WebJob and publish it again. Here is my
callstack
*Microsoft.Azure.WebJobs.Host.FunctionInvocationException*:
Microsoft.Azure.WebJobs.Host.FunctionInvocationException: Exception while
executing function: Functions.ProcessQueueMessage ---> System.ArgumentOutOfRangeException:
Index was out of range. Must be non-negative and less than the size of the
collection. Parameter name: chunkLength at System.Text.StringBuilder.ToString()
at Microsoft.Azure.WebJobs.Host.Bindings.TextWriterTraceAdapter.Write(Char
value) at System.IO.TextWriter.Write(Char[] buffer, Int32 index, Int32
count) at System.IO.TextWriter.WriteLine(String value) at
WebJob.Functions.<>c__DisplayClass0_2.<ProcessQueueMessage>b__0() at
System.Threading.Tasks.Task.InnerInvoke() at System.Threading.Tasks.Task.Execute()
--- End of stack trace from previous location where exception was thrown
--- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task
task) at System.Runtime.CompilerServices.TaskAwaiter.
HandleNonSuccessAndDebuggerNotification(Task task) at WebJob.Functions.<
ProcessQueueMessage>d__0.MoveNext() --- End of stack trace from previous
location where exception was thrown --- at System.Runtime.
CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task
task) at Microsoft.Azure.WebJobs.Host.Executors.FunctionInvoker`1.<InvokeAsync>d__0.MoveNext()
--- End of stack trace from previous location where exception was thrown
--- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task
task) at System.Runtime.CompilerServices.TaskAwaiter.
HandleNonSuccessAndDebuggerNotification(Task task) at
Microsoft.Azure.WebJobs.Host.Executors.FunctionExecutor.<
ExecuteWithWatchersAsync>d__31.MoveNext() --- End of stack trace from
previous location where exception was thrown --- at System.Runtime.
CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task
task) at Microsoft.Azure.WebJobs.Host.Executors.FunctionExecutor.<
ExecuteWithLoggingAsync>d__2c.MoveNext() --- End of stack trace from
previous location where exception was thrown --- at System.Runtime.
CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task
task) at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task
task) at Microsoft.Azure.WebJobs.Host.Executors.FunctionExecutor.<
ExecuteWithLoggingAsync>d__13.MoveNext() --- End of inner exception stack
trace --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at Microsoft.Azure.WebJobs.Host.Executors.FunctionExecutor.<
ExecuteWithLoggingAsync>d__13.MoveNext() --- End of stack trace from
previous location where exception was thrown --- at System.Runtime.
CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task
task) at Microsoft.Azure.WebJobs.Host.Executors.FunctionExecutor.<
TryExecuteAsync>d__1.MoveNext()
> That being said, I still can't seem to repro this even with TextWriter.
> If I can do that, it means I've set things up correctly, so I'd like to
> focus on that first.
>
> A couple more questions that may help me set this up:
>
> 1. You are running this manually via the Dashboard, right? Does it
> happen with a single function run? Or do you need to run a bunch of them?
>
> It does not fail every time. Many attempt may be required. Most of the
time it happen when a call manually my function many time, in parallel.
>
> 1. Where do you find this exception trace? In the output for the
> function in the dashboard?
>
> Yes, Azure Webjobs Dashboard said my browser.
>
> 1. Just to double-check: you are running on an S1 instance?
>
> Yes
|
This can be closed now, right? Perhaps we can get @EmmanuelEngel to try the patched version and verify the fix. |
Yes, this fixes #982 as well. |
@EmmanuelEngel -- I've updated our myget feed with this latest package if you'd like to try it out. TextWriter should now work. You can find info on getting our latest builds here: https://github.com/Azure/azure-webjobs-sdk/wiki/%22Nightly%22-Builds |
Ok I'll test it and let you know the result. Unfortunately, I can't do it
today.
…On Tue, Mar 7, 2017 at 4:24 PM, Brett Samblanet ***@***.***> wrote:
@EmmanuelEngel <https://github.com/EmmanuelEngel> -- I've updated our
myget feed with this latest package if you'd like to try it out. TextWriter
should now work.
You can find info on getting our latest builds here:
https://github.com/Azure/azure-webjobs-sdk/wiki/%22Nightly%22-Builds
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#1042 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AZAn591ke_WqKv22KpgFqX5mvGm0r8HLks5rjXaVgaJpZM4MUK7u>
.
|
Thanks - if things look good, we'll try to get a 2.0.1 release with this out quickly. |
Simple webjob that use provided logger crash. Exception is not catchable.
Repro steps
Provide the steps required to reproduce the problem
using System.Collections.Generic;
using System.IO;
using System.Threading.Tasks;
using System.Threading;
using Microsoft.Azure.WebJobs;
using System;
using Microsoft.Azure.WebJobs.Host;
namespace WebJob
{
public class Functions
{
// This function will get triggered/executed when a new message is written
// on an Azure Queue called queue.
}
Deploy it on a web job and start it
Expected behavior
No crash
Actual behavior
Crash:
Microsoft.Azure.WebJobs.Host.FunctionInvocationException: Microsoft.Azure.WebJobs.Host.FunctionInvocationException: Exception while executing function: Functions.ProcessQueueMessage ---> System.IndexOutOfRangeException: Index was outside the bounds of the array. at System.Text.StringBuilder.get_Chars(Int32 index) at Microsoft.Azure.WebJobs.Host.Bindings.TextWriterTraceAdapter.Write(Char value) at System.IO.TextWriter.Write(Char[] buffer, Int32 index, Int32 count) at System.IO.TextWriter.WriteLine(String value) at WebJob.Functions.<>c__DisplayClass0_2.b__0() at System.Threading.Tasks.Task.InnerInvoke() at System.Threading.Tasks.Task.Execute() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at WebJob.Functions.d__0.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.Azure.WebJobs.Host.Executors.FunctionInvoker`1.d__0.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.Azure.WebJobs.Host.Executors.FunctionExecutor.d__31.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.Azure.WebJobs.Host.Executors.FunctionExecutor.d__2c.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task) at Microsoft.Azure.WebJobs.Host.Executors.FunctionExecutor.d__13.MoveNext() --- End of inner exception stack trace --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at Microsoft.Azure.WebJobs.Host.Executors.FunctionExecutor.d__13.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.Azure.WebJobs.Host.Executors.FunctionExecutor.d__1.MoveNext()
Known workarounds
None if you want to use WebJob logger (and kudu)
Related information
Look like #675. Definitely NOT closed.
Microsoft.Azure.WebJobs.Core :2.0.0
Newtonsoft.Json : 9.0.1
WindowsAzure.Storage: 8.1.1
Seen below
The text was updated successfully, but these errors were encountered: