Skip to content

Fix crash when new topic is not created. - #725

Merged
Magnus Edenhill (edenhill) merged 1 commit into
confluentinc:masterfrom
elektito:master
Nov 26, 2019
Merged

Magnus Edenhill (edenhill) merged 1 commit into
confluentinc:masterfrom
elektito:master

Conversation

@elektito

Copy link
Copy Markdown

I found that the following code caused a crash:


from confluent_kafka.admin import AdminClient
from confluent_kafka.cimpl import NewTopic

client = AdminClient({})
topics = [NewTopic(topic='foo', num_partitions=0)]
client.create_topics(topics)

This pull request, fixes the issue. The problem was that when a topic failed to be created, like in this case where the number of partitions is zero, we would still try to free the topic, causing a null pointer to be de-referenced in rdkafka.

While, this is also a bug in rdkafka, since a null pointer should not be de-referenced either way, we should not pass such a pointer to a library either.

The removed line (`i++;`) caused the most recent topic, which has just
failed to be created, to be passed to rdkafka to be destroyed, causing
a crash.
@ghost

Copy link
Copy Markdown

It looks like Mostafa Razavi (@elektito) hasn't signed our Contributor License Agreement, yet.

The purpose of a CLA is to ensure that the guardian of a project's outputs has the necessary ownership or grants of rights over all contributions to allow them to distribute under the chosen licence.
Wikipedia

You can read and sign our full Contributor License Agreement here.

Once you've signed reply with [clabot:check] to prove it.

Appreciation of efforts,

clabot

@elektito

Copy link
Copy Markdown
Author

[clabot:check]

@ghost

Copy link
Copy Markdown

Confluent Inc. (@confluentinc) It looks like Mostafa Razavi (@elektito) just signed our Contributor License Agreement. 👍

Always at your service,

clabot

@edenhill

Copy link
Copy Markdown
Contributor

Good fix, thank you!

@edenhill
Magnus Edenhill (edenhill) merged commit c20c535 into confluentinc:master Nov 26, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants