V3.0.2 SIGSEGV on N1QL Query

This is using nginx and PHP FPM on MacOS 10.15.3 Catalina (my dev machine)

The PHP and CB specifics:

---- PHP Info ----

---- Couchbase Client Info ----

couchbase support	enabled
extension version	3.0.2
libcouchbase runtime version	3.0.0_18_gc3179958d4 (git: c3179958d4db71ee70243a1f8470edbf9e405f08)
libcouchbase headers version	3.0.0_18_gc3179958d4 (git: c3179958d4db71ee70243a1f8470edbf9e405f08)
zlib compressor	enabled

Directive	Local Value	Master Value
couchbase.log_level	WARN	WARN
couchbase.encoder.format	json	json
couchbase.encoder.compression	off	off
couchbase.encoder.compression_threshold	0	0
couchbase.encoder.compression_factor	0.0	0.0
couchbase.decoder.json_arrays	0	0
couchbase.pool.max_idle_time_sec	60	60

I run the following block of code and get a SIGSEGV crash in my php-fpm logs on the $cluster->query line.

$connectionString = "couchbase://localhost";
$options = new \Couchbase\ClusterOptions();
$options->credentials("admin", "password");
$cluster = new \Couchbase\Cluster($connectionString, $options);
$query = 'SELECT x.* FROM `travel-sample` x WHERE x.`type`="hotel" LIMIT 10';
$opts = new QueryOptions();
$res = $cluster->query($query, $opts);  // This line causes SIGSEGV
dd($res); // this is a Laravel function "die and dump" - like var_dump except it also stops execution

KV operations ($collection->upsert(), $collection->get()) in the exact same environment function properly.

Hi, @jrlawhorne. Thanks for feedback. I’ve just tried to reproduce it on my mac, and it does not fail. The only difference is that I’ve used var_dump() as I don’t have laravel configured. Does it fail with var_dump($res); on your machine? Could you post stacktrace here?

To ask PHP-FPM for coredump you would need to add rlimit_core = unlimited into config, find a stacktrace somewhere in ~/Library/Logs/DiagnosticReports/php-fpm*.crash


After some tweaking, I got it to dump a core file but nothing showed up in the DiagnosticReports folder.

This doesn’t have much detail.

I did build the client and the PHP SDK from the GitHub source. I think I attempted the install process from the docs but it wouldn’t work for some reason. If you have the same environment and it doesn’t crash with the same code, it’s likely my installed libcouchbase or couchbase.so that I built locally.

If you have good install instructions for MacOS, please share. Thanks. I’d prefer to use the 3.x version if it’s stable for basic operations. If not, I’ll fall back to 2.6 on this project.

* thread #1, stop reason = signal SIGSTOP
  * frame #0: 0x0000014600000001
    frame #1: 0x000000010a776e11 php-fpm`zend_read_property + 180
    frame #2: 0x000000010db5f9ba couchbase.so`zim_Cluster_query(execute_data=<unavailable>, return_value=0x000000010dc15520) at n1ql.c:619:20 [opt]
    frame #3: 0x000000010a7c5df2 php-fpm`ZEND_DO_FCALL_SPEC_RETVAL_USED_HANDLER + 425
    frame #4: 0x000000010a7aa3eb php-fpm`execute_ex + 35
    frame #5: 0x000000010a7aa5a3 php-fpm`zend_execute + 352
    frame #6: 0x000000010a76d0a1 php-fpm`zend_execute_scripts + 338
    frame #7: 0x000000010a715d28 php-fpm`php_execute_script + 482
    frame #8: 0x000000010a7fc7ed php-fpm`main + 6379
    frame #9: 0x00007fff687117fd libdyld.dylib`start + 1
  thread #2, stop reason = signal SIGSTOP
    frame #0: 0x00007fff6885392e libsystem_kernel.dylib`__workq_kernreturn + 10
    frame #1: 0x00007fff68912760 libsystem_pthread.dylib`_pthread_wqthread + 390
    frame #2: 0x00007fff68911827 libsystem_pthread.dylib`start_wqthread + 15

I think I’ve found the issue. Could you try this build, please?


The issue is related to using NULL as PHP array.

That change prevents the crash. I’ve got the build working for KV upsert and get via collection but having issues with N1QL - will post in a separate thread since it’s a separate issue.