Disable system.kafka_consumers by default (due to possible live memory leak)#57822
Conversation
…y leak) It is not safe to use statistics because of how KafkaEngine works - it pre-creates consumers, and this leads to the situation when this statistics entries generated (RD_KAFKA_OP_STATS), but never consumed. Which creates a live memory leak for a server with Kafka tables, but without materialized view attached to it (and no SELECT). Another problem is that this makes shutdown very slow, because of how pending queue entries are handled in librdkafka, it uses TAILQ_INSERT_SORTED, which is sorted insert into linked list, which works incredibly slow (likely you will never wait till it ends and kill the server) For instance in my production setup the server was running for ~67 days with such table, and it got 1'942'233 `TAILQ_INSERT_SORTED` entries (which perfectly matches by the way - `67*86400/3` = 1'929'600), and it moved only 289'806 entries for a few hours, though I'm not sure how much time the process was in the running state, since most of the time it was with debugger attached. So for now let's disable it, to make this patch easy for backporting, and I will think about long term fix - do not pre-create consumers in Kafka engine. Signed-off-by: Azat Khuzhin <[email protected]>
|
This is an automated comment for commit 055c231 with description of existing statuses. It's updated for the latest CI running ❌ Click here to open a full report in a separate page Successful checks
|
|
Hm ... sorry to hear that it caused so many troubles. |
Here is a fix - #57829 |
|
@azat, it is much better to remove the feature entirely than disabling it. |
@alexey-milovidov I think that this information can be useful, and I've already submitted a proper fix. And also let's backport this patch. |
|
Will this fix be backported to v23.8? |
Disable system.kafka_consumers by default (due to possible live memory leak)
…tem_kafka_consumers_table 23.8 Backport of ClickHouse#57822 - Disable `system.kafka_consumers` by default
|
@alexey-milovidov objections on backporting this patch? |
…ue to possible live memory leak)
…ue to possible live memory leak)
…due to possible live memory leak)
…due to possible live memory leak)
Backport #57822 to 23.8: Disable system.kafka_consumers by default (due to possible live memory leak)
Backport #57822 to 23.9: Disable system.kafka_consumers by default (due to possible live memory leak)
Backport #57822 to 23.10: Disable system.kafka_consumers by default (due to possible live memory leak)
Backport #57822 to 23.11: Disable system.kafka_consumers by default (due to possible live memory leak)
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes to CHANGELOG.md):
Disable system.kafka_consumers by default (due to possible live memory leak)
It is not safe to use statistics because of how KafkaEngine works - it pre-creates consumers, and this leads to the situation when this statistics entries generated (RD_KAFKA_OP_STATS), but never consumed.
Which creates a live memory leak for a server with Kafka tables, but without materialized view attached to it (and no SELECT).
Another problem is that this makes shutdown very slow, because of how pending queue entries are handled in librdkafka, it uses TAILQ_INSERT_SORTED, which is sorted insert into linked list, which works incredibly slow (likely you will never wait till it ends and kill the server)
For instance in my production setup the server was running for ~67 days with such table, and it got 1'942'233
TAILQ_INSERT_SORTEDentries (which perfectly matches by the way -67*86400/3= 1'929'600), and it moved only 289'806 entries for a few hours, though I'm not sure how much time the process was in the running state, since most of the time it was with debugger attached.So for now let's disable it, to make this patch easy for backporting, and I will think about long term fix - do not pre-create consumers in Kafka engine.
Fixes: #50999 (cc @ilejn)