Skip to content

Memory leak when using KafkaEx.stream #141

@dplummer

Description

@dplummer

I mentioned on slack:

I’ve written an app (https://github.com/avvo/kafkamon) that consumes kafka using KafkaEx. I seem to have a memory leak using KafkaEx.stream (https://github.com/avvo/kafkamon/blob/master/lib/reader/event_queue/consumer.ex#L25). Has anyone used that api and seen a similar issue?

And @dantswain suggested I create an issue after reproducing it with a minimal app. I built KafkaConsumerTest and was able to reproduce the behavior I saw reliably. The README in the project outlines how to run the consumer and producer.

I reproduced this with:

Erlang/OTP 19 [erts-8.0.2] [source] [64-bit] [smp:8:8] [async-threads:10] [hipe] [kernel-poll:false] [dtrace]

Elixir 1.3.2

And both v0.5.0 and github master of KafkaEx. My example producer creates a random binary, but the same behavior is observed for a string.

Observed behavior on my MacBook Pro

Ran the producer twice and captured the memory and process graphs from the observer. Memory did not decrease after 5 minutes of no activity, except in Elixir.KafkaEx.Server, which did decrease to ~143k (from 264k).

memory_usage
process_list

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions