swoole-src icon indicating copy to clipboard operation
swoole-src copied to clipboard

启动http server后,发起请求无响应

Open GetLuckyBox opened this issue 3 years ago • 18 comments

Please answer these questions before submitting your issue.

  1. What did you do? If possible, provide a simple script for reproducing the error.

  2. What did you expect to see?

hyperf框架启动后,访问http://127.0.0.1:9501 可以正常响应

  1. What did you see instead?

hyperf框架启动后,访问http://127.0.0.1:9501 无响应 strace -p master进程下线程出现 flock(39, LOCK_EX

  1. What version of Swoole are you using (show your php --ri swoole)?

swoole

Swoole => enabled Author => Swoole Team [email protected] Version => 4.8.5 Built => Jun 16 2022 17:50:43 coroutine => enabled with boost asm context epoll => enabled eventfd => enabled signalfd => enabled cpu_affinity => enabled spinlock => enabled rwlock => enabled openssl => OpenSSL 1.1.1n 15 Mar 2022 dtls => enabled http2 => enabled curl-native => enabled zlib => 1.2.11 mutex_timedlock => enabled pthread_barrier => enabled futex => enabled mysqlnd => enabled async_redis => enabled

Directive => Local Value => Master Value swoole.enable_coroutine => On => On swoole.enable_library => On => On swoole.enable_preemptive_scheduler => Off => Off swoole.display_errors => On => On swoole.use_shortname => Off => Off swoole.unixsock_buffer_size => 8388608 => 8388608

  1. What is your machine environment used (show your uname -a & php -v & gcc -v) ?

Linux e3625cc15baa 5.10.16.3-microsoft-standard-WSL2 #1 SMP Fri Apr 2 22:23:49 UTC 2021 x86_64 GNU/Linux

PHP 7.4.27 (cli) (built: Dec 21 2021 21:31:45) ( NTS ) Copyright (c) The PHP Group Zend Engine v3.4.0, Copyright (c) Zend Technologies

Using built-in specs. COLLECT_GCC=gcc COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/10/lto-wrapper OFFLOAD_TARGET_NAMES=nvptx-none:amdgcn-amdhsa:hsa OFFLOAD_TARGET_DEFAULT=1 Target: x86_64-linux-gnu Configured with: ../src/configure -v --with-pkgversion='Debian 10.2.1-6' --with-bugurl=file:///usr/share/doc/gcc-10/README.Bugs --enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++,m2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-10 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-bootstrap --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib --enable-libphobos-checking=release --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none=/build/gcc-10-Km9U7s/gcc-10-10.2.1/debian/tmp-nvptx/usr,amdgcn-amdhsa=/build/gcc-10-Km9U7s/gcc-10-10.2.1/debian/tmp-gcn/usr,hsa --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu --with-build-config=bootstrap-lto-lean --enable-link-mutex Thread model: posix Supported LTO compression algorithms: zlib zstd gcc version 10.2.1 20210110 (Debian 10.2.1-6)

GetLuckyBox avatar Sep 01 '22 13:09 GetLuckyBox

ps -eLlf |grep moac_serve

0 S root     31610 27471 31610  0    3  80   0 - 71927 -      16:39 pts/4    00:00:00 moac_server.Master
1 S root     31610 27471 31625  0    3  80   0 - 71927 locks_ 16:40 pts/4    00:00:00 moac_server.Master
1 S root     31610 27471 31626  0    3  80   0 - 71927 locks_ 16:40 pts/4    00:00:00 moac_server.Master

GetLuckyBox avatar Sep 01 '22 13:09 GetLuckyBox

strace -p

strace: Process 31626 attached
flock(39, LOCK_EX
strace: Process 31625 attached
flock(39, LOCK_EX

GetLuckyBox avatar Sep 01 '22 13:09 GetLuckyBox

gdb attach 31626

root@e3625cc15baa:/var/www/html# gdb attach 31625
GNU gdb (Debian 8.2.1-2+b3) 8.2.1
Copyright (C) 2018 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-linux-gnu".
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"...
attach: No such file or directory.
Attaching to process 31625
warning: process 31625 is already traced by process 32054
ptrace: Operation not permitted.
/var/www/html/31625: No such file or directory.
(gdb) quir
Undefined command: "quir".  Try "help".
(gdb) quit
root@e3625cc15baa:/var/www/html# gdb attach 31626
GNU gdb (Debian 8.2.1-2+b3) 8.2.1
Copyright (C) 2018 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-linux-gnu".
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"...
attach: No such file or directory.
Attaching to process 31626
Reading symbols from /usr/local/bin/php...(no debugging symbols found)...done.
Reading symbols from /usr/lib/x86_64-linux-gnu/libargon2.so.1...(no debugging symbols found)...done.
Reading symbols from /lib/x86_64-linux-gnu/libresolv.so.2...(no debugging symbols found)...done.
Reading symbols from /lib/x86_64-linux-gnu/libreadline.so.8...(no debugging symbols found)...done.
Reading symbols from /lib/x86_64-linux-gnu/libm.so.6...(no debugging symbols found)...done.
Reading symbols from /lib/x86_64-linux-gnu/libdl.so.2...(no debugging symbols found)...done.
Reading symbols from /usr/lib/x86_64-linux-gnu/libxml2.so.2...(no debugging symbols found)...done.
Reading symbols from /usr/lib/x86_64-linux-gnu/libssl.so.1.1...(no debugging symbols found)...done.
Reading symbols from /usr/lib/x86_64-linux-gnu/libcrypto.so.1.1...(no debugging symbols found)...done.
Reading symbols from /usr/lib/x86_64-linux-gnu/libsqlite3.so.0...(no debugging symbols found)...done.
Reading symbols from /lib/x86_64-linux-gnu/libz.so.1...(no debugging symbols found)...done.
Reading symbols from /usr/lib/x86_64-linux-gnu/libcurl.so.4...(no debugging symbols found)...done.
Reading symbols from /usr/lib/x86_64-linux-gnu/libonig.so.5...(no debugging symbols found)...done.
Reading symbols from /lib/x86_64-linux-gnu/libc.so.6...(no debugging symbols found)...done.
Reading symbols from /lib/x86_64-linux-gnu/libpthread.so.0...(no debugging symbols found)...done.
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
Reading symbols from /lib/x86_64-linux-gnu/libtinfo.so.6...(no debugging symbols found)...done.
Reading symbols from /lib64/ld-linux-x86-64.so.2...(no debugging symbols found)...done.
Reading symbols from /usr/lib/x86_64-linux-gnu/libicuuc.so.67...(no debugging symbols found)...done.
Reading symbols from /lib/x86_64-linux-gnu/liblzma.so.5...(no debugging symbols found)...done.
Reading symbols from /usr/lib/x86_64-linux-gnu/libnghttp2.so.14...(no debugging symbols found)...done.
Reading symbols from /usr/lib/x86_64-linux-gnu/libidn2.so.0...(no debugging symbols found)...done.
Reading symbols from /usr/lib/x86_64-linux-gnu/librtmp.so.1...(no debugging symbols found)...done.
Reading symbols from /usr/lib/x86_64-linux-gnu/libssh2.so.1...(no debugging symbols found)...done.
Reading symbols from /usr/lib/x86_64-linux-gnu/libpsl.so.5...(no debugging symbols found)...done.
Reading symbols from /usr/lib/x86_64-linux-gnu/libgssapi_krb5.so.2...(no debugging symbols found)...done.
Reading symbols from /usr/lib/x86_64-linux-gnu/libkrb5.so.3...(no debugging symbols found)...done.
Reading symbols from /usr/lib/x86_64-linux-gnu/libk5crypto.so.3...(no debugging symbols found)...done.
Reading symbols from /lib/x86_64-linux-gnu/libcom_err.so.2...(no debugging symbols found)...done.
Reading symbols from /usr/lib/x86_64-linux-gnu/libldap_r-2.4.so.2...(no debugging symbols found)...done.
Reading symbols from /usr/lib/x86_64-linux-gnu/liblber-2.4.so.2...(no debugging symbols found)...done.
Reading symbols from /usr/lib/x86_64-linux-gnu/libicudata.so.67...(no debugging symbols found)...done.
Reading symbols from /usr/lib/x86_64-linux-gnu/libstdc++.so.6...(no debugging symbols found)...done.
Reading symbols from /lib/x86_64-linux-gnu/libgcc_s.so.1...(no debugging symbols found)...done.
Reading symbols from /usr/lib/x86_64-linux-gnu/libunistring.so.2...(no debugging symbols found)...done.
Reading symbols from /usr/lib/x86_64-linux-gnu/libgnutls.so.30...(no debugging symbols found)...done.
Reading symbols from /usr/lib/x86_64-linux-gnu/libhogweed.so.6...(no debugging symbols found)...done.
Reading symbols from /usr/lib/x86_64-linux-gnu/libnettle.so.8...(no debugging symbols found)...done.
Reading symbols from /usr/lib/x86_64-linux-gnu/libgmp.so.10...(no debugging symbols found)...done.
Reading symbols from /usr/lib/x86_64-linux-gnu/libgcrypt.so.20...(no debugging symbols found)...done.
Reading symbols from /usr/lib/x86_64-linux-gnu/libkrb5support.so.0...(no debugging symbols found)...done.
Reading symbols from /lib/x86_64-linux-gnu/libkeyutils.so.1...(no debugging symbols found)...done.
Reading symbols from /usr/lib/x86_64-linux-gnu/libsasl2.so.2...(no debugging symbols found)...done.
Reading symbols from /usr/lib/x86_64-linux-gnu/libp11-kit.so.0...(no debugging symbols found)...done.
Reading symbols from /usr/lib/x86_64-linux-gnu/libtasn1.so.6...(no debugging symbols found)...done.
Reading symbols from /lib/x86_64-linux-gnu/libgpg-error.so.0...(no debugging symbols found)...done.
Reading symbols from /usr/lib/x86_64-linux-gnu/libffi.so.7...(no debugging symbols found)...done.
Reading symbols from /usr/local/lib/php/extensions/no-debug-non-zts-20190902/bcmath.so...(no debugging symbols found)...done.
Reading symbols from /usr/local/lib/php/extensions/no-debug-non-zts-20190902/mongodb.so...done.
Reading symbols from /usr/local/lib/php/extensions/no-debug-non-zts-20190902/mysqli.so...(no debugging symbols found)...done.
Reading symbols from /usr/local/lib/php/extensions/no-debug-non-zts-20190902/pcntl.so...(no debugging symbols found)...done.
Reading symbols from /usr/local/lib/php/extensions/no-debug-non-zts-20190902/pdo_mysql.so...(no debugging symbols found)...done.
Reading symbols from /usr/local/lib/php/extensions/no-debug-non-zts-20190902/redis.so...done.
Reading symbols from /usr/local/lib/php/extensions/no-debug-non-zts-20190902/sockets.so...(no debugging symbols found)...done.
Reading symbols from /usr/local/lib/php/extensions/no-debug-non-zts-20190902/sodium.so...(no debugging symbols found)...done.
Reading symbols from /usr/lib/x86_64-linux-gnu/libsodium.so.23...(no debugging symbols found)...done.
Reading symbols from /usr/local/lib/php/extensions/no-debug-non-zts-20190902/swoole.so...done.
Reading symbols from /usr/local/lib/php/extensions/no-debug-non-zts-20190902/zip.so...(no debugging symbols found)...done.
Reading symbols from /usr/lib/x86_64-linux-gnu/libzip.so.4...(no debugging symbols found)...done.
Reading symbols from /lib/x86_64-linux-gnu/libbz2.so.1.0...(no debugging symbols found)...done.
0x00007f41d2814427 in flock () from /lib/x86_64-linux-gnu/libc.so.6

GetLuckyBox avatar Sep 01 '22 13:09 GetLuckyBox

gdb attach 31625

root@e3625cc15baa:/var/www/html# gdb attach 31625
GNU gdb (Debian 8.2.1-2+b3) 8.2.1
Copyright (C) 2018 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-linux-gnu".
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"...
attach: No such file or directory.
Attaching to process 31625
Reading symbols from /usr/local/bin/php...(no debugging symbols found)...done.
Reading symbols from /usr/lib/x86_64-linux-gnu/libargon2.so.1...(no debugging symbols found)...done.
Reading symbols from /lib/x86_64-linux-gnu/libresolv.so.2...(no debugging symbols found)...done.
Reading symbols from /lib/x86_64-linux-gnu/libreadline.so.8...(no debugging symbols found)...done.
Reading symbols from /lib/x86_64-linux-gnu/libm.so.6...(no debugging symbols found)...done.
Reading symbols from /lib/x86_64-linux-gnu/libdl.so.2...(no debugging symbols found)...done.
Reading symbols from /usr/lib/x86_64-linux-gnu/libxml2.so.2...(no debugging symbols found)...done.
Reading symbols from /usr/lib/x86_64-linux-gnu/libssl.so.1.1...(no debugging symbols found)...done.
Reading symbols from /usr/lib/x86_64-linux-gnu/libcrypto.so.1.1...(no debugging symbols found)...done.
Reading symbols from /usr/lib/x86_64-linux-gnu/libsqlite3.so.0...(no debugging symbols found)...done.
Reading symbols from /lib/x86_64-linux-gnu/libz.so.1...(no debugging symbols found)...done.
Reading symbols from /usr/lib/x86_64-linux-gnu/libcurl.so.4...(no debugging symbols found)...done.
Reading symbols from /usr/lib/x86_64-linux-gnu/libonig.so.5...(no debugging symbols found)...done.
Reading symbols from /lib/x86_64-linux-gnu/libc.so.6...(no debugging symbols found)...done.
Reading symbols from /lib/x86_64-linux-gnu/libpthread.so.0...(no debugging symbols found)...done.
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
Reading symbols from /lib/x86_64-linux-gnu/libtinfo.so.6...(no debugging symbols found)...done.
Reading symbols from /lib64/ld-linux-x86-64.so.2...(no debugging symbols found)...done.
Reading symbols from /usr/lib/x86_64-linux-gnu/libicuuc.so.67...(no debugging symbols found)...done.
Reading symbols from /lib/x86_64-linux-gnu/liblzma.so.5...(no debugging symbols found)...done.
Reading symbols from /usr/lib/x86_64-linux-gnu/libnghttp2.so.14...(no debugging symbols found)...done.
Reading symbols from /usr/lib/x86_64-linux-gnu/libidn2.so.0...(no debugging symbols found)...done.
Reading symbols from /usr/lib/x86_64-linux-gnu/librtmp.so.1...(no debugging symbols found)...done.
Reading symbols from /usr/lib/x86_64-linux-gnu/libssh2.so.1...(no debugging symbols found)...done.
Reading symbols from /usr/lib/x86_64-linux-gnu/libpsl.so.5...(no debugging symbols found)...done.
Reading symbols from /usr/lib/x86_64-linux-gnu/libgssapi_krb5.so.2...(no debugging symbols found)...done.
Reading symbols from /usr/lib/x86_64-linux-gnu/libkrb5.so.3...(no debugging symbols found)...done.
Reading symbols from /usr/lib/x86_64-linux-gnu/libk5crypto.so.3...(no debugging symbols found)...done.
Reading symbols from /lib/x86_64-linux-gnu/libcom_err.so.2...(no debugging symbols found)...done.
Reading symbols from /usr/lib/x86_64-linux-gnu/libldap_r-2.4.so.2...(no debugging symbols found)...done.
Reading symbols from /usr/lib/x86_64-linux-gnu/liblber-2.4.so.2...(no debugging symbols found)...done.
Reading symbols from /usr/lib/x86_64-linux-gnu/libicudata.so.67...(no debugging symbols found)...done.
Reading symbols from /usr/lib/x86_64-linux-gnu/libstdc++.so.6...(no debugging symbols found)...done.
Reading symbols from /lib/x86_64-linux-gnu/libgcc_s.so.1...(no debugging symbols found)...done.
Reading symbols from /usr/lib/x86_64-linux-gnu/libunistring.so.2...(no debugging symbols found)...done.
Reading symbols from /usr/lib/x86_64-linux-gnu/libgnutls.so.30...(no debugging symbols found)...done.
Reading symbols from /usr/lib/x86_64-linux-gnu/libhogweed.so.6...(no debugging symbols found)...done.
Reading symbols from /usr/lib/x86_64-linux-gnu/libnettle.so.8...(no debugging symbols found)...done.
Reading symbols from /usr/lib/x86_64-linux-gnu/libgmp.so.10...(no debugging symbols found)...done.
Reading symbols from /usr/lib/x86_64-linux-gnu/libgcrypt.so.20...(no debugging symbols found)...done.
Reading symbols from /usr/lib/x86_64-linux-gnu/libkrb5support.so.0...(no debugging symbols found)...done.
Reading symbols from /lib/x86_64-linux-gnu/libkeyutils.so.1...(no debugging symbols found)...done.
Reading symbols from /usr/lib/x86_64-linux-gnu/libsasl2.so.2...(no debugging symbols found)...done.
Reading symbols from /usr/lib/x86_64-linux-gnu/libp11-kit.so.0...(no debugging symbols found)...done.
Reading symbols from /usr/lib/x86_64-linux-gnu/libtasn1.so.6...(no debugging symbols found)...done.
Reading symbols from /lib/x86_64-linux-gnu/libgpg-error.so.0...(no debugging symbols found)...done.
Reading symbols from /usr/lib/x86_64-linux-gnu/libffi.so.7...(no debugging symbols found)...done.
Reading symbols from /usr/local/lib/php/extensions/no-debug-non-zts-20190902/bcmath.so...(no debugging symbols found)...done.
Reading symbols from /usr/local/lib/php/extensions/no-debug-non-zts-20190902/mongodb.so...done.
Reading symbols from /usr/local/lib/php/extensions/no-debug-non-zts-20190902/mysqli.so...(no debugging symbols found)...done.
Reading symbols from /usr/local/lib/php/extensions/no-debug-non-zts-20190902/pcntl.so...(no debugging symbols found)...done.
Reading symbols from /usr/local/lib/php/extensions/no-debug-non-zts-20190902/pdo_mysql.so...(no debugging symbols found)...done.
Reading symbols from /usr/local/lib/php/extensions/no-debug-non-zts-20190902/redis.so...done.
Reading symbols from /usr/local/lib/php/extensions/no-debug-non-zts-20190902/sockets.so...(no debugging symbols found)...done.
Reading symbols from /usr/local/lib/php/extensions/no-debug-non-zts-20190902/sodium.so...(no debugging symbols found)...done.
Reading symbols from /usr/lib/x86_64-linux-gnu/libsodium.so.23...(no debugging symbols found)...done.
Reading symbols from /usr/local/lib/php/extensions/no-debug-non-zts-20190902/swoole.so...done.
Reading symbols from /usr/local/lib/php/extensions/no-debug-non-zts-20190902/zip.so...(no debugging symbols found)...done.
Reading symbols from /usr/lib/x86_64-linux-gnu/libzip.so.4...(no debugging symbols found)...done.
Reading symbols from /lib/x86_64-linux-gnu/libbz2.so.1.0...(no debugging symbols found)...done.
0x00007f41d2814427 in flock () from /lib/x86_64-linux-gnu/libc.so.6

GetLuckyBox avatar Sep 01 '22 13:09 GetLuckyBox

需要看一下代码,有可能是因为死锁的缘故

NathanFreeman avatar Sep 01 '22 13:09 NathanFreeman

现象是偶发的,ctrl+c 掉重启就是正常的。

GetLuckyBox avatar Sep 01 '22 13:09 GetLuckyBox

需要看一下代码,有可能是因为死锁的缘故

所有的自定义进程都能正常工作,reactor 线程出的问题。跟我代码没关系吧?

GetLuckyBox avatar Sep 01 '22 13:09 GetLuckyBox

更新 4.8.11 再看是否还有问题

Yurunsoft avatar Sep 01 '22 13:09 Yurunsoft

需要看一下代码,有可能是因为死锁的缘故

所有的自定义进程都能正常工作,reactor 线程出的问题。跟我代码没关系吧?

有可能是因为线程池全部陷入锁冲突,导致worker进程没法投递任务。

NathanFreeman avatar Sep 01 '22 13:09 NathanFreeman

更新 4.8.11 再看是否还有问题

还未更新,生产环境是k8s,问题出现在偶然一次弹性扩容后,发现端口起来了但是客户端发起的部分请求无响应。

GetLuckyBox avatar Sep 01 '22 13:09 GetLuckyBox

我似乎看到了mongodb。。。也许是这个引起的死锁?

Yurunsoft avatar Sep 01 '22 13:09 Yurunsoft

我似乎看到了mongodb。。。也许是这个引起的死锁?

为何怀疑mongodb引起死锁呢?

GetLuckyBox avatar Sep 01 '22 13:09 GetLuckyBox

mongodb扩展不支持swoole协程化,有死锁可能,当然只是怀疑

Yurunsoft avatar Sep 01 '22 13:09 Yurunsoft

mongodb扩展不支持swoole协程化,有死锁可能,当然只是怀疑

自定义进程里面的mongoDb client 还能正常工作

epoll_wait(32, [{EPOLLIN, {u32=1501731952, u64=94619631262832}}], 4096, 6588) = 1
epoll_ctl(32, EPOLL_CTL_DEL, 36, NULL)  = 0
recvfrom(36, "*-1\r\n", 8192, 0, NULL, NULL) = 5
getpid()                                = 31631
poll([{fd=35, events=POLLOUT|POLLERR|POLLHUP}], 1, 10000) = 1 ([{fd=35, revents=POLLOUT}])
sendmsg(35, {msg_name=NULL, msg_namelen=0, msg_iov=[{iov_base="A\0\0\0", iov_len=4}, {iov_base="\17\0\0\0", iov_len=4}, {iov_base="\0\0\0\0", iov_len=4}, {iov_base="\324\7\0\0", iov_len=4}, {iov_base="\4\0\0\0", iov_len=4}, {iov_base="admin.$cmd\0", iov_len=11}, {iov_base="\0\0\0\0", iov_len=4}, {iov_base="\377\377\377\377", iov_len=4}, {iov_base="\32\0\0\0\20hello\0\1\0\0\0\10helloOk\0\1\0", iov_len=26}], msg_iovlen=9, msg_controllen=0, msg_flags=0}, MSG_NOSIGNAL) = 65
poll([{fd=35, events=POLLIN|POLLERR|POLLHUP}], 1, 9998) = 1 ([{fd=35, revents=POLLIN}])
recvfrom(35, "R\1\0\0", 4, 0, NULL, NULL) = 4
recvfrom(35, "\2430\2\0\17\0\0\0\1\0\0\0\10\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\1\0\0\0"..., 334, 0, NULL, NULL) = 334
brk(0x560e59853000)                     = 0x560e59853000
getpid()                                = 31631
sendmsg(35, {msg_name=NULL, msg_namelen=0, msg_iov=[{iov_base="\236\5\0\0", iov_len=4}, {iov_base="0\0\0\0", iov_len=4}, {iov_base="\0\0\0\0", iov_len=4}, {iov_base="\335\7\0\0", iov_len=4}, {iov_base="\0\0\0\0", iov_len=4}, {iov_base="\0", iov_len=1}, {iov_base="\241\0\0\0\2insert\0\26\0\0\0access_log_2022_"..., iov_len=161}, {iov_base="\1", iov_len=1}, {iov_base="\347\4\0\0", iov_len=4}, {iov_base="documents\0", iov_len=10}, {iov_base="\331\4\0\0\2ip\0\v\0\0\000172.18.0.1\0\2uid\0\23\0\0\0"..., iov_len=1241}], msg_iovlen=11, msg_controllen=0, msg_flags=0}, MSG_NOSIGNAL) = 1438
recvfrom(35, 0x560e598327d0, 4, 0, NULL, NULL) = -1 EAGAIN (Resource temporarily unavailable)
poll([{fd=35, events=POLLIN|POLLERR|POLLHUP}], 1, 299999) = 1 ([{fd=35, revents=POLLIN}])
recvfrom(35, "-\0\0\0", 4, 0, NULL, NULL) = 4
recvfrom(35, "\2450\2\0000\0\0\0\335\7\0\0\0\0\0\0\0\30\0\0\0\20n\0\1\0\0\0\1ok\0"..., 41, 0, NULL, NULL) = 41
recvfrom(36, 0x7f41cb80ab0f, 1, MSG_PEEK|MSG_DONTWAIT, NULL, NULL) = -1 EAGAIN (Resource temporarily unavailable)
sendto(36, "*3\r\n$5\r\nBRPOP\r\n$7\r\nlog:rl_\r\n$1\r\n"..., 35, 0, NULL, 0) = 35
recvfrom(36, 0x7f41cb809a9f, 1, MSG_PEEK|MSG_DONTWAIT, NULL, NULL) = -1 EAGAIN (Resource temporarily unavailable)
recvfrom(36, 0x7f41ce753000, 8192, 0, NULL, NULL) = -1 EAGAIN (Resource temporarily unavailable)
epoll_ctl(32, EPOLL_CTL_ADD, 36, {EPOLLIN, {u32=1501731952, u64=94619631262832}}) = 0

GetLuckyBox avatar Sep 02 '22 01:09 GetLuckyBox

mongodb扩展不支持swoole协程化,有死锁可能,当然只是怀疑

自定义进程里面的mongoDb client 还能正常工作

epoll_wait(32, [{EPOLLIN, {u32=1501731952, u64=94619631262832}}], 4096, 6588) = 1
epoll_ctl(32, EPOLL_CTL_DEL, 36, NULL)  = 0
recvfrom(36, "*-1\r\n", 8192, 0, NULL, NULL) = 5
getpid()                                = 31631
poll([{fd=35, events=POLLOUT|POLLERR|POLLHUP}], 1, 10000) = 1 ([{fd=35, revents=POLLOUT}])
sendmsg(35, {msg_name=NULL, msg_namelen=0, msg_iov=[{iov_base="A\0\0\0", iov_len=4}, {iov_base="\17\0\0\0", iov_len=4}, {iov_base="\0\0\0\0", iov_len=4}, {iov_base="\324\7\0\0", iov_len=4}, {iov_base="\4\0\0\0", iov_len=4}, {iov_base="admin.$cmd\0", iov_len=11}, {iov_base="\0\0\0\0", iov_len=4}, {iov_base="\377\377\377\377", iov_len=4}, {iov_base="\32\0\0\0\20hello\0\1\0\0\0\10helloOk\0\1\0", iov_len=26}], msg_iovlen=9, msg_controllen=0, msg_flags=0}, MSG_NOSIGNAL) = 65
poll([{fd=35, events=POLLIN|POLLERR|POLLHUP}], 1, 9998) = 1 ([{fd=35, revents=POLLIN}])
recvfrom(35, "R\1\0\0", 4, 0, NULL, NULL) = 4
recvfrom(35, "\2430\2\0\17\0\0\0\1\0\0\0\10\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\1\0\0\0"..., 334, 0, NULL, NULL) = 334
brk(0x560e59853000)                     = 0x560e59853000
getpid()                                = 31631
sendmsg(35, {msg_name=NULL, msg_namelen=0, msg_iov=[{iov_base="\236\5\0\0", iov_len=4}, {iov_base="0\0\0\0", iov_len=4}, {iov_base="\0\0\0\0", iov_len=4}, {iov_base="\335\7\0\0", iov_len=4}, {iov_base="\0\0\0\0", iov_len=4}, {iov_base="\0", iov_len=1}, {iov_base="\241\0\0\0\2insert\0\26\0\0\0access_log_2022_"..., iov_len=161}, {iov_base="\1", iov_len=1}, {iov_base="\347\4\0\0", iov_len=4}, {iov_base="documents\0", iov_len=10}, {iov_base="\331\4\0\0\2ip\0\v\0\0\000172.18.0.1\0\2uid\0\23\0\0\0"..., iov_len=1241}], msg_iovlen=11, msg_controllen=0, msg_flags=0}, MSG_NOSIGNAL) = 1438
recvfrom(35, 0x560e598327d0, 4, 0, NULL, NULL) = -1 EAGAIN (Resource temporarily unavailable)
poll([{fd=35, events=POLLIN|POLLERR|POLLHUP}], 1, 299999) = 1 ([{fd=35, revents=POLLIN}])
recvfrom(35, "-\0\0\0", 4, 0, NULL, NULL) = 4
recvfrom(35, "\2450\2\0000\0\0\0\335\7\0\0\0\0\0\0\0\30\0\0\0\20n\0\1\0\0\0\1ok\0"..., 41, 0, NULL, NULL) = 41
recvfrom(36, 0x7f41cb80ab0f, 1, MSG_PEEK|MSG_DONTWAIT, NULL, NULL) = -1 EAGAIN (Resource temporarily unavailable)
sendto(36, "*3\r\n$5\r\nBRPOP\r\n$7\r\nlog:rl_\r\n$1\r\n"..., 35, 0, NULL, 0) = 35
recvfrom(36, 0x7f41cb809a9f, 1, MSG_PEEK|MSG_DONTWAIT, NULL, NULL) = -1 EAGAIN (Resource temporarily unavailable)
recvfrom(36, 0x7f41ce753000, 8192, 0, NULL, NULL) = -1 EAGAIN (Resource temporarily unavailable)
epoll_ctl(32, EPOLL_CTL_ADD, 36, {EPOLLIN, {u32=1501731952, u64=94619631262832}}) = 0

\241\0\0\0\2insert\0\26\0\0\0access_log_2022_

GetLuckyBox avatar Sep 02 '22 01:09 GetLuckyBox

gdb attch 之后输入 bt 查看堆栈。flock 表示等待文件锁,进程发生了死锁问题,需要分析一下死锁原因

matyhtf avatar Sep 08 '22 08:09 matyhtf

gdb attch 之后输入 bt 查看堆栈。flock 表示等待文件锁,进程发生了死锁问题,需要分析一下死锁原因

#0 0x00007fb77fd7c427 in flock () from /lib/x86_64-linux-gnu/libc.so.6 #1 0x00007fb77cc3f349 in swoole::Logger::put (this=this@entry=0x55f99020be30, level=level@entry=1, content=0x7fb770000ba0 "Port_onRead_http() (ERRNO 7102): Bad Request: unknown protocol from session#1 on 0.0.0.0:9501", length=length@entry=93) at /tmp/pear/temp/swoole/src/core/log.cc:330 #2 0x00007fb77cc9d9f4 in swoole::Port_onRead_http (reactor=0x7fb770014c20, port=, event=0x7fb778e0cac0) at /tmp/pear/temp/swoole/src/server/port.cc:572 #3 0x00007fb77cca5d64 in swoole::ReactorThread_onRead (reactor=0x7fb770014c20, event=0x7fb778e0cac0) at /tmp/pear/temp/swoole/src/server/reactor_thread.cc:559 #4 0x00007fb77cc86eee in swoole::ReactorEpoll::wait (this=0x7fb7700150c0, timeo=) at /tmp/pear/temp/swoole/src/reactor/epoll.cc:199 #5 0x00007fb77ccae870 in swoole::Reactor::wait (timeout=0x0, this=) at /tmp/pear/temp/swoole/include/swoole_reactor.h:165 #6 swoole_event_wait () at /tmp/pear/temp/swoole/src/wrapper/event.cc:88 #7 0x00007fb77cca510b in swoole::ReactorThread_loop (serv=0x55f99032dac0, reactor_id=0) at /tmp/pear/temp/swoole/src/server/reactor_thread.cc:881 #8 0x00007fb77db8ded0 in ?? () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6 #9 0x00007fb77fc73ea7 in start_thread () from /lib/x86_64-linux-gnu/libpthread.so.0 #10 0x00007fb77fd8adef in clone () from /lib/x86_64-linux-gnu/libc.so.6

早上用Coroutine\Http\Client 开启ssl请求了下9501端口无响应,gdb 之后输入bt 得到以上结果 运行环境相关配置在一楼 升级到4.8.11后启动项目,然后使用Chrome访问https://127.0.0.1:9501/ 还是能复现 运行环境是win10+docker(有挂载目录)

GetLuckyBox avatar Sep 16 '22 01:09 GetLuckyBox

@GetLuckyBox 请使用 4.8.12 版本进行测试,已解决此问题。

matyhtf avatar Sep 21 '22 11:09 matyhtf