Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PHP: Segfault with version 3.11.2 and simple spanner call #7055

Closed
bakins opened this issue Dec 30, 2019 · 15 comments
Closed

PHP: Segfault with version 3.11.2 and simple spanner call #7055

bakins opened this issue Dec 30, 2019 · 15 comments

Comments

@bakins
Copy link

bakins commented Dec 30, 2019

What version of protobuf and what language are you using?
Version: 3.11.2
Language: php 7.3.13 (tested with other versions)

What operating system (Linux, Windows, ...) and version?
Linux - Ubuntu Buster

What runtime / compiler are you using (e.g., python version or gcc version)
php 7.3.13 with gcc 8.3.0

What did you do?

See example at https://github.com/bakins/php-protobuf-segfault

What did you expect to see

PHP script runs successfully with protobuf extension version 3.11.2

What did you see instead?

Segfault.

Works with extension version 3.10.0

Program terminated with signal SIGSEGV, Segmentation fault.
#0  0x00007fcc8fe82a93 in zim_Descriptor_getClass (execute_data=0x7fcc9021e1a0, return_value=0x7fcc9021e0d0) at /usr/src/protobuf-3.11.2/def.c:138
138	  const char* classname = ZSTR_VAL(intern->klass->name);
[Current thread is 1 (Thread 0x7fcc9043f440 (LWP 7))]
(gdb) bt
#0  0x00007fcc8fe82a93 in zim_Descriptor_getClass (execute_data=0x7fcc9021e1a0, return_value=0x7fcc9021e0d0) at /usr/src/protobuf-3.11.2/def.c:138
#1  0x000055c446de88c7 in execute_ex ()
#2  0x000055c446d56616 in zend_call_function ()
#3  0x000055c446c72a8b in ?? ()
#4  0x000055c446de92c6 in execute_ex ()
#5  0x000055c446d8e542 in zend_generator_resume ()
#6  0x000055c446d8f2d2 in ?? ()
#7  0x000055c446da4542 in ?? ()
#8  0x000055c446dc9f23 in ?? ()
#9  0x000055c446de2d95 in execute_ex ()
#10 0x000055c446dea7e2 in zend_execute ()
#11 0x000055c446d64363 in zend_execute_scripts ()
#12 0x000055c446d05268 in php_execute_script ()
#13 0x000055c446decd3e in ?? ()
#14 0x000055c446a8029c in ?? ()
#15 0x00007fcc9326409b in __libc_start_main (main=0x55c446a7fe10, argc=2, argv=0x7fff869480d8, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>,
    stack_end=0x7fff869480c8) at ../csu/libc-start.c:308
#16 0x000055c446a8097a in _start ()
(gdb)

Anything else we should know about your project / environment

Simple spanner example code from https://github.com/GoogleCloudPlatform/php-docs-samples/blob/master/spanner/quickstart.php

@TeBoring
Copy link
Contributor

Are you able to simplify the logic to only need protobuf's logic?
e.g., I don't have the GOOGLE_APPLICATION_CREDENTIALS

@bakins
Copy link
Author

bakins commented Jan 10, 2020

@TeBoring updated my test repo to eliminate needing to use spanner. segfaults when doing spanner unit tests.

@bakins
Copy link
Author

bakins commented Jan 10, 2020

@TeBoring I tested #7077 and my spanner client example works now.

The unit tests for https://github.com/googleapis/google-cloud-php segfault in a different place, but I think that's a different issue as they seem to segfault in the same place using php protobuf 3.10 c extension as well.

@TeBoring
Copy link
Contributor

Please give more details (stack trace could also help) for the google-cloud-php failure.

@bakins
Copy link
Author

bakins commented Jan 10, 2020

Steps to reproduce

@TeBoring
Copy link
Contributor

Could you copy the stack trace here?

@TeBoring
Copy link
Contributor

Sorry, cannot reproduce bug with your repo.
When I run it, it just hang there forever.

@TeBoring
Copy link
Contributor

ok, manually running commands from your script seems working

@TeBoring
Copy link
Contributor

I can reproduce the error now. However, there are so many tests and I am not familiar with their code base. Can someone simplify the logic to only involve protobuf?

@TeBoring
Copy link
Contributor

Any update? Shall we merge #7077 first?

@magita
Copy link

magita commented Jan 15, 2020

I have a similar segmentation fault error.
Version: 3.11.2
PHP Version: 7.3.0

require __DIR__ . '/vendor/autoload.php';
use Google\Cloud\Firestore\FirestoreClient;

putenv('GOOGLE_APPLICATION_CREDENTIALS=my.json');
$firestore = new FirestoreClient();
$firestore->collection('users')->add(['name' => 'Bob']);

@magita
Copy link

magita commented Jan 15, 2020

sudo pecl uninstall protobuf
sudo pecl install protobuf-3.10.0

It's Works!

@bakins
Copy link
Author

bakins commented Jan 16, 2020

@TeBoring - I think #7077 is good to merge. I can do another issue for the other segfault - I do not think it is related as it fails using 3.10 as well.

@TeBoring
Copy link
Contributor

@bakins would you mind reviewing #7077?

@TeBoring
Copy link
Contributor

Fixed in #7077

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants