Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Heap memory contains 6.3 million of string objects like this: amq.ctag-QyDNazNXZdatTGscA8QWrw#1797

Unanswered
gabrieltarpian25 asked this question inQ&A
Discussion options

Describe the bug

Hello, everyone. I have multiple microservices that communicates each other with RabbitMQ. I have discovered that my application is having high memory usage that keeps growing. I have analyzed its dump and I found that, on the heap memory, I have 437 MB used by around 6.3 million of string objects like this:amq.ctag-QyDNazNXZdatTGscA8QWrw

This is the consumer tag. I am not storing it on the heap, it's just within the local scope in a string variable, so I am pretty sure the Garbage Collector will dispose it. I am creating a consumer for each RPC request, like this:

var consumer = new AsyncEventingBasicConsumer(channelFromMessage);consumer.ReceivedAsync += Consumer_ReceivedAsync;

And cancel it like this:

await rpcPublishChannel.BasicCancelAsync(consumerTag, cancellationToken: cts.Token);consumer.ReceivedAsync -= null;

From my research, it seems the consumer was disposed but not its handler and that's why its tag stays in the memory. Could you please confirm that is the case? Also, should I replace

consumer.ReceivedAsync -= null;

with

consumer.ReceivedAsync -= Consumer_ReceivedAsync;

Thank you!

You must be logged in to vote

Replies: 2 comments

Comment options

This repository is about the server side, so RabbitMQ as a broker.
I think you have an issue with an AMQP client but you did not specify which client or which programming language you use.
Please submit this (probably as a discussion) in the repo of the AMQP client that you use.

You must be logged in to vote
0 replies
Comment options

@gabrieltarpian25 - I've moved this issue to the correct repository.

You are missing basic information in your issue report:

  • Version of RabbitMQ and Erlang being used.
  • The version ofRabbitMQ.Client you're using.
  • Complete code to reproduce the issue. I should be able to clone, build, and run it.

Once you provide the above, I can assist you.

Other notes:

consumer.ReceivedAsync -= Consumer_ReceivedAsync;

Yes, that is the correct way to remove an event handler in C#.

From my research, it seems the consumer was disposed but not its handler and that's why its tag stays in the memory. Could you please confirm that is the case?

How am I supposed to confirm this without seeing how you use this library? After a quick review I can't see where this library would hold on to a consumer tag for a long period of time inConsumerDispatcherBase.

You must be logged in to vote
0 replies
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Category
Q&A
Labels
None yet
3 participants
@gabrieltarpian25@lukebakken@gomoripeti
Converted from issue

This discussion was converted from issue #1797 on February 26, 2025 15:11.


[8]ページ先頭

©2009-2025 Movatter.jp