2

When connecting to the cluster via cluster->connect() the PHP script hangs.

While I try this with the nodejs driver :

const cassandra = require('cassandra-driver');
const client = new cassandra.Client({
contactPoints: ['127.0.0.1'],
localDataCenter: 'datacenter1',
keyspace: 'test'
});
const query = 'SELECT * FROM mytable';
client.execute(query).then(console.log).catch( console.log );

We get the following output :

ResultSet {
info: {
queriedHost: '127.0.0.1:9042',
triedHosts: { '127.0.0.1:9042': null },
speculativeExecutions: 0,
achievedConsistency: 10,
traceId: undefined,
warnings: undefined,
customPayload: undefined,
isSchemaInAgreement: true
},
rows: [ Row { id: 'test' } ],
rowLength: 1,
columns: [ { name: 'id', type: [Object] } ],
pageState: null,
nextPage: undefined,
nextPageAsync: undefined
}

When we do this with PHP it hangs :

<?php
$cluster   = \Cassandra::cluster()
->withContactPoints( '127.0.0.1' )
->withPort( 9042 )
->build();
// This will happen immediately
// var_dump( 'Built!' );exit;
$session   = $cluster->connect( 'test' );
// This hangs. It never dumps 'Connected!'.
var_dump( 'Connected!' );exit;
var_dump( $session->execute( new \Cassandra\SimpleStatement( 'select * from mytable' ), array() ) );

Below are attached the files needed.

index.php -> https://pastebin.com/iihpJfpW

Vagrantfile -> https://pastebin.com/BkPwynxy

cassandra.repo -> https://pastebin.com/LbraCY3f

index.js -> https://pastebin.com/TSPc0bLm

  1. Make new folder "cassandraTest"
  2. Put Vagrantfile inside the folder
  3. Make new directory in "cassandraTest" called "provision"
  4. Put cassandra.repo in there
  5. vagrant up

NOTE :

This is not a Vagrant issue, as the same problem occurs in our Stage environment running CentOS 7.6

Environment:

CentOS 7.6

Cassandra 3.11.6 Native Protocol v4

NodeJs 12 NodeJs Cassandra Driver 4.5.0

PHP 7.2 PHP Cassandra Driver ( latest, installed via yum install -y php72-php-pecl-cassandra.x86_64 from remi )

Vagrant 2.2.7 Oracle VirtualBox Version 6.1.4 r136177 (Qt5.6.2)

  • Which version of `cassandra-cpp-driver` are you using? This might be a [bug](https://datastax-oss.atlassian.net/browse/CPP-917) fixed in the latest version. – Derek Chan Jun 11 '20 at 07:49
  • Do you find any solution ? i meet this problem on a basis regular / i can resolve it only by downgrade or upgrade to specific versions of libuv, cassandra-cpp-driver and cassandra. I m on debian 9 and debian 10 with php-7.4 / (i first met the problem with php7.2 ) – mik3fly-4steri5k Oct 25 '20 at 18:48
  • can you provide a ld (/usr/bin/ld) of your cassandra.so ? – mik3fly-4steri5k Oct 27 '20 at 22:09

1 Answers1

1

Looking at the date you asked and the symptoms, I think you are hitting this bug.

Try upgrading the cassandra-cpp-driver to the v2.15.2 and see if it works.

Derek Chan
  • 71
  • 4
  • No working for me, i have tried version from 2.15.0 to 2.15.3 , even if i change the libuv version. I think problem is around the dynamic depencies around compiled cassandra.so for php. Investigation is in progress. When i make a ld to the cassandra.so i have plenty of reference undefined – mik3fly-4steri5k Nov 05 '20 at 12:44