PHP, почему я получаю ошибки, касающиеся openssl? - PullRequest
0 голосов
/ 10 мая 2019

Кажется, это то, где заканчивается PHP ... Я имею в виду проблему, с которой я столкнулся, очень глубоко в PHP. В многопоточном скрипте PHP-CLI я получаю ошибки, касающиеся расширения openssl, и они уходят глубоко в libssl.so. Это ошибка сегментации, gdb bt не показывает откуда она. В нескольких словах я создал собственное расширение php, основанное на libssh2. Расширение просто открывает туннель для сервера imap через ssh. Тогда я могу использовать в php следующий скрипт для связи с imap через ssh:

stream_socket_client("ssl://127.0.0.1:3333");

И в принципе это работает хорошо. Но в какой-то момент после работы я получаю ошибки, которые я описал.

Где может быть проблема?

А, а ошибки сегментации выглядят так:

Thread 2 "php" received signal SIGPIPE, Broken pipe.
[Switching to Thread 0x7fffe9fff700 (LWP 21697)]
0x00007ffff5ea82b7 in __libc_write (fd=46, buf=0x7fffe4220e53, nbytes=144) at ../sysdeps/unix/sysv/linux/write.c:27
27      ../sysdeps/unix/sysv/linux/write.c: No such file or directory.
(gdb) bt
#0  0x00007ffff5ea82b7 in __libc_write (fd=46, buf=0x7fffe4220e53, nbytes=144) at ../sysdeps/unix/sysv/linux/write.c:27
#1  0x00007ffff542dcd5 in ?? () from /usr/lib/x86_64-linux-gnu/libcrypto.so.1.1
#2  0x00007ffff542907a in ?? () from /usr/lib/x86_64-linux-gnu/libcrypto.so.1.1
#3  0x00007ffff54280d5 in ?? () from /usr/lib/x86_64-linux-gnu/libcrypto.so.1.1
#4  0x00007ffff5428573 in BIO_write () from /usr/lib/x86_64-linux-gnu/libcrypto.so.1.1
#5  0x00007ffff586ac67 in ?? () from /usr/lib/x86_64-linux-gnu/libssl.so.1.1
#6  0x00007ffff586bb85 in ?? () from /usr/lib/x86_64-linux-gnu/libssl.so.1.1
#7  0x00007ffff586bddf in ?? () from /usr/lib/x86_64-linux-gnu/libssl.so.1.1
#8  0x00007ffff587e78c in ?? () from /usr/lib/x86_64-linux-gnu/libssl.so.1.1
#9  0x00007ffff587e8c3 in SSL_write () from /usr/lib/x86_64-linux-gnu/libssl.so.1.1
#10 0x000055555578b460 in php_openssl_sockop_io (read=0, stream=0x7fffe94bc800,
    buf=0x7fffc687f3d8 "2 AUTHENTICATE PLAIN cmljY2FyZG9jb2NjaGkwMEB2aXJnaWxpby5pdAByaWNjYXJkb2NvY2NoaTAwQHZpcmdpbGlvLml0AG5hdGFsaW5hNjM=\r\n", count=115)
    at /home/mike/Documents/PHP/php-src-php-7.2.2/ext/openssl/xp_ssl.c:2049
#11 0x000055555578b21a in php_openssl_sockop_write (stream=0x7fffe94bc800, buf=0x7fffc687f3d8 "2 AUTHENTICATE PLAIN cmljY2FyZG9jb2NjaGkwMEB2aXJnaWxpby5pdAByaWNjYXJkb2NvY2NoaTAwQHZpcmdpbGlvLml0AG5hdGFsaW5hNjM=\r\n",
    count=115) at /home/mike/Documents/PHP/php-src-php-7.2.2/ext/openssl/xp_ssl.c:1971
#12 0x0000555555e65b45 in _php_stream_write_buffer (stream=0x7fffe94bc800, buf=0x7fffc687f3d8 "2 AUTHENTICATE PLAIN cmljY2FyZG9jb2NjaGkwMEB2aXJnaWxpby5pdAByaWNjYXJkb2NvY2NoaTAwQHZpcmdpbGlvLml0AG5hdGFsaW5hNjM=\r\n",
    count=115) at /home/mike/Documents/PHP/php-src-php-7.2.2/main/streams/streams.c:1088
#13 0x0000555555e65e96 in _php_stream_write (stream=0x7fffe94bc800, buf=0x7fffc687f3d8 "2 AUTHENTICATE PLAIN cmljY2FyZG9jb2NjaGkwMEB2aXJnaWxpby5pdAByaWNjYXJkb2NvY2NoaTAwQHZpcmdpbGlvLml0AG5hdGFsaW5hNjM=\r\n",
    count=115) at /home/mike/Documents/PHP/php-src-php-7.2.2/main/streams/streams.c:1203
#14 0x0000555555cae209 in zif_fwrite (execute_data=0x7fffe9423810, return_value=0x7fffe9423760) at /home/mike/Documents/PHP/php-src-php-7.2.2/ext/standard/file.c:1215
#15 0x0000555555f7978a in ZEND_DO_FCALL_SPEC_RETVAL_USED_HANDLER () at /home/mike/Documents/PHP/php-src-php-7.2.2/Zend/zend_vm_execute.h:1032
#16 0x0000555556005f1d in execute_ex (ex=0x7fffe9423620) at /home/mike/Documents/PHP/php-src-php-7.2.2/Zend/zend_vm_execute.h:59752
---Type <return> to continue, or q <return> to quit---
#17 0x00007fffeae59583 in pthreads_execute_ex (data=0x7fffe9423620) at /home/mike/Documents/PHP/pthreads/php_pthreads.c:135
#18 0x0000555555f78edb in ZEND_DO_FCALL_SPEC_RETVAL_UNUSED_HANDLER () at /home/mike/Documents/PHP/php-src-php-7.2.2/Zend/zend_vm_execute.h:888
#19 0x0000555556005f10 in execute_ex (ex=0x7fffe9423360) at /home/mike/Documents/PHP/php-src-php-7.2.2/Zend/zend_vm_execute.h:59749
#20 0x00007fffeae59583 in pthreads_execute_ex (data=0x7fffe9423360) at /home/mike/Documents/PHP/pthreads/php_pthreads.c:135
#21 0x0000555555f78edb in ZEND_DO_FCALL_SPEC_RETVAL_UNUSED_HANDLER () at /home/mike/Documents/PHP/php-src-php-7.2.2/Zend/zend_vm_execute.h:888
#22 0x0000555556005f10 in execute_ex (ex=0x7fffe9422ff0) at /home/mike/Documents/PHP/php-src-php-7.2.2/Zend/zend_vm_execute.h:59749
#23 0x00007fffeae59583 in pthreads_execute_ex (data=0x7fffe9422ff0) at /home/mike/Documents/PHP/pthreads/php_pthreads.c:135
#24 0x0000555555f7967c in ZEND_DO_FCALL_SPEC_RETVAL_USED_HANDLER () at /home/mike/Documents/PHP/php-src-php-7.2.2/Zend/zend_vm_execute.h:1013
#25 0x0000555556005f1d in execute_ex (ex=0x7fffe9422950) at /home/mike/Documents/PHP/php-src-php-7.2.2/Zend/zend_vm_execute.h:59752
#26 0x00007fffeae59583 in pthreads_execute_ex (data=0x7fffe9422950) at /home/mike/Documents/PHP/pthreads/php_pthreads.c:135
#27 0x0000555555f7967c in ZEND_DO_FCALL_SPEC_RETVAL_USED_HANDLER () at /home/mike/Documents/PHP/php-src-php-7.2.2/Zend/zend_vm_execute.h:1013
#28 0x0000555556005f1d in execute_ex (ex=0x7fffe9421e10) at /home/mike/Documents/PHP/php-src-php-7.2.2/Zend/zend_vm_execute.h:59752
#29 0x00007fffeae59583 in pthreads_execute_ex (data=0x7fffe9421e10) at /home/mike/Documents/PHP/pthreads/php_pthreads.c:135
#30 0x0000555555f7967c in ZEND_DO_FCALL_SPEC_RETVAL_USED_HANDLER () at /home/mike/Documents/PHP/php-src-php-7.2.2/Zend/zend_vm_execute.h:1013
#31 0x0000555556005f1d in execute_ex (ex=0x7fffe9421d10) at /home/mike/Documents/PHP/php-src-php-7.2.2/Zend/zend_vm_execute.h:59752
#32 0x00007fffeae59583 in pthreads_execute_ex (data=0x7fffe9421d10) at /home/mike/Documents/PHP/pthreads/php_pthreads.c:135
#33 0x0000555555f78edb in ZEND_DO_FCALL_SPEC_RETVAL_UNUSED_HANDLER () at /home/mike/Documents/PHP/php-src-php-7.2.2/Zend/zend_vm_execute.h:888
#34 0x0000555556005f10 in execute_ex (ex=0x7fffe9421c20) at /home/mike/Documents/PHP/php-src-php-7.2.2/Zend/zend_vm_execute.h:59749
#35 0x00007fffeae59583 in pthreads_execute_ex (data=0x7fffe9421c20) at /home/mike/Documents/PHP/pthreads/php_pthreads.c:135
#36 0x0000555555f7967c in ZEND_DO_FCALL_SPEC_RETVAL_USED_HANDLER () at /home/mike/Documents/PHP/php-src-php-7.2.2/Zend/zend_vm_execute.h:1013
#37 0x0000555556005f1d in execute_ex (ex=0x7fffe94218c0) at /home/mike/Documents/PHP/php-src-php-7.2.2/Zend/zend_vm_execute.h:59752
#38 0x00007fffeae59583 in pthreads_execute_ex (data=0x7fffe94218c0) at /home/mike/Documents/PHP/pthreads/php_pthreads.c:135
#39 0x0000555555f7967c in ZEND_DO_FCALL_SPEC_RETVAL_USED_HANDLER () at /home/mike/Documents/PHP/php-src-php-7.2.2/Zend/zend_vm_execute.h:1013
#40 0x0000555556005f1d in execute_ex (ex=0x7fffe9421280) at /home/mike/Documents/PHP/php-src-php-7.2.2/Zend/zend_vm_execute.h:59752
#41 0x00007fffeae59583 in pthreads_execute_ex (data=0x7fffe9421280) at /home/mike/Documents/PHP/pthreads/php_pthreads.c:135
#42 0x0000555555f7967c in ZEND_DO_FCALL_SPEC_RETVAL_USED_HANDLER () at /home/mike/Documents/PHP/php-src-php-7.2.2/Zend/zend_vm_execute.h:1013
#43 0x0000555556005f1d in execute_ex (ex=0x7fffe9421030) at /home/mike/Documents/PHP/php-src-php-7.2.2/Zend/zend_vm_execute.h:59752
#44 0x00007fffeae59583 in pthreads_execute_ex (data=0x7fffe9421030) at /home/mike/Documents/PHP/pthreads/php_pthreads.c:135
#45 0x0000555555eec3a6 in zend_call_function (fci=0x7fffe9ffeb80, fci_cache=0x7fffe9ffebb8) at /home/mike/Documents/PHP/php-src-php-7.2.2/Zend/zend_execute_API.c:819
#46 0x00007fffeae6e019 in pthreads_routine_run_function (object=0x7fffeadc5900, connection=0x7fffe946c900, work=0x7fffe9ffed00) at /home/mike/Documents/PHP/pthreads/src/object.c:481
#47 0x00007fffeae6e3a0 in pthreads_routine (routine=0x7fffffffad70) at /home/mike/Documents/PHP/pthreads/src/object.c:516
#48 0x00007ffff5e9e6db in start_thread (arg=0x7fffe9fff700) at pthread_create.c:463
---Type <return> to continue, or q <return> to quit---
#49 0x00007ffff3cc088f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
...