Skip to content
This repository has been archived by the owner on Jun 10, 2022. It is now read-only.

Unexpected EOF while reading 4 bytes from stream (no data) #135

Open
thienit5 opened this issue Oct 27, 2017 · 7 comments
Open

Unexpected EOF while reading 4 bytes from stream (no data) #135

thienit5 opened this issue Oct 27, 2017 · 7 comments

Comments

@thienit5
Copy link

$config = \Kafka\ProducerConfig::getInstance();
$config->setMetadataRefreshIntervalMs(10000);
$config->setMetadataBrokerList('host:port');
$config->setRequiredAck(1);
$config->setIsAsyn(false);
$config->setProduceInterval(500);
$config->setBrokerVersion('0.11.0.0');
$producer = new \Kafka\Producer();
$producer->setLogger($logger);

When I run a while I push error: Unexpected EOF while reading 4 bytes from stream (no data)

@nmred
Copy link
Member

nmred commented Nov 15, 2017

@thienit5 you can try set broker version property 0.10.0

$config->setBrokerVersion('0.10.0.0');

@simPod
Copy link
Contributor

simPod commented Jan 30, 2018

That happended to me when I had incorrectly set broker list property.

@shijiajiaga
Copy link

That also happended to me that the error --"Message: Unexpected EOF while reading 4 bytes from stream (no data)" often stop my running php-code work,how to deal with it??

@deesignee
Copy link

deesignee commented Jun 4, 2018

Also have this problem:
Reproduced from time to time without any linear dependency (same query pool can generate error, but with next call everything goes fine).

Used versions:
os debian 9.4
kafka_2.12-1.0.1
openjdk version "1.8.0_162"
PHP 5.6.35
kafka-php: V0.2.0.8

But also reproduced with:
os centos 7
kafka_2.12-1.0.0
jdk1.8.0_151
PHP 5.5.38
kafka-php: V0.2.0.8

As workaround we using 3 times repeat of functions call.

Full error output:
Exception 'Kafka\Exception' with message 'Unexpected EOF while reading 4 bytes from stream (no data)'

in /var/www/XXXPROJECT/vendor/nmred/kafka-php/src/Kafka/SocketSync.php:311

Stack trace:
#0 /var/www/XXXPROJECT/vendor/nmred/kafka-php/src/Kafka/Producer/SyncProcess.php(121): Kafka\SocketSync->read(4)
#1 /var/www/XXXPROJECT/vendor/nmred/kafka-php/src/Kafka/Producer/SyncProcess.php(46): Kafka\Producer\SyncProcess->syncMeta()
#2 /var/www/XXXPROJECT/vendor/nmred/kafka-php/src/Kafka/Producer.php(54): Kafka\Producer\SyncProcess->__construct()
#3 /var/www/XXXPROJECT/src/XXXPROJECT/Services/Kafka/KafkaService.php(23): Kafka\Producer->__construct()
#4 /var/www/XXXPROJECT/models/ew/RegistryShipment.php(565): XXXPROJECTV8\Services\Kafka\KafkaService->__construct()
#5 /var/www/XXXPROJECT/models/ew/RegistryShipment.php(548): app\models\ew\RegistryShipment->setRegistryStateToESB('58', 'c36e6e5875efc01...', '2018-06-01', Array)
#6 /var/www/XXXPROJECT/commands/GearmanSetRegistryStateController.php(46): app\models\ew\RegistryShipment->setRegistryState('11062903')
#7 [internal function]: app\commands\GearmanSetRegistryStateController->setRegistryState(Object(GearmanJob))
#8 /var/www/XXXPROJECT/commands/GearmanSetRegistryStateController.php(23): GearmanWorker->work()
#9 [internal function]: app\commands\GearmanSetRegistryStateController->actionIndex()
#10 /var/www/XXXPROJECT/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array)
#11 /var/www/XXXPROJECT/vendor/yiisoft/yii2/base/Controller.php(156): yii\base\InlineAction->runWithParams(Array)
#12 /var/www/XXXPROJECT/vendor/yiisoft/yii2/console/Controller.php(128): yii\base\Controller->runAction('', Array)
#13 /var/www/XXXPROJECT/vendor/yiisoft/yii2/base/Module.php(523): yii\console\Controller->runAction('', Array)
#14 /var/www/XXXPROJECT/vendor/yiisoft/yii2/console/Application.php(180): yii\base\Module->runAction('gearman-set-reg...', Array)
#15 /var/www/XXXPROJECT/vendor/yiisoft/yii2/console/Application.php(147): yii\console\Application->runAction('gearman-set-reg...', Array)
#16 /var/www/XXXPROJECT/vendor/yiisoft/yii2/base/Application.php(380): yii\console\Application->handleRequest(Object(app\classes\Request))
#17 /var/www/XXXPROJECT/yii(26): yii\base\Application->run()
#18 {main}

@kevinmiao
Copy link

has solution?

@shijiajiaga
Copy link

after I try set broker version property 0.10.0,haven't seen the error,everything it's OK

@songkaiha
Copy link

Also have this problem,has solution?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants