php-leveldb icon indicating copy to clipboard operation
php-leveldb copied to clipboard

Segment Fault on M1 Mac with [email protected]

Open simonkuang opened this issue 3 years ago • 5 comments

  • hardware: M1 Mac
  • OS: Big Sur
  • PHP: [email protected] by homebrew (7.4.16)
  • leveldb: 1.23 stable by homebrew (--build-from-source)
  • ext-leveldb: 0.3.0, downloaded tarball from pecl.php.net, installed by phpize
➜  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.

simonkuang avatar Mar 20 '21 08:03 simonkuang

Please provide reproducing steps / reproducing code.

dktapps avatar Mar 20 '21 11:03 dktapps

reproducing code

# install php
brew install [email protected]  # 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/[email protected]/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 avatar Mar 22 '21 01:03 simonkuang

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

simonkuang avatar Mar 26 '21 01:03 simonkuang

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

dktapps avatar Mar 26 '21 01:03 dktapps

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

tvh avatar Nov 04 '21 09:11 tvh