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

向主进程发送SIGTERM信号出出段错误

Open bobyang007 opened this issue 2 years ago • 3 comments

Please answer these questions before submitting your issue.

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

向主进程发送15信号后(会有10到18秒不定的暂停)然后输出core错误文件

  1. What did you expect to see?

正常退出,没有暂停时间,不输出段异常

  1. What did you see instead?
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
Core was generated by `swoole: queue [de'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0  0x00007f94b5f47831 in swoole::Heap::pop (this=this@entry=0x55731caf9248) at /dbdata/dev/u22/swoole-src-5.1.0/src/core/heap.cc:141
141         nodes[1] = nodes[--num];
[Current thread is 1 (Thread 0x7f94bcc60980 (LWP 4226))]
(gdb) bt
#0  0x00007f94b5f47831 in swoole::Heap::pop (this=this@entry=0x55731caf9248) at /dbdata/dev/u22/swoole-src-5.1.0/src/core/heap.cc:141
#1  0x00007f94b5f4a154 in swoole::Timer::select (this=0x55731caf9240) at /dbdata/dev/u22/swoole-src-5.1.0/src/core/timer.cc:226
#2  0x00007f94b5f9bde5 in std::function<void (swoole::Reactor*)>::operator()(swoole::Reactor*) const (__args#0=<optimized out>, this=0x55731cafb318) at /usr/include/c++/11/bits/std_function.h:590
#3  swoole::Reactor::execute_end_callbacks (this=0x55731caecb70, timedout=timedout@entry=true) at /dbdata/dev/u22/swoole-src-5.1.0/src/reactor/base.cc:403
#4  0x00007f94b5f9d755 in swoole::ReactorEpoll::wait (this=0x55731caeb130, timeo=<optimized out>) at /dbdata/dev/u22/swoole-src-5.1.0/src/reactor/epoll.cc:184
#5  0x00007f94b5fc7292 in swoole::Reactor::wait (timeout=0x0, this=0x55731caecb70) at /dbdata/dev/u22/swoole-src-5.1.0/include/swoole_reactor.h:163
#6  swoole_event_wait () at /dbdata/dev/u22/swoole-src-5.1.0/src/wrapper/event.cc:88
#7  0x00007f94b5f82fc1 in swoole::ProcessPool::spawn (this=0x7f94b41b6900, worker=0x7f94b58bc8a0) at /dbdata/dev/u22/swoole-src-5.1.0/src/os/process_pool.cc:473
#8  0x00007f94b5f832eb in swoole::ProcessPool::start (this=this@entry=0x7f94b41b6900) at /dbdata/dev/u22/swoole-src-5.1.0/src/os/process_pool.cc:255
#9  0x00007f94b5ef42ce in zim_swoole_process_pool_start (execute_data=0x7f94bca14880, return_value=0x7ffc1fc762c0) at /dbdata/dev/u22/swoole-src-5.1.0/ext-src/swoole_process_pool.cc:524
#10 0x000055731bddd840 in execute_ex ()
#11 0x000055731bd64778 in zend_call_function ()
#12 0x000055731bc4eff0 in ?? ()
#13 0x000055731bddd102 in execute_ex ()
#14 0x000055731bdde199 in zend_execute ()
#15 0x000055731bd72710 in zend_execute_scripts ()
#16 0x000055731bd0da73 in php_execute_script ()
#17 0x000055731be03eed in ?? ()
#18 0x000055731bbc3c87 in ?? ()
#19 0x00007f94bed20d90 in __libc_start_call_main (main=main@entry=0x55731bbc38b0, argc=argc@entry=3, argv=argv@entry=0x7ffc1fc79f08) at ../sysdeps/nptl/libc_start_call_main.h:58
#20 0x00007f94bed20e40 in __libc_start_main_impl (main=0x55731bbc38b0, argc=3, argv=0x7ffc1fc79f08, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7ffc1fc79ef8)
    at ../csu/libc-start.c:392
#21 0x000055731bbc4de5 in _start ()
  1. What version of Swoole are you using (show your php --ri swoole)?

Swoole => enabled Author => Swoole Team [email protected] Version => 5.1.0 Built => Oct 6 2023 09:34:45 coroutine => enabled with thread context epoll => enabled eventfd => enabled signalfd => enabled cpu_affinity => enabled spinlock => enabled rwlock => enabled sockets => enabled openssl => OpenSSL 3.0.2 15 Mar 2022 dtls => enabled http2 => enabled json => enabled curl-native => enabled pcre => enabled c-ares => 1.18.1 zlib => 1.2.11 brotli => E16777225/D16777225 mutex_timedlock => enabled pthread_barrier => enabled futex => enabled mysqlnd => enabled async_redis => enabled coroutine_pgsql => enabled coroutine_odbc => enabled coroutine_sqlite => enabled

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

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

Linux fcce646ca833 5.18.17-amd64-desktop-hwe #20.01.00.01 SMP PREEMPT_DYNAMIC Tue Sep 13 11:35:10 CST 2022 x86_64 x86_64 x86_64 GNU/Linux

PHP 8.0.30 (cli) (built: Sep 2 2023 08:05:13) ( NTS ) Copyright (c) The PHP Group Zend Engine v4.0.30, Copyright (c) Zend Technologies with Zend OPcache v8.0.30, Copyright (c), by Zend Technologies

bobyang007 avatar Oct 06 '23 03:10 bobyang007

去掉 --enable-thread-context 编译选项,正常退出,且没有段错误异常

bobyang007 avatar Oct 06 '23 04:10 bobyang007

你这里有个定时器,你这个定时器是在哪个阶段设置的,可以的话提供一下可以复现的最小代码

NathanFreeman avatar Oct 07 '23 01:10 NathanFreeman

你这里有个定时器,你这个定时器是在哪个阶段设置的,可以的话提供一下可以复现的最小代码

框架是thinkphp(think-swoole)

bobyang007 avatar Oct 19 '23 06:10 bobyang007