Azure/azure-functions-rabbitmq-extension

RabbitMQ connections not closing

Icidis opened this issue · 5 comments

Good day,

I currently have an Azure Function running on a dedicated Azure App Service Plan using this extension along with a blob trigger as shown below.

NuGet Package

<PackageReference Include="Microsoft.Azure.WebJobs.Extensions.RabbitMQ" Version="1.0.0" />

Function

[FunctionName("DirectoryTrigger")]
        public void Run(
            [BlobTrigger("myfiles/{name}", Connection = "AzureWebJobsStorage")] Stream myBlob,
            string name, 
            [RabbitMQ(QueueName = "Queue1", ConnectionStringSetting = "RabbitMQ")] ICollector<string> rabbitData,
            [Queue("queue1fileprocessed", Connection = "AzureWebJobsStorage")] out string processed,
            ILogger log)

The azure function runs, publishes the message(s) but when looking at the process explorer and RabbitMQ management console I see the connections are still open after execution has completed.

I've looked at the project and see the IModel is closed but never the IConnection.

Quote from RabbitMQ documentation:

channel.Close();
conn.Close();

Disposing channel and connection objects is not enough, they must be explicitly closed with the API methods from the example above.

This is the current problem I'm facing, if you have any thoughts or need more information please let me know.

image

image

We are seeing this same issue. Any updates on addressing this? I see the open PR, but not many comments recently.

Apologies for not looking on the issue and PR earlier. I am using build from latest RabbitMQ source, but unable to reproduce the issue. Here's my function (not an Azure Function) that uses output binding similar to the one mentioned in issue descriptions.

public static void TestFunction(
    [TimerTrigger("00:00:10")] TimerInfo timer,
    [RabbitMQ(QueueName = "queue")] ICollector<string> data,
    ILogger logger)
{
    data.Add(timer.Schedule.ToString());
}

After running for 5 minutes, I am still seeing just 1 connection on RabbitMQ management page.

This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment.

Hi @JatinSanghvi,

You test case you mentioned above does not test the issue, the Azure Function is linked to a directory trigger and because there are so many events happening x amount of azure functions run in parallel to fulfill the triggered events. We have noticed that the connections never close.

We have been running our modified version now for months and haven't seen any issues.

Happy to try the latest dev branch and see if it's still happening

Thanks, I will try reproducing the issue by invoking several triggers simultaneously. I should add an update here and reopen #158 accordingly in beginning of next week.