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

Using stevebauman/purify with swoole and pre/code tags enabled crashes worker processes.

Open kolaente opened this issue 2 years ago • 4 comments

Please answer these questions before submitting your issue.

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

I've been using the purify library to sanitize html content. Once I added pre and code tags to the list of allowed html elements, the swoole process crashed. I'll try to pin it to where the problem was caused but didn't have any luck so far.

  1. What did you expect to see?

Sanitized html output.

  1. What did you see instead?

Swoole worker process crash, error message in the logs:

[2023-06-28 16:46:55 #30.0]	WARNING	Server::check_worker_exit_status(): worker(pid=146, id=10) abnormal exit, status=0, signal=11
  1. What version of Swoole are you using (show your php --ri swoole)?
root@2114b38e8450:/var/www# php --ri swoole

swoole

Swoole => enabled
Author => Swoole Team <[email protected]>
Version => 5.0.3
Built => Jun 26 2023 00:31:00
coroutine => enabled with boost asm context
epoll => enabled
eventfd => enabled
signalfd => enabled
cpu_affinity => enabled
spinlock => enabled
rwlock => enabled
http2 => enabled
json => enabled
pcre => enabled
zlib => 1.2.11
brotli => E16777225/D16777225
mutex_timedlock => enabled
pthread_barrier => enabled
futex => 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 => On => On
swoole.unixsock_buffer_size => 8388608 => 8388608

I'm using swoole with Laravel Octane.

  1. What is your machine environment used (show your uname -a & php -v & gcc -v) ?
  • OS: Docker (uname says Linux 6.1.34 #1-NixOS SMP PREEMPT_DYNAMIC Wed Jun 14 09:15:34 UTC 2023 x86_64)
  • GCC_VERSION: 10.2.1 20210110
  • PHP_VERSION : 8.2.7

kolaente avatar Jun 28 '23 16:06 kolaente

I will test it later.

NathanFreeman avatar Jun 29 '23 01:06 NathanFreeman

@kolaente Hi. I can not reproduce it. Could you please use valgrind to track your program? Have you used the xdebug extension?

NathanFreeman avatar Jul 04 '23 02:07 NathanFreeman

Could you please use valgrind to track your program?

How do I do that?

Have you used the xdebug extension?

I didn't use it.

kolaente avatar Jul 04 '23 07:07 kolaente

Sorry, I hase made a mistake, use gdb to track your program.

ps aux | grep swoole

图片

gdb attach 651337

And now executing your code until trigger the error.

NathanFreeman avatar Jul 10 '23 01:07 NathanFreeman