Coder Social home page Coder Social logo

kafka-php's People

Contributors

adrienbrault avatar mheap avatar mpitid avatar quipo avatar saji89 avatar shyamalprasad avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

kafka-php's Issues

Producer throws BufferUnderflowException

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)

Cannot make it work with Kafka 0.8

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?

consume.php not working

facing issue with consume.php and it is not working . Can any one advice me to solve the issue.

ERROR: Kafka_Exception_Socket_EOF: Unexpected EOF while reading 4 bytes from stream

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))

Could not read 4 bytes from stream (not readable)

╭─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

fwrite may cause E_NOTICE but otherwise the program is fine

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?

Tests Failing

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.