.NET Confluent Kafka consumer memory leak
up vote
2
down vote
favorite
We're seeing huge memory leaks when consuming from Kafka using the Confluent Kafka .NET library.
One thing I've noticed is the code consumes without a using statement:
while (true)
{
if (_consumer.Consume(out Message<string, string> message, TimeSpan.FromMilliseconds(100)))
{
OnMessage(message);
}
}
However, that while loop runs for the lifetime for the application, so .Dispose() would never be called whilst consuming anyway. No other consumer instances are created.
As the code behind the library is in C, will objects created by the library be cleaned if we call GC.Collect(), or is this unmanaged code which the garbage collector has no control over?
Anything else which might be causing the leak, does consumer.Close() need to be called at certain periods or something like that?
c# .net apache-kafka confluent-kafka
add a comment |
up vote
2
down vote
favorite
We're seeing huge memory leaks when consuming from Kafka using the Confluent Kafka .NET library.
One thing I've noticed is the code consumes without a using statement:
while (true)
{
if (_consumer.Consume(out Message<string, string> message, TimeSpan.FromMilliseconds(100)))
{
OnMessage(message);
}
}
However, that while loop runs for the lifetime for the application, so .Dispose() would never be called whilst consuming anyway. No other consumer instances are created.
As the code behind the library is in C, will objects created by the library be cleaned if we call GC.Collect(), or is this unmanaged code which the garbage collector has no control over?
Anything else which might be causing the leak, does consumer.Close() need to be called at certain periods or something like that?
c# .net apache-kafka confluent-kafka
You're right, no need to call to.Dispose
, generally you would want to call.Dispose
or.Close
to notify the server that the consumer is no longer available, but it has nothing to do with memory management, at least not during the runtime of the application. How long did you let the application run? maybe the GC just hasn't kicked in yet.. Try to use a workstation GC and maybe run a profiler.
– areller
Nov 19 at 14:32
add a comment |
up vote
2
down vote
favorite
up vote
2
down vote
favorite
We're seeing huge memory leaks when consuming from Kafka using the Confluent Kafka .NET library.
One thing I've noticed is the code consumes without a using statement:
while (true)
{
if (_consumer.Consume(out Message<string, string> message, TimeSpan.FromMilliseconds(100)))
{
OnMessage(message);
}
}
However, that while loop runs for the lifetime for the application, so .Dispose() would never be called whilst consuming anyway. No other consumer instances are created.
As the code behind the library is in C, will objects created by the library be cleaned if we call GC.Collect(), or is this unmanaged code which the garbage collector has no control over?
Anything else which might be causing the leak, does consumer.Close() need to be called at certain periods or something like that?
c# .net apache-kafka confluent-kafka
We're seeing huge memory leaks when consuming from Kafka using the Confluent Kafka .NET library.
One thing I've noticed is the code consumes without a using statement:
while (true)
{
if (_consumer.Consume(out Message<string, string> message, TimeSpan.FromMilliseconds(100)))
{
OnMessage(message);
}
}
However, that while loop runs for the lifetime for the application, so .Dispose() would never be called whilst consuming anyway. No other consumer instances are created.
As the code behind the library is in C, will objects created by the library be cleaned if we call GC.Collect(), or is this unmanaged code which the garbage collector has no control over?
Anything else which might be causing the leak, does consumer.Close() need to be called at certain periods or something like that?
c# .net apache-kafka confluent-kafka
c# .net apache-kafka confluent-kafka
asked Nov 19 at 14:12
FBryant87
1,77112340
1,77112340
You're right, no need to call to.Dispose
, generally you would want to call.Dispose
or.Close
to notify the server that the consumer is no longer available, but it has nothing to do with memory management, at least not during the runtime of the application. How long did you let the application run? maybe the GC just hasn't kicked in yet.. Try to use a workstation GC and maybe run a profiler.
– areller
Nov 19 at 14:32
add a comment |
You're right, no need to call to.Dispose
, generally you would want to call.Dispose
or.Close
to notify the server that the consumer is no longer available, but it has nothing to do with memory management, at least not during the runtime of the application. How long did you let the application run? maybe the GC just hasn't kicked in yet.. Try to use a workstation GC and maybe run a profiler.
– areller
Nov 19 at 14:32
You're right, no need to call to
.Dispose
, generally you would want to call .Dispose
or .Close
to notify the server that the consumer is no longer available, but it has nothing to do with memory management, at least not during the runtime of the application. How long did you let the application run? maybe the GC just hasn't kicked in yet.. Try to use a workstation GC and maybe run a profiler.– areller
Nov 19 at 14:32
You're right, no need to call to
.Dispose
, generally you would want to call .Dispose
or .Close
to notify the server that the consumer is no longer available, but it has nothing to do with memory management, at least not during the runtime of the application. How long did you let the application run? maybe the GC just hasn't kicked in yet.. Try to use a workstation GC and maybe run a profiler.– areller
Nov 19 at 14:32
add a comment |
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53376475%2fnet-confluent-kafka-consumer-memory-leak%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
You're right, no need to call to
.Dispose
, generally you would want to call.Dispose
or.Close
to notify the server that the consumer is no longer available, but it has nothing to do with memory management, at least not during the runtime of the application. How long did you let the application run? maybe the GC just hasn't kicked in yet.. Try to use a workstation GC and maybe run a profiler.– areller
Nov 19 at 14:32