What version of protobuf and what language are you using?
Version: v3.6.1
Language: PHP 7.3.0
What operating system (Linux, Windows, ...) and version?
Ubuntu 18.04.1 LTS
What runtime / compiler are you using (e.g., python version or gcc version)
Most likely it's gcc, but I'm not sure
What did you do?
Steps to reproduce the behavior:
sudo add-apt-repository ppa:ondrej/php && sudo apt-get update)sudo apt install php7.3-fpm)sudo pecl install protobuf-3.6.1)echo "extension=protobuf.so" | sudo tee /etc/php/7.3/mods-available/protobuf.ini && sudo phpenmod protobuf)sudo service php7.3-fpm restart)What did you expect to see
php-fpm had started
What did you see instead?
$ systemctl status php7.3-fpm.service
โ php7.3-fpm.service - The PHP 7.3 FastCGI Process Manager
Loaded: loaded (/lib/systemd/system/php7.3-fpm.service; enabled; vendor preset: enabled)
Active: failed (Result: core-dump) since Wed 2018-12-12 08:22:42 UTC; 29s ago
Docs: man:php-fpm7.3(8)
Process: 30351 ExecStart=/usr/sbin/php-fpm7.3 --nodaemonize --fpm-config /etc/php/7.3/fpm/php-fpm.conf (code=dumped, signal=SEGV)
Main PID: 30351 (code=dumped, signal=SEGV)
Make sure you include information that can help us debug (full error message, exception listing, stack trace, logs).
$ gdb
(gdb) exec-file /usr/sbin/php-fpm7.3 --nodaemonize --fpm-config /etc/php/7.3/fpm/php-fpm.conf
(gdb) run
Starting program: /usr/sbin/php-fpm7.3 /usr/sbin/php-fpm7.3 --nodaemonize --fpm-config /etc/php/7.3/fpm/php-fpm.conf
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
Program received signal SIGSEGV, Segmentation fault.
0x0000555555815304 in ?? ()
(gdb) bt
#0 0x0000555555815304 in ?? ()
#1 0x00007ffff240a010 in ?? ()
#2 0x0000555555e8b2b0 in ?? ()
#3 0x00007ffff240a000 in ?? ()
#4 0x000055555580fc6a in ?? ()
#5 0x0000555555e8b2b0 in ?? ()
#6 0x0000555555e8b2b0 in ?? ()
#7 0x00007ffff240a010 in ?? ()
#8 0x00007fffe43ff51e in message_create (ce=0x7ffff240a010) at /tmp/pear/temp/protobuf/message.c:95
#9 0x00005555558184bd in ?? ()
#10 0x00005555558d6a00 in ?? ()
#11 0x0000000600000001 in ?? ()
#12 0x0000555555e92310 in ?? ()
#13 0x00007fff0000000e in ?? ()
#14 0x0000005b0000006e in ?? ()
#15 0xdb127edaf97d0a00 in ?? ()
#16 0x0000555555e91690 in ?? ()
#17 0x00000000ffffffff in ?? ()
#18 0x0000555555e90eb0 in ?? ()
#19 0x0000555555c39190 in ?? ()
#20 0x0000000000000000 in ?? ()
Anything else we should know about your project / environment
Same happens on the official docker image (and on bare stretch):
Dockerfile:
FROM php:7.3.0-fpm-stretch
RUN apt-get update && apt-get install -y --no-install-recommends zlib1g-dev
RUN pecl install protobuf
RUN echo 'extension=protobuf.so' > /usr/local/etc/php/conf.d/protobuf.ini
Running said container will segfault and leave a core dump in it's workdir.
docker build -t broken-protobuf . && docker run --rm -v $(pwd):/var/www/html broken-protobuf
will write the core dump to your working directory.
Here is a backtrace for the error:
#0 0x000055dff9680608 in zend_objects_store_put ()
#1 0x000055dff9679543 in zend_object_std_init ()
#2 0x00007f7eb8f1d23c in message_create (ce=0x55dffc418850) at /tmp/pear/temp/protobuf/message.c:95
#3 0x000055dff9683b00 in ?? ()
#4 0x000055dff968557c in zend_do_implement_interface ()
#5 0x000055dff963739f in zend_class_implements ()
#6 0x00007f7eb8f1ef52 in any_init () at /tmp/pear/temp/protobuf/message.c:995
#7 0x00007f7eb8f2e28f in zm_startup_protobuf (type=1, module_number=35)
at /tmp/pear/temp/protobuf/protobuf.c:359
#8 0x000055dff9634181 in zend_startup_module_ex ()
#9 0x000055dff96341e3 in ?? ()
#10 0x000055dff9643a7e in zend_hash_apply ()
#11 0x000055dff9634834 in zend_startup_modules ()
#12 0x000055dff95918b9 in php_module_startup ()
#13 0x000055dff971692a in ?? ()
#14 0x000055dff97193bc in ?? ()
#15 0x00007f7ec08052e1 in __libc_start_main (main=0x55dff9718b1c, argc=1, argv=0x7ffdf2077958,
init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7ffdf2077948)
at ../csu/libc-start.c:291
#16 0x000055dff8fd1b3a in _start ()
I have fixed it in #5434. Please try that.
:+1: My example starts with your fix @TeBoring.
docker build -t broken-protobuf . && docker run --rm -v $(pwd):/var/www/html broken-protobuf
...
[18-Dec-2018 08:55:27] NOTICE: fpm is running, pid 1
[18-Dec-2018 08:55:27] NOTICE: ready to handle connections
The Dockerfile:
FROM php:7.3.0-fpm-stretch
RUN apt-get update && apt-get install -y --no-install-recommends zlib1g-dev git
RUN git clone https://github.com/protocolbuffers/protobuf.git
WORKDIR protobuf
RUN git fetch origin pull/5434/head:php-7.3-fix
RUN git checkout php-7.3-fix
WORKDIR php/ext/google/protobuf
RUN touch LICENSE
RUN pear package
RUN pecl install protobuf-3.6.1.tgz
WORKDIR /var/www/html
RUN echo 'extension=protobuf.so' > /usr/local/etc/php/conf.d/protobuf.ini
I also installed the fixed version to a staging system and it served a couple of requests where stuff is fetched from gcs via grpc&protobuf.
Works for me, I'll wait until release before deploying it to production though.
Most helpful comment
I have fixed it in #5434. Please try that.