quipo / kafka-php Goto Github PK
View Code? Open in Web Editor NEWPHP client library for Apache Kafka 0.6.x or 0.7.x
License: Apache License 2.0
PHP client library for Apache Kafka 0.6.x or 0.7.x
License: Apache License 2.0
Following is the error logged on the kafka console. Please help
[2015-11-04 13:02:00,596] ERROR Closing socket for /0:0:0:0:0:0:0:1 because of error (kafka.network.Processor)
java.nio.BufferUnderflowException
at java.nio.HeapByteBuffer.get(Unknown Source)
at java.nio.ByteBuffer.get(Unknown Source)
at kafka.api.ApiUtils$.readShortString(ApiUtils.scala:38)
at kafka.api.ProducerRequest$$anonfun$1.apply(ProducerRequest.scala:40)
at kafka.api.ProducerRequest$$anonfun$1.apply(ProducerRequest.scala:38)
at scala.collection.TraversableLike$$anonfun$flatMap$1.apply(TraversableLike.scala:251)
at scala.collection.TraversableLike$$anonfun$flatMap$1.apply(TraversableLike.scala:251)
at scala.collection.immutable.Range.foreach(Range.scala:141)
at scala.collection.TraversableLike$class.flatMap(TraversableLike.scala:251)
at scala.collection.AbstractTraversable.flatMap(Traversable.scala:105)
at kafka.api.ProducerRequest$.readFrom(ProducerRequest.scala:38)
at kafka.api.RequestKeys$$anonfun$1.apply(RequestKeys.scala:39)
at kafka.api.RequestKeys$$anonfun$1.apply(RequestKeys.scala:39)
at kafka.network.RequestChannel$Request.(RequestChannel.scala:50)
at kafka.network.Processor.read(SocketServer.scala:450)
at kafka.network.Processor.run(SocketServer.scala:340)
at java.lang.Thread.run(Unknown Source)
take kafka-php to packagist.org?
Probably rightly, as the Readme says 0.6/0.7:
ERROR: Kafka_Exception_Socket_EOF: Unexpected EOF while reading 4 bytes from stream (no data)
#0 /root/kafka-php/src/lib/Kafka/SimpleConsumer.php(216): Kafka_Socket->read(4, true)
#1 /root/kafka-php/src/lib/Kafka/SimpleConsumer.php(182): Kafka_SimpleConsumer->getResponseSize()
#2 /root/kafka-php/src/examples/consume.php(46): Kafka_SimpleConsumer->fetch(Object(Kafka_FetchRequest))
#3 {main}
Is it normal?
facing issue with consume.php and it is not working . Can any one advice me to solve the issue.
My server:
kafka 0.8.2.2 version, php5.3.9.
ERROR: Kafka_Exception_Socket_EOF: Unexpected EOF while reading 4 bytes from stream (no data)
#0 /root/kafka-php/src/lib/Kafka/SimpleConsumer.php(216): Kafka_Socket->read(4, true)
#1 /root/kafka-php/src/lib/Kafka/SimpleConsumer.php(182): Kafka_SimpleConsumer->getResponseSize()
#2 /root/kafka-php/src/examples/consume.php(65): Kafka_SimpleConsumer->fetch(Object(Kafka_FetchRequest))
when we run consumer.php i geeting this error for kafka-php.
Please any one idea how to solve this error for kafka then please suggest me.
There are no tags in the repo. Would be nice to have tags for maintaining different version instead of just dev-master
.
Here some helpful links on how to do this just in case.
https://help.github.com/articles/creating-releases/
https://stackoverflow.com/questions/18216991/create-a-tag-in-github-repository
Thank you.
╭─root@dev78 ~/Lab/kafka-php/src ‹master_›
╰─➤ ls
examples lib tests
╭─root@dev78 ~/Lab/kafka-php/src ‹master_›
╰─➤ php examples/consume.php
ERROR: Kafka_Exception_Socket_EOF: Could not read 4 bytes from stream (not readable)
#0 /root/Lab/kafka-php/src/lib/Kafka/SimpleConsumer.php(216): Kafka_Socket->read(4, true)
#1 /root/Lab/kafka-php/src/lib/Kafka/SimpleConsumer.php(182): Kafka_SimpleConsumer->getResponseSize()
#2 /root/Lab/kafka-php/src/examples/consume.php(46): Kafka_SimpleConsumer->fetch(Object(Kafka_FetchRequest))
#3 {main}
ERROR: Kafka_Exception_Socket_EOF: Could not read 4 bytes from stream (not readable)
#0 /root/Lab/kafka-php/src/lib/Kafka/SimpleConsumer.php(216): Kafka_Socket->read(4, true)
#1 /root/Lab/kafka-php/src/lib/Kafka/SimpleConsumer.php(182): Kafka_SimpleConsumer->getResponseSize()
#2 /root/Lab/kafka-php/src/examples/consume.php(46): Kafka_SimpleConsumer->fetch(Object(Kafka_FetchRequest))
#3 {main}
ERROR: Kafka_Exception_Socket_EOF: Could not read 4 bytes from stream (not readable)
#0 /root/Lab/kafka-php/src/lib/Kafka/SimpleConsumer.php(216): Kafka_Socket->read(4, true)
#1 /root/Lab/kafka-php/src/lib/Kafka/SimpleConsumer.php(182): Kafka_SimpleConsumer->getResponseSize()
#2 /root/Lab/kafka-php/src/examples/consume.php(46): Kafka_SimpleConsumer->fetch(Object(Kafka_FetchRequest))
#3 {main}
^Z
[3] + 24000 suspended php examples/consume.php
We have noticed in our environment with PHP 7.2 and Kafka 0.7, this fwrite can cause E_NOTICEs to occur: https://github.com/quipo/kafka-php/blob/master/src/lib/Kafka/Socket.php#L256
Example: fwrite(): send of 3895 bytes failed with errno=32 Broken pipe
Looking through the PHP source code I couldn't exactly find why this is. In any case, if fwrite
causes an E_NOTICE, it will still continue to line 257 and check the return value, throwing an exception if -1
or false
but otherwise continuing (perhaps 0 was returned). We don't seem to be getting the Kafka_Exception_Socket
nor the Kafka_Exception_Socket_Timeout
so I'm thinking we might be able to squelch this one.
Maybe this library should wrap the fwrite
call with set_error_handler
and restore_error_handler
in order to capture these non fatal warnings?
following the tips in
https://bugs.php.net/bug.php?id=47564
should change the following line:
return $original = $set[1] << 32 | $set[2];
to
return $original = ($set[1]&0xFFFFFFFF) << 32 | ($set[2]&0xFFFFFFFF);
BR
Multiple unit tests are failing or resulting in errors. Test output shown below.
$ phpunit -c src/tests/phpunit.xml
PHPUnit 3.7.31 by Sebastian Bergmann.
Configuration read from /Users/dordille/kafka-php/src/tests/phpunit.xml
.............E.EEEEEE.......E.......................FS...E....
Time: 148 ms, Memory: 23.50Mb
There were 9 errors:
1) Kafka_FetchRequestTest::testWriteToOffset
Only variables should be passed by reference
/Users/dordille/kafka-php/src/tests/Kafka/FetchRequestTest.php:78
2) Kafka_MessageSetTest::testIterator
fclose(): 92 is not a valid stream resource
/Users/dordille/kafka-php/src/tests/Kafka/MessageSetTest.php:70
3) Kafka_MessageSetTest::testIteratorInvalidLastMessage
fclose(): 102 is not a valid stream resource
/Users/dordille/kafka-php/src/tests/Kafka/MessageSetTest.php:89
4) Kafka_MessageSetTest::testOffset
fclose(): 105 is not a valid stream resource
/Users/dordille/kafka-php/src/tests/Kafka/MessageSetTest.php:113
5) Kafka_MessageSetTest::testOffset2
fclose(): 108 is not a valid stream resource
/Users/dordille/kafka-php/src/tests/Kafka/MessageSetTest.php:136
6) Kafka_MessageSetTest::testCompressedMessages
fclose(): 111 is not a valid stream resource
/Users/dordille/kafka-php/src/tests/Kafka/MessageSetTest.php:168
7) Kafka_MessageSetTest::testMixedMessages
fclose(): 118 is not a valid stream resource
/Users/dordille/kafka-php/src/tests/Kafka/MessageSetTest.php:208
8) Kafka_ProducerTest::testProducer
Kafka_Exception_Socket_EOF: Unexpected EOF while reading 10000000 bytes from stream (no data)
/Users/dordille/kafka-php/src/lib/Kafka/Socket.php:205
/Users/dordille/kafka-php/src/tests/Kafka/ProducerTest.php:36
/Users/dordille/kafka-php/src/tests/Kafka/ProducerTest.php:81
9) Kafka_SocketTest::testReadFewerBytes
Kafka_Exception_Socket_EOF: Unexpected EOF while reading 4 bytes from stream (no data)
/Users/dordille/kafka-php/src/lib/Kafka/Socket.php:205
/Users/dordille/kafka-php/src/tests/Kafka/SocketTest.php:118
--
There was 1 failure:
1) Kafka_SocketTest::testWriteReadOnlySocket
The above write() call should fail on a read-only socket
/Users/dordille/kafka-php/src/tests/Kafka/SocketTest.php:75
FAILURES!
Tests: 62, Assertions: 104, Failures: 1, Errors: 9, Skipped: 1.
I've tested on both 5.4.22
and 5.3.4
, wanted to know if this was isolated to my specific version of php or something else.
Will it work fine on Apache Kafka ^2 - checked?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.