Open
Description
When writing to a log file during log rotation, a sudden surge in thread count may occur.
在日志轮转的同时写入日志文件时,可能引起线程暴涨
In our production environment, logs are rotated daily based on the date, and this setup has been working fine for a long time. However, after I recently set maxFiles to 2, we’ve encountered two incidents where threads got stuck, causing a sharp increase in the number of threads. The same issue was also observed during simulated testing.
在生产环境中日志的写入是根据日期进行轮转的,之前一直都没有问题,直至我最近设置了 maxFiles 为 2。目前已经出现了 2 次线程 hang 住的情况,导致了线程数暴涨,在模拟测试时也出现了相同的问题。
20250611171351_rec_.mp4
配置信息:
- worker_num = 1
- aio_core_worker_num = 2
- max_wait_time = 15
日志写入用的是 Monolog/Handler/RotatingFileHandler
swoole 信息:
# php --ri swoole
swoole
Swoole => enabled
Author => Swoole Team <team@swoole.com>
Version => 5.1.2
Built => Jan 24 2024 05:51:34
coroutine => enabled with boost asm context
epoll => enabled
eventfd => enabled
signalfd => enabled
spinlock => enabled
rwlock => enabled
openssl => OpenSSL 3.1.4 24 Oct 2023
dtls => enabled
http2 => enabled
json => enabled
curl-native => enabled
pcre => enabled
c-ares => 1.19.1
zlib => 1.2.13
brotli => E16777225/D16777225
mutex_timedlock => enabled
pthread_barrier => 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 => Off => Off
swoole.unixsock_buffer_size => 8388608 => 8388608
Metadata
Metadata
Assignees
Labels
No labels