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
A segmentation fault sporadically occurs at the end of a PHP process that creates many KafkaConsumer instances. The consumers are usually closed manually by calling the close method.
We only noticed this bug when running our PHPUnit test cases on the official PHP docker image php:8.3.14 (Debian-based), while the Alpine version php:8.3.14-alpine doesn't manifest this bug. Our test cases create many KafkaConsumer instances, and the segmentation fault occurs only at the end of the running PHP process.
I believe the problem lies in the PHP_METHOD(RdKafka_KafkaConsumer, close) function that sets the intern->rk = NULL but doesn't call rd_kafka_destroy. Then, in kafka_consumer_free, the rd_kafka_destroy call is skipped because intern->rk is already NULL.
The fix from @ikeberlein's PR #540 resolves this problem for me. After applying the patch, I no longer see segmentation faults.
Description
A segmentation fault sporadically occurs at the end of a PHP process that creates many
KafkaConsumer
instances. The consumers are usually closed manually by calling theclose
method.We only noticed this bug when running our PHPUnit test cases on the official PHP docker image
php:8.3.14
(Debian-based), while the Alpine versionphp:8.3.14-alpine
doesn't manifest this bug. Our test cases create manyKafkaConsumer
instances, and the segmentation fault occurs only at the end of the running PHP process.I believe the problem lies in the
PHP_METHOD(RdKafka_KafkaConsumer, close)
function that sets theintern->rk = NULL
but doesn't callrd_kafka_destroy
. Then, inkafka_consumer_free
, therd_kafka_destroy
call is skipped becauseintern->rk
is alreadyNULL
.The fix from @ikeberlein's PR #540 resolves this problem for me. After applying the patch, I no longer see segmentation faults.
Here's the reproducer code:
Resulted in this output with a segmentation fault:
But I expected this output instead without segmentation fault:
php-rdkafka Version
php-rdkafka 6.0.3-6.0.5
librdkafka Version
librdkafka 2.0.2-2.6.1
PHP Version
PHP 8.3.14
Operating System
No response
Kafka Version
No response
The text was updated successfully, but these errors were encountered: