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

RabbitMQ connections not closing #157

Open
Icidis opened this issue Mar 13, 2021 · 5 comments · May be fixed by #158
Open

RabbitMQ connections not closing #157

Icidis opened this issue Mar 13, 2021 · 5 comments · May be fixed by #158

Comments

@Icidis
Copy link

Icidis commented Mar 13, 2021

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

@Icidis Icidis linked a pull request Mar 15, 2021 that will close this issue
@sherzberg
Copy link

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

@JatinSanghvi
Copy link
Contributor

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.

@ghost
Copy link

ghost commented Feb 5, 2022

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.

@ghost ghost closed this as completed Feb 8, 2022
@Icidis
Copy link
Author

Icidis commented Feb 16, 2022

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

@JatinSanghvi
Copy link
Contributor

JatinSanghvi commented Feb 17, 2022

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.

@JatinSanghvi JatinSanghvi reopened this Feb 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants