none
System.InvalidOperationException: Controller has already started RRS feed

  • Question

  • I have an Azure function that's triggered by an EventHub and has a Table Storage input and (another) EventHub as output. It performs a transformation on streaming data. In about 80-90% of cases the function will complete successfully, but I've noticed an error popup in the Functions portal happening frequently, like so:

    Error:

    Microsoft.ServiceBus.Messaging.EventProcessorHost: Controller has already started.
    Session Id: 58956833bb584d9182a80f52bc07309c

    Timestamp: 2016-08-23T18:45:59.770Z

    With a stack trace like so:

    2016-08-23T18:45:43.632 A ScriptHost error has occurred
    2016-08-23T18:45:43.649 System.InvalidOperationException: Controller has already started
       at Microsoft.ServiceBus.Messaging.PartitionManager`1.<StartAsync>d__14.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.ServiceBus.Messaging.EventProcessorHost.<StartAsync>d__48.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 http://Microsoft.Azure.WebJobs.Host .Listeners.CompositeListener.<StartAsync>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 http://Microsoft.Azure.WebJobs.Host .Listeners.ListenerFactoryListener.<StartAsyncCore>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 http://Microsoft.Azure.WebJobs.Host .Listeners.ShutdownListener.<StartAsync>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 http://Microsoft.Azure .WebJobs.JobHost.<StartAsyncCore>d__2.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 http://Microsoft.Azure .WebJobs.Script.ScriptHostManager.RunAndBlock(CancellationToken cancellationToken)
    2016-08-23T18:45:43.649 Stopping Host

    The function will then restart.

    I'm new to Azure Functions, and have no idea what could be causing this. More experienced insight would be vastly helpful.

    Wednesday, August 24, 2016 1:57 PM

All replies

  • Thanks for reporting. Definitely not expected. I've logged an issue here in our repo for this: https://github.com/Azure/azure-webjobs-sdk/issues/800.

    Please provide more details about your setup by adding them to that issue (provide repro function.json, etc.). Thanks.


    Mathew Charles [MSFT]

    Wednesday, August 24, 2016 5:03 PM
  • Done so! Thanks for looking into this.
    Friday, August 26, 2016 5:47 PM
  • Katy - I'm investigating this (notes are at the issue Mathew filed at https://github.com/Azure/azure-webjobs-sdk/issues/800) . Can you clarify: does this happen during steady state (when you've close the portal, left the function alone, and it's running) or during development  (when you have the portal open and are changing things).

    http://blogs.msdn.com/jmstall

    Monday, August 29, 2016 11:24 PM