Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Zookeeper::exists(): error: invalid zhandle state #80

Open
airanvinay opened this issue Mar 22, 2017 · 5 comments
Open

Zookeeper::exists(): error: invalid zhandle state #80

airanvinay opened this issue Mar 22, 2017 · 5 comments

Comments

@airanvinay
Copy link

Getting Exception "Zookeeper::exists(): error: invalid zhandle state",
I am using Zookeeper for Kafka.
Need help to find out where i am wrong.

@Timandes
Copy link
Contributor

Would you please paste your code?

@dsewnr
Copy link

dsewnr commented May 10, 2017

I got same error, too.

PHP Warning: array_merge(): Argument #1 is not an array in /app/test_kafka/mq/vendor/nmred/kafka-php/src/Kafka/Produce.php on line 136
PHP Warning: Zookeeper::exists(): error: invalid zhandle state in /app/test_kafka/mq/vendor/nmred/kafka-php/src/Kafka/ZooKeeper.php on line 208

my code:

$queue = msg_get_queue( $queue_id );
   
$msg_type = NULL;
$msg = NULL;
$max_msg_size = 16384;

$kafka = \Kafka\Produce::getInstance(KAFKA_SERVER, KAFKA_TIMEOUT);
$kafka->setRequireAck(-1);

while( msg_receive($queue, 1, $msg_type, $max_msg_size, $msg) )
{
   $msg->mq_data[ 'ymd' ] = date( 'Ymd' );
   $json_data = json_encode( $msg->mq_data );

   try {
       $kafka->setMessages(TEST_KAFKA_TOPIC_PREFIX.date('Ymd'), rand(0,99), $json_data);
       $kafka->send();
       $kafka->setMessages(TEST_KAFKA_TOPIC_CURRENT, rand(0,99), $json_data);
       $kafka->send();
   } catch( \Exception $e ) {
       echo "...failed, passed.\n";
   }

   $msg_type = NULL;
   $msg = NULL;
}

@Timandes
Copy link
Contributor

If you use latest version of pecl/zookeeper, you will get an exception when ' invalid zhandle state' occurs.

You can contact the author of nmred/kafka-php to catch this exception.

@Timandes
Copy link
Contributor

Timandes commented Jan 1, 2018

Can we close this issue now? : )

@dsewnr
Copy link

dsewnr commented Jan 1, 2018

Sure. ;p

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

No branches or pull requests

3 participants