Skip to content
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

RabbitMQTrigger throwing AlreadyClosedException #226

Open
arthur-conde opened this issue Apr 17, 2023 · 1 comment
Open

RabbitMQTrigger throwing AlreadyClosedException #226

arthur-conde opened this issue Apr 17, 2023 · 1 comment

Comments

@arthur-conde
Copy link

We have a few functions running inside an isolated .NET 6 function app on the v4 runtime, all triggered by listening to messages from RabbitMQ.

After upgrading to the most recent version of the extension, we have started seeing AlreadyClosedException thrown from the extension.

RabbitMQ.Client.Exceptions.AlreadyClosedException:
   at RabbitMQ.Client.Impl.SessionBase.Transmit (RabbitMQ.Client, Version=6.0.0.0, Culture=neutral, PublicKeyToken=89e7d7c5feba84ce)
   at RabbitMQ.Client.Framing.Impl.Model._Private_QueueDeclare (RabbitMQ.Client, Version=6.0.0.0, Culture=neutral, PublicKeyToken=89e7d7c5feba84ce)
   at RabbitMQ.Client.Impl.ModelBase.QueueDeclare (RabbitMQ.Client, Version=6.0.0.0, Culture=neutral, PublicKeyToken=89e7d7c5feba84ce)
   at RabbitMQ.Client.Impl.AutorecoveringModel.QueueDeclarePassive (RabbitMQ.Client, Version=6.0.0.0, Culture=neutral, PublicKeyToken=89e7d7c5feba84ce)
   at Microsoft.Azure.WebJobs.Extensions.RabbitMQ.RabbitMQModel.QueueDeclarePassive (Microsoft.Azure.WebJobs.Extensions.RabbitMQ, Version=2.0.3.0, Culture=neutral, PublicKeyToken=null: /_/extension/WebJobs.Extensions.RabbitMQ/Trigger/RabbitMQModel.cs:26)
   at Microsoft.Azure.WebJobs.Extensions.RabbitMQ.RabbitMQListener.GetMetricsAsync (Microsoft.Azure.WebJobs.Extensions.RabbitMQ, Version=2.0.3.0, Culture=neutral, PublicKeyToken=null: /_/extension/WebJobs.Extensions.RabbitMQ/Trigger/RabbitMQListener.cs:156)
   at Microsoft.Azure.WebJobs.Extensions.RabbitMQ.RabbitMQListener+<Microsoft-Azure-WebJobs-Host-Scale-IScaleMonitor-GetMetricsAsync>d__21.MoveNext (Microsoft.Azure.WebJobs.Extensions.RabbitMQ, Version=2.0.3.0, Culture=neutral, PublicKeyToken=null)
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw (System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e)
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e)
   at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult (System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e)
   at Microsoft.Azure.WebJobs.Script.Scale.FunctionsScaleMonitorService+<TakeMetricsSamplesAsync>d__13.MoveNext (Microsoft.Azure.WebJobs.Script, Version=4.17.0.0, Culture=neutral, PublicKeyToken=null: /_/src/WebJobs.Script/Scale/FunctionsScaleMonitorService.cs:95)

I'm not sure what is causing this to occur. Each function uses three queues: a queue the function is bound to, a retry queue that uses expire and dead letter set to the first, and a dead letter queue that stores messages that failed to process.

An example of such a function follows:

[Function("Webhooks")]
public async Task WebhookFunctionAsync([RabbitMQTrigger("%Queues:Webhook%", ConnectionStringSetting = "Queues:Uri")] string message, FunctionContext context)
{
   // Work done here
}

How do I prevent this exception from getting thrown?

@stefkarg
Copy link

Same problem here. Did you find a solution?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants