Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork1.3k
Open
Description
- What problem did you encounter?
When using the longlang/phpkafka library, we intermittently encounter the following error:longlang\phpkafka\Exception\KafkaErrorException: [-1] The server experienced an unexpected error when processing the request.
This happens sporadically during regular Kafka consumption, causing interruptions in our consumer application.
The problem only occurs in version 2.3.0 of kafka
Is the Kafka environment self-built or cloud service?
Self-built.Please execute the following command to get environment information.
php -v & php --ri swoole & composer info | grep longlang/phpkafka
PHP 8.3.14 (cli) (built: Nov 21 2024 08:44:42) (NTS)Copyright (c) The PHP GroupZend Engine v4.3.14, Copyright (c) Zend Technologies with Zend OPcache v8.3.14, Copyright (c), by Zend TechnologiesswooleSwoole => enabledAuthor => Swoole Team <team@swoole.com>Version => 6.0.2Built => Apr 25 2025 10:17:40coroutine => enabled with boost asm contextepoll => enabledeventfd => enabledsignalfd => enabledcpu_affinity => enabledspinlock => enabledrwlock => enabledopenssl => OpenSSL 3.1.8 11 Feb 2025dtls => enabledhttp2 => enabledjson => enabledcurl-native => enabledcurl-version => 8.12.1c-ares => 1.27.0zlib => 1.3.1brotli => E16781312/D16781312mutex_timedlock => enabledpthread_barrier => enabledcoroutine_pgsql => enabledcoroutine_odbc => enabledcoroutine_sqlite => enabledDirective => Local Value => Master Valueswoole.enable_library => On => Onswoole.enable_fiber_mock => Off => Offswoole.enable_preemptive_scheduler => Off => Offswoole.display_errors => On => Onswoole.use_shortname => Off => Offswoole.unixsock_buffer_size => 8388608 => 8388608longlang/phpkafka 1.2.5 A kafka client. Support php-fpm and Swoole.- Provide the smallest reproducible code:
<?phprequire_once__DIR__ .'/vendor/autoload.php';uselonglang\phpkafka\Consumer\Consumer;uselonglang\phpkafka\Consumer\ConsumerConfig;$config =newConsumerConfig();$config->setBroker('localhost:9092');$config->setTopic('topic_name');$config->setGroupId('grupo_id');$config->setGroupInstanceId('group_instance_id');$consumer =newConsumer($config);while (true) {$message =$consumer->consume();if ($message) {// Processing message logic }}
The solution is to allow sending group_instance_id as null in the GroupManager.php class on lines 99 and 114
swoole/phpkafka#105