reeze / php-leveldb

The PHP Binding for LevelDB
Other
240 stars 44 forks source link

Segment Fault on M1 Mac with PHP@7.4 #46

Open simonkuang opened 3 years ago

simonkuang commented 3 years ago
➜  leveldb-0.3.0 php -v
PHP 7.4.16 (cli) (built: Mar  4 2021 12:36:48) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
    with Zend OPcache v7.4.16, Copyright (c), by Zend Technologies
[1]    60656 segmentation fault  php -v

Errors occurred while php process quitting.

dktapps commented 3 years ago

Please provide reproducing steps / reproducing code.

simonkuang commented 3 years ago

reproducing code

# install php
brew install php@7.4  # php-7.4.16

# install leveldb library
brew install --build-from-source leveldb  # stable 1.23

# install ext-leveldb
curl -LO https://pecl.php.net/get/leveldb-0.3.0.tgz
tar zxf leveldb-0.3.0.tgz
cd leveldb-0.3.0
phpize
./configure --with-php-config=/opt/homebrew/opt/php@7.4/bin/php-config --with-leveldb=/opt/homebrew/opt/leveldb
make
make install

# reproducing
php -m | grep leveldb

php Modules

[PHP Modules] bcmath bz2 calendar Core ctype curl date dba dom exif FFI fileinfo filter ftp gd gettext gmp hash iconv intl json ldap leveldb libxml mbstring mongodb mysqli mysqlnd odbc openssl pcntl pcre PDO pdo_dblib pdo_mysql PDO_ODBC pdo_pgsql pdo_sqlite pgsql Phar phpdbg_webhelper phpiredis posix pspell readline redis Reflection session shmop SimpleXML soap sockets sodium SPL sqlite3 standard swoole sysvmsg sysvsem sysvshm tidy tokenizer xml xmlreader xmlrpc xmlwriter xsl Zend OPcache zip zlib

[Zend Modules] Zend OPcache

[1] 64973 segmentation fault php -m

simonkuang commented 3 years ago

info from lldb. hope it's useful.

(lldb) bt
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x105cb0368)
  * frame #0: 0x000000019344ef5c libsystem_malloc.dylib`free + 112
    frame #1: 0x0000000100d16a1c dyld`dyld::garbageCollectImages() + 968
    frame #2: 0x0000000100d22570 dyld`dlclose + 216
    frame #3: 0x0000000193642edc libdyld.dylib`dlclose + 164
    frame #4: 0x000000010030c010 php`module_destructor + 240
    frame #5: 0x0000000100304a20 php`module_destructor_zval + 24
    frame #6: 0x0000000100315d14 php`zend_hash_graceful_reverse_destroy + 464
    frame #7: 0x0000000100304c78 php`zend_shutdown + 36
    frame #8: 0x00000001002afbd8 php`php_module_shutdown + 56
    frame #9: 0x000000010039a1c4 php`main + 1068
    frame #10: 0x0000000193645f34 libdyld.dylib`start + 4
dktapps commented 3 years ago

This doesn't look like a problem with the extension, but rather with php-src.

tvh commented 3 years ago

Could this be https://github.com/google/leveldb/issues/634?