I'm trying to run PHP 5.5 (with FPM) with APCu inside a Docker container. I'm using boot2docker on OSX.
When I try to run php-fpm -i, it segfaults.
Running in gdb, I get the following backtrace:
(gdb) run -i
Starting program: /usr/local/sbin/php-fpm -i
[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.
0x00007ffff542474c in __pthread_rwlock_init (rwlock=rwlock#entry=0xffffffffffffffff, attr=attr#entry=0x7ffff1bda988 <apc_lock_attr>) at pthread_rwlock_init.c:40
40 pthread_rwlock_init.c: No such file or directory.
(gdb) bt
#0 0x00007ffff542474c in __pthread_rwlock_init (rwlock=rwlock#entry=0xffffffffffffffff, attr=attr#entry=0x7ffff1bda988 <apc_lock_attr>) at pthread_rwlock_init.c:40
#1 0x00007ffff19ca9d0 in apc_lock_create (lock=lock#entry=0xffffffffffffffff) at /tmp/pear/temp/apcu/apc_lock.c:180
#2 0x00007ffff19d0135 in apc_sma_api_init (sma=0x7ffff1bda540 <apc_sma>, data=<optimized out>, expunge=<optimized out>, num=<optimized out>, size=<optimized out>, mask=<optimized out>) at /tmp/pear/temp/apcu/apc_sma.c:323
#3 0x00007ffff19ccac9 in zm_startup_apcu (type=0, module_number=35) at /tmp/pear/temp/apcu/php_apc.c:284
#4 0x00000000007198b6 in zend_startup_module_ex ()
#5 0x0000000000725565 in zend_hash_apply ()
#6 0x000000000071d32a in zend_startup_modules ()
#7 0x00000000006b9413 in php_module_startup ()
#8 0x00000000007d9da5 in ?? ()
#9 0x000000000042e684 in ?? ()
#10 0x00007ffff5657b45 in __libc_start_main (main=0x42de80, argc=2, argv=0x7fffffffec08, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7fffffffebf8) at libc-start.c:287
#11 0x000000000042f7fa in _start ()
(gdb)
I thought this might be some general problem with phtreads in a Docker container, but I haven't been able to find any reports of that kind of problem.
Some questions:
Is this a known issue (and, so, trying to fix this through configuration is fruitless)?
What is the significance of 40 pthread_rwlock_init.c: No such file or directory.?
Related
I am trying to run setup:di:compile on Magento 2.4.4, but I am getting a strange error and have no idea where to look or how to debug this.
Here is the code from the error log:
Proxies code generation... 1/9 [===>------------------------] 11% 1 sec 139.0 MiB Repositories code generation... 1/9 [===>------------------------] 11% 1 sec 139.0 MiBClass "Magento\Framework\DB\DataConverter\SerializedToJson" not found #0 /public_html/vendor/composer/ClassLoader.php(444): include() #1 /public_html/vendor/composer/ClassLoader.php(322): Composer\Autoload\includeFile() #2 [internal function]: Composer\Autoload\ClassLoader->loadClass() #3 /public_html/setup/src/Magento/Setup/Module/Di/Code/Reader/ClassesScanner.php(134): class_exists() #4 /public_html/setup/src/Magento/Setup/Module/Di/Code/Reader/ClassesScanner.php(117): Magento\Setup\Module\Di\Code\Reader\ClassesScanner->includeClass() #5 /public_html/setup/src/Magento/Setup/Module/Di/Code/Reader/ClassesScanner.php(87): Magento\Setup\Module\Di\Code\Reader\ClassesScanner->extract() #6 /public_html/setup/src/Magento/Setup/Module/Di/App/Task/Operation/RepositoryGenerator.php(61): Magento\Setup\Module\Di\Code\Reader\ClassesScanner->getList() #7 /public_html/setup/src/Magento/Setup/Module/Di/App/Task/Manager.php(56): Magento\Setup\Module\Di\App\Task\Operation\RepositoryGenerator->doOperation() #8 /public_html/setup/src/Magento/Setup/Console/Command/DiCompileCommand.php(216): Magento\Setup\Module\Di\App\Task\Manager->process() #9 /public_html/vendor/symfony/console/Command/Command.php(255): Magento\Setup\Console\Command\DiCompileCommand->execute() #10 /public_html/vendor/symfony/console/Application.php(1009): Symfony\Component\Console\Command\Command->run() #11 /public_html/vendor/symfony/console/Application.php(273): Symfony\Component\Console\Application->doRunCommand() #12 /public_html/vendor/magento/framework/Console/Cli.php(115): Symfony\Component\Console\Application->doRun() #13 /public_html/vendor/symfony/console/Application.php(149): Magento\Framework\Console\Cli->doRun() #14 /public_html/bin/magento(23): Symfony\Component\Console\Application->run() #15 {main}
Tried to redeploy static files and so on, but the issue still persists.
Thanks very much for your help!
I have tried:
clearing generated folder
deploying static content
clearing cache
reindexing
What you can simply do is:
Remove the vendor directory and launch the terminal again and execute the command
composer install
to regenerate all the Magento standard codes. You can check your vendor folder to ensure all dependencies are installed and run the compilation command later to load the dependencies.
Please make sure to backup the previous folder as well for safer side.
I read data from xml files with protobuf, and then When I run the code "foreach data", a core was generated by php-fpm: pool www,
PHP was compiled with "--enable-debug",
here is the gdb errors:
warning: no loadable sections found in added symbol-file system-supplied DSO at 0x7ffff7ffa000
Core was generated by `php-fpm: pool www '.
Program terminated with signal 11, Segmentation fault.
#0 0x000000000079407b in ZEND_FE_RESET_SPEC_CV_HANDLER (execute_data=0x7ffff7fb5118) at /home/wyq/php-5.6.14/Zend/zend_vm_execute.h:31510
31510 /home/wyq/php-5.6.14/Zend/zend_vm_execute.h: No such file or directory.
in /home/wyq/php-5.6.14/Zend/zend_vm_execute.h
(gdb) bt
#0 0x000000000079407b in ZEND_FE_RESET_SPEC_CV_HANDLER (execute_data=0x7ffff7fb5118) at /home/wyq/php-5.6.14/Zend/zend_vm_execute.h:31510
#1 0x000000000074067a in execute_ex (execute_data=0x7ffff7fb5118) at /home/wyq/php-5.6.14/Zend/zend_vm_execute.h:363
#2 0x00000000007406fc in zend_execute (op_array=0xf69868) at /home/wyq/php-5.6.14/Zend/zend_vm_execute.h:388
#3 0x00000000006e5138 in zend_call_function (fci=0x7fffffff8bb0, fci_cache=0x7fffffff8b80) at /home/wyq/php-5.6.14/Zend/zend_execute_API.c:829
#4 0x00000000005ce6b7 in zif_call_user_func_array (ht=2, return_value=0x14d35c8, return_value_ptr=0x7ffff7fb4180, this_ptr=0x0, return_value_used=0)
at /home/wyq/php-5.6.14/ext/standard/basic_functions.c:4784
#5 0x0000000000741013 in zend_do_fcall_common_helper_SPEC (execute_data=0x7ffff7fb4198) at /home/wyq/php-5.6.14/Zend/zend_vm_execute.h:558
#6 0x0000000000746a11 in ZEND_DO_FCALL_SPEC_CONST_HANDLER (execute_data=0x7ffff7fb4198) at /home/wyq/php-5.6.14/Zend/zend_vm_execute.h:2602
#7 0x000000000074067a in execute_ex (execute_data=0x7ffff7fb4198) at /home/wyq/php-5.6.14/Zend/zend_vm_execute.h:363
#8 0x00000000007406fc in zend_execute (op_array=0x7ffff7fe7d50) at /home/wyq/php-5.6.14/Zend/zend_vm_execute.h:388
#9 0x00000000006fadf5 in zend_execute_scripts (type=8, retval=0x0, file_count=3) at /home/wyq/php-5.6.14/Zend/zend.c:1341
#10 0x0000000000660b72 in php_execute_script (primary_file=0x7fffffffd380) at /home/wyq/php-5.6.14/main/main.c:2597
#11 0x00000000007be875 in main (argc=1, argv=0x7fffffffd5a8) at /home/wyq/php-5.6.14/sapi/fpm/fpm/fpm_main.c:1964
I'm debugging a segfault in my php app, I compiled php with --enable-debug option and after php-fpm dumped core during the segfault, I run:
$ gdb /usr/local/sbin/php-fpm core
GNU gdb (GDB) 7.12.1
Copyright (C) 2017 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-alpine-linux-musl".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from /usr/local/sbin/php-fpm...(no debugging symbols found)...done.
[New LWP 2110]
warning: Can't read pathname for load map: No error information.
Core was generated by `php-fpm:'.
Program terminated with signal SIGBUS, Bus error.
#0 0x000055c27ba1f291 in ?? ()
(gdb) bt
#0 0x000055c27ba1f291 in ?? ()
#1 0x000055c27ba21bce in _efree ()
#2 0x000055c27ba6c8b2 in ?? ()
#3 0x000055c27ba70cee in zend_array_destroy ()
#4 0x000055c27ba56fbd in _zval_dtor_func ()
#5 0x000055c27ba6cce4 in ?? ()
#6 0x000055c27ba70cc8 in zend_array_destroy ()
#7 0x000055c27ba56fbd in _zval_dtor_func ()
#8 0x000055c27ba6cce4 in ?? ()
#9 0x000055c27ba70c8a in zend_array_destroy ()
#10 0x000055c27ba56fbd in _zval_dtor_func ()
#11 0x000055c27ba6cce4 in ?? ()
#12 0x000055c27ba70cc8 in zend_array_destroy ()
#13 0x000055c27ba56fbd in _zval_dtor_func ()
#14 0x000055c27ba44b75 in ?? ()
#15 0x000055c27ba450fe in zend_cleanup_user_class_data ()
#16 0x000055c27ba3f473 in ?? ()
#17 0x000055c27ba5971b in zend_deactivate ()
#18 0x000055c27b9bf1df in php_request_shutdown ()
#19 0x000055c27bb55015 in ?? ()
#20 0x00007f7fb743e964 in __libc_start_main () from /lib/ld-musl-x86_64.so.1
#21 0x0000000000000000 in ?? ()
I also put .gdbinit from php sources to the directory with core file and set set auto-load safe-path / to ~/.gdbinit (not sure how it helps though).
As you can see there are ?? in the backtrace which is not helpful at all. Is this how it should be? Is there any way to get the real caller?
Is this how it should be?
No.
Is there any way to get the real caller?
Probably.
Your stack trace indicates that /usr/local/sbin/php-fpm is fully-stripped (has its symbol table removed). You can confirm this with file /usr/local/sbin/php-fpm.
It is not uncommon for make install to fully strip binaries. You should try to use the "as built" binary (instead of "as installed" you are doing now): gdb /path/to/build/tree/php-fpm core.
I'm working on a PHP extension that I'm trying to test on travis. Unit tests reveal a segfault that only occur on travis and I can't reproduce it locally no matter what I try.
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
warning: no loadable sections found in added symbol-file system-supplied DSO at 0x7fff1ccc0000
Core was generated by `/home/travis/.phpenv/versions/5.6/bin/php -d output_handler= -d open_basedir= -'.
Program terminated with signal 11, Segmentation fault.
#0 0x000000000095c6b8 in gc_zval_check_possible_root (tsrm_ls=<optimized out>, z=<optimized out>) at /tmp/php-build/source/5.6.3/Zend/zend_gc.h:183
183 /tmp/php-build/source/5.6.3/Zend/zend_gc.h: No such file or directory.
Thread 1 (Thread 0x7f759eae4740 (LWP 12532)):
#0 0x000000000095c6b8 in gc_zval_check_possible_root (tsrm_ls=<optimized out>, z=<optimized out>) at /tmp/php-build/source/5.6.3/Zend/zend_gc.h:183
#1 i_zval_ptr_dtor (tsrm_ls=<optimized out>, zval_ptr=<optimized out>) at /tmp/php-build/source/5.6.3/Zend/zend_execute.h:86
#2 zend_do_fcall_common_helper_SPEC (execute_data=<optimized out>, tsrm_ls=0x32fee10) at /tmp/php-build/source/5.6.3/Zend/zend_vm_execute.h:564
#3 0x000000000092194b in execute_ex (execute_data=0x7f759eaa5100, tsrm_ls=0x32fee10) at /tmp/php-build/source/5.6.3/Zend/zend_vm_execute.h:363
#4 0x00000000008b1098 in zend_execute_scripts (type=8, tsrm_ls=0x32fee10, retval=0x0, file_count=3) at /tmp/php-build/source/5.6.3/Zend/zend.c:1344
#5 0x000000000083e404 in php_execute_script (primary_file=0x7fff1cc7ff70, tsrm_ls=0x32fee10) at /tmp/php-build/source/5.6.3/main/main.c:2584
#6 0x0000000000960467 in do_cli (argc=63, argv=0x32fe2f0, tsrm_ls=0x32fee10) at /tmp/php-build/source/5.6.3/sapi/cli/php_cli.c:994
#7 0x000000000044a960 in main (argc=63, argv=0x32fe2f0) at /tmp/php-build/source/5.6.3/sapi/cli/php_cli.c:1378
I really don't know what can cause it, since I can't reproduce.
I am running php 5.5 on a Windows Server 2008. I am using the Laravel 4.0 framework for the application. I am connecting to a SQL SRV database via PDO, when executed via http there is no issue, connections are made data is called and updated without issue.
However when calling a command from Artisan (Laravel's CLI tool) I get the following error in the log:
log.ERROR: exception 'PDOException' with message 'could not find driver' in C:\inetpub\MBSWeb\postsrch\vendor\laravel\framework\src\Illuminate\Database\Connectors\Connector.php:47
Stack trace:
#0 C:\inetpub\MBSWeb\postsrch\vendor\laravel\framework\src\Illuminate\Database\Connectors\Connector.php(47): PDO->__construct('sqlsrv:Server=H...', 'xxxxxx', 'xxxxxx', Array)
#1 C:\inetpub\MBSWeb\postsrch\vendor\laravel\framework\src\Illuminate\Database\Connectors\SqlServerConnector.php(29): Illuminate\Database\Connectors\Connector->createConnection('sqlsrv:Server=H...', Array, Array)
#2 C:\inetpub\MBSWeb\postsrch\vendor\laravel\framework\src\Illuminate\Database\Connectors\ConnectionFactory.php(41): Illuminate\Database\Connectors\SqlServerConnector->connect(Array)
#3 C:\inetpub\MBSWeb\postsrch\vendor\laravel\framework\src\Illuminate\Database\DatabaseManager.php(128): Illuminate\Database\Connectors\ConnectionFactory->make(Array, 'sqlsrv')
#4 C:\inetpub\MBSWeb\postsrch\vendor\laravel\framework\src\Illuminate\Database\DatabaseManager.php(64): Illuminate\Database\DatabaseManager->makeConnection('sqlsrv')
#5 C:\inetpub\MBSWeb\postsrch\vendor\laravel\framework\src\Illuminate\Database\DatabaseManager.php(242): Illuminate\Database\DatabaseManager->connection()
#6 C:\inetpub\MBSWeb\postsrch\vendor\laravel\framework\src\Illuminate\Support\Facades\Facade.php(206): Illuminate\Database\DatabaseManager->__call('table', Array)
#7 C:\inetpub\MBSWeb\postsrch\vendor\laravel\framework\src\Illuminate\Support\Facades\Facade.php(206): Illuminate\Database\DatabaseManager->table('bb_job_details')
#8 C:\inetpub\MBSWeb\postsrch\app\models\Job.php(214): Illuminate\Support\Facades\Facade::__callStatic('table', Array)
#9 C:\inetpub\MBSWeb\postsrch\app\models\Job.php(214): Illuminate\Support\Facades\DB::table('bb_job_details')
#10 C:\inetpub\MBSWeb\postsrch\app\models\Cron.php(18): Job::getJobDetailsByStatus()
#11 C:\inetpub\MBSWeb\postsrch\app\controllers\ApplicantController.php(14): Cron::ChangePostingJobStatus()
#12 C:\inetpub\MBSWeb\postsrch\app\commands\GetApplicantsCommand.php(45): ApplicantController->index()
#13 C:\inetpub\MBSWeb\postsrch\vendor\laravel\framework\src\Illuminate\Console\Command.php(108): GetApplicantsCommand->fire()
#14 C:\inetpub\MBSWeb\postsrch\vendor\symfony\console\Symfony\Component\Console\Command\Command.php(244): Illuminate\Console\Command->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#15 C:\inetpub\MBSWeb\postsrch\vendor\laravel\framework\src\Illuminate\Console\Command.php(96): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#16 C:\inetpub\MBSWeb\postsrch\vendor\symfony\console\Symfony\Component\Console\Application.php(897): Illuminate\Console\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#17 C:\inetpub\MBSWeb\postsrch\vendor\symfony\console\Symfony\Component\Console\Application.php(191): Symfony\Component\Console\Application->doRunCommand(Object(GetApplicantsCommand), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#18 C:\inetpub\MBSWeb\postsrch\vendor\symfony\console\Symfony\Component\Console\Application.php(121): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#19 C:\inetpub\MBSWeb\postsrch\artisan(59): Symfony\Component\Console\Application->run()
#20 {main} [] []
[2014-03-23 22:53:13] log.ERROR: exception 'Symfony\Component\Debug\Exception\FatalErrorException' with message 'Call to undefined function Symfony\Component\Console\mb_detect_encoding()' in C:\inetpub\MBSWeb\postsrch\vendor\symfony\console\Symfony\Component\Console\Application.php:721
Stack trace:
#0 [internal function]: Illuminate\Exception\Handler->handleShutdown()
#1 {main} [] []
The PDO SQLSRV lib is installed, see the below screenshot of the phpinfo(), and as I've already said I can connection without issue when using the application via http;
Why is the PDO connection working fine via http but not in CLI? Please note I'm using the exact same set of code, one is called from a Laravel controller, the other from a Laravel command.
php cli and php cgi use different php.ini files. Try php -i | grep pdo to see if pdo is installed for your cli, see php -i | grep "Loaded Configuration File"
The answer above is correct, but just to clarify:
Open your console and execute:
php -i | grep "Loaded Configuration File"
That will give you the folder directory where you php-cli.ini is (Laravel Commands use a different php.ini than the one used by HTTP requests)
Go to that file, and make sure it has this:
extension=php_pdo_mysql.dll
Restart your server and try again. That worked for me, hope it helps.