Details
Description
Hi
The following code is working for forking proccess useing extention versions 4.0 and 4.1, due to the change in the connection string.
chdir(__DIR__); |
require_once __DIR__ . '/../vendor/autoload.php'; |
|
use \Couchbase\ClusterOptions; |
use \Couchbase\Cluster; |
|
$username = 'user'; |
$password = 'password'; |
$connectionString = 'couchbase://10.10.10.10'; |
$bucketName = 'testing'; |
$scopeName = '_default'; |
$collectionName = '_default'; |
|
|
$clusterOpts = new ClusterOptions(); |
$clusterOpts->credentials($username, $password); |
|
$couchbase = new Cluster($connectionString. '?ppid=' . posix_getppid(), $clusterOpts); |
$bucket = $couchbase->bucket($bucketName); |
$scope = $bucket->scope($scopeName); |
$collection = $scope->collection($collectionName); |
|
$result = $collection->upsert('test-key', [time(), 'some data']); |
|
$data = $collection->get('test-key')->content(); |
|
print_r($data); |
|
$processId = pcntl_fork(); |
if ($processId < 0) { |
// cleanup using posix_kill & pcntl_wait |
throw new RuntimeException('pcntl_fork failed.'); |
} elseif ($processId === 0) { |
$couchbase = new Cluster($connectionString. '?ppid=' . posix_getppid(), $clusterOpts); |
$bucket = $couchbase->bucket($bucketName); |
$scope = $bucket->scope($scopeName); |
$collection = $scope->collection($collectionName); |
|
$data = $collection->get('test-key')->content(); |
print_r($data); |
exit(); // <-- locks up and never exits |
} else { |
pcntl_wait($status); |
// WE ARE IN THE PARENT |
echo "parent\r\n"; |
}
|
It is now locking up on the child exit() call, I would guess it has somthing to to do with https://issues.couchbase.com/browse/PCBC-964 which could of introduced a blocking call into the extention shutdown, but you would have a better idea than me of the problem.
Attachments
Issue Links
- is duplicated by
-
PCBC-886 SDK locking up when inside a forked process
- Closed