Skip to content

Commit

Permalink
Fix segfault with describe_topics and flaky connection (#1692)
Browse files Browse the repository at this point in the history
If you call describe_topics on a flaky connection, sometimes the
admin client reply has the host set to a null pointer. When this
occurs, instead of segfaulting, report the host as None.
  • Loading branch information
lpsinger authored May 7, 2024
1 parent 6cbe8b8 commit 5c4a652
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/confluent_kafka/src/confluent_kafka.c
Original file line number Diff line number Diff line change
Expand Up @@ -1620,7 +1620,10 @@ PyObject *c_Node_to_py(const rd_kafka_Node_t *c_node) {

cfl_PyDict_SetInt(kwargs, "id", rd_kafka_Node_id(c_node));
cfl_PyDict_SetInt(kwargs, "port", rd_kafka_Node_port(c_node));
cfl_PyDict_SetString(kwargs, "host", rd_kafka_Node_host(c_node));
if (rd_kafka_Node_host(c_node))
cfl_PyDict_SetString(kwargs, "host", rd_kafka_Node_host(c_node));
else
PyDict_SetItemString(kwargs, "host", Py_None);
if((rack = rd_kafka_Node_rack(c_node)))
cfl_PyDict_SetString(kwargs, "rack", rack);

Expand Down

0 comments on commit 5c4a652

Please sign in to comment.