PHP SDK 4.0.0 throwing a strange error

Hi I have setup a new Couchbase cluster 7.1 to test with the PHP sdk 4.0

Trying to do a getMulti, which is working, but if I am spawning some forks/processes , Couchbase getMulti doesn’t work anymore in the forked process.

after configuring the debug I am seeing this error (as the last error from Couchbase)

[2022-08-10 16:31:41.299] [7542,7545] [debug] 4ms, [e9fe1c1a-e9e3-4a9f-cd45-0fc6a9b4a22c/523f4451-75ed-42e0-dc88-0b67eb4259c2/plain/top-charts] <couchbaseDBHostname/couchbaseIP:11210> unexpected orphan response: opcode=get (0x00), opaque=11, status=0 (success (0x00))

in the forks I am doing a completely new connection to the Couchbase, and the connection works. Seems that the getMulti doesn’t work

LATER EDIT:
I tried also with a normal get or query and doesn’t work. it just remains hung (On a standard query I don’t see the above error anymore, but still doesn’t return anyting)

@avsej what would you recommend me to check?

@flaviu do you happen to know if your application server is pegged up with CPU ? how many threads are you spawning ? Can you share your code (replace any credentials / ip addresses)

@Maria_Shodunke is this something you can follow-up on ?

Yes, I can provide a minimum code that you can test. I think there is now a ticket for this (Thanks to Avsej)

https://issues.couchbase.com/browse/PCBC-879

and here is some code to reproduce the issue


    use Couchbase\Cluster;
    use Couchbase\ClusterOptions;
    use Couchbase\QueryOptions;

    require __DIR__ . '/../always-include-top.php';





//    $connectionString = "couchbase://server";
//    $options = new ClusterOptions();
//
//    $options->credentials("Administrator", "password");
//    $cluster = new Cluster($connectionString, $options);
//    $options = new QueryOptions();
//
//    $query = "
//                    SELECT RAW
//                        meta().id AS id
//                    FROM
//                        `table`
//                    WHERE
//                        meta().id > 'document_id'
//                    ORDER BY
//                        meta().id
//                    LIMIT 3
//                                            ";
//
//    $charts = $cluster->query($query, $options)->rows();


    $childPid = pcntl_fork();
    if ($childPid === - 1) {

    }
    else if ($childPid === 0) {
        // Child code
        try {

            $connectionString1 = "couchbase://server";
            $options1 = new ClusterOptions();

            $options1->credentials("Administrator", "password");
            $cluster1 = new Cluster($connectionString1, $options1);
            $bucket = $cluster1->bucket("top-charts");

            $collection = $bucket->defaultCollection();
           //here can be any type of DB query not just a getMulti
            $results = $collection->getMulti(  array("document1","document2","document3"));

        }
        catch (Throwable $e) {

            exit(255);
        }
        finally {
            exit(0);
        }
    }
    else {
        // Base cronjob code
        $arrJobsStarted[] = $childPid;
      }

If I execut the Couchbase connection before the fork the connection inside the spawned process is not executed anymore. If I comment that out the spawned process works correctly. The problem is that I need Couchbase connection inside the spawned process and outside. And as you can see the in spawned process, I do a completely new DB connection

The alternative solution that I am using right now is that instead of spawning a new connection, am using exec with some arguments