You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
#0 0x7fc596191db0 in strdup (/lib64/libasan.so.5+0x3bdb0)
#1 0x7fc59080c4ee in rd_strdup /home/mgalanin/php-build/librdkafka-2.0.2/src/rd.h:156
#2 0x7fc59080fe06 in rd_kafka_anyconf_set_prop0 /home/mgalanin/php-build/librdkafka-2.0.2/src/rdkafka_conf.c:1725
#3 0x7fc59081237f in rd_kafka_defaultconf_set /home/mgalanin/php-build/librdkafka-2.0.2/src/rdkafka_conf.c:2171
#4 0x7fc59081248e in rd_kafka_topic_conf_new /home/mgalanin/php-build/librdkafka-2.0.2/src/rdkafka_conf.c:2191
#5 0x7fc590802a93 in rd_kafka_topic_new0 /home/mgalanin/php-build/librdkafka-2.0.2/src/rdkafka_topic.c:303
#6 0x7fc590804450 in rd_kafka_topic_new /home/mgalanin/php-build/librdkafka-2.0.2/src/rdkafka_topic.c:510
#7 0x7fc590ff2da7 in zim_RdKafka_KafkaConsumer_newTopic /home/mgalanin/php-build/github.com-tony2001-php-rdkafka/kafka_consumer.c:561
#8 0xd3438d in ZEND_DO_FCALL_SPEC_RETVAL_USED_HANDLER /home/mgalanin/php-build/php-sources/Zend/zend_vm_execute.h:1863
#9 0xe7687e in execute_ex /home/mgalanin/php-build/php-sources/Zend/zend_vm_execute.h:55195
#10 0xe83e40 in zend_execute /home/mgalanin/php-build/php-sources/Zend/zend_vm_execute.h:59523
#11 0xca0a4d in zend_execute_scripts /home/mgalanin/php-build/php-sources/Zend/zend.c:1826
#12 0xb309dc in php_execute_script /home/mgalanin/php-build/php-sources/main/main.c:2568
#13 0xf1b6ff in do_cli /home/mgalanin/php-build/php-sources/sapi/cli/php_cli.c:949
#14 0xf1d9dc in main /home/mgalanin/php-build/php-sources/sapi/cli/php_cli.c:1341
#15 0x7fc594c90d84 in __libc_start_main (/lib64/libc.so.6+0x3ad84)
From what I can see, PHP_METHOD(RdKafka_KafkaConsumer, newTopic) calls rd_kafka_topic_new() but the result is never gets freed as kafka_topic_free() only considers that it can be referred from a kafka_object
I was able to fix the problem like this:
diff --git a/topic.c b/topic.c
index f1c0f7f..08b20d2 100644
--- a/topic.c
+++ b/topic.c
@@ -57,6 +57,9 @@ static void kafka_topic_free(zend_object *object) /* {{{ */
if (kafka_intern) {
zend_hash_index_del(&kafka_intern->topics, (zend_ulong)intern);
}
+ } else if (intern->rkt) {
+ // the class created via KafkaConsumer::newTopic()
+ rd_kafka_topic_destroy(intern->rkt);
}
zend_object_std_dtor(&intern->std);
but not sure if it's the right way
php-rdkafka Version
6.0.3 (latest revision from "6.x" branch)
librdkafka Version
2.0.2
PHP Version
8.0.28
Operating System
No response
Kafka Version
No response
The text was updated successfully, but these errors were encountered:
Description
The following code:
When built with ASAN and run like this:
Resulted in this output:
From what I can see,
PHP_METHOD(RdKafka_KafkaConsumer, newTopic)
callsrd_kafka_topic_new()
but the result is never gets freed askafka_topic_free()
only considers that it can be referred from akafka_object
I was able to fix the problem like this:
but not sure if it's the right way
php-rdkafka Version
6.0.3 (latest revision from "6.x" branch)
librdkafka Version
2.0.2
PHP Version
8.0.28
Operating System
No response
Kafka Version
No response
The text was updated successfully, but these errors were encountered: