Segmentation fault on accessing options (like operationTimeout)

I stumbled upon a reproductible segmentation fault when trying to get or set any options (like operationTimeout or httpTimeout).

The code is simple :

    $cluster = new CouchbaseCluster('couchbase://','test','');
    $bucket = $cluster->openBucket('test');

    var_dump($bucket->operationTimeout); // this crashes

This code does not crash under every test system, but when it does it is systematic.
Core dumps and strace available if needed.

Crashes on :
debian 7 64bits, php 5.3.29, php-couchbase 2.0.3 (2.0.2 also), libcouchbase 2.4.5 (2.4.3 also)

Does not crash on :
ubuntu 12.04 32bits, php 5.3.10, php-couchbase 2.0.3 (2.0.2 also), libcouchbase 2.4.5 (2.4.3 also)

In both cases the server is CE 3.0.1 with 1 node.

Are you able to provide the crash dump stack trace? This issue seems strange and is not something I’ve seen happen ever before.
Cheers, Brett

Hi Brett,

i cannot upload the dump so i provide you with an url :

In the archive you will find :

  • the php file
  • the core dump
  • the strace output
  • the PHP binary used

Please tell me when you have downloaded the file that i can remove it.

Hey excession,
I have a copy and am investigating.
Cheers, Brett

Hey excession,

Although we were not able to inspect the dump file as we need further information regarding your system type, and more of the libraries you have installed (libcouchbase and php-couchbase for instance). I believe I actually managed to locate the source of the issue, see here:

Cheers, Brett

Hi Brett,

you nailed it ! I recompiled the php-couchbase extension using the master branch and the segfault is gone !

I also recompiled on a 64bit system and no change there (so all is good).

Thanks for the patch.

Hey excession,

That’s great to hear! Let me know if you encounter any new issues and I’ll be happy to help.

Cheers, Brett