Skip to content

[BUG] 配置中心在swoole 6.1.3下出现严重的内存泄露 #7651

Open

Description

@Ulyssesyi

Execute the command and paste the result below.

Command: uname -a && php -v && composer info | grep hyperf && php --ri swoole

Linux 50e772c47a38 6.6.87.2-microsoft-standard-WSL2 #1 SMP PREEMPT_DYNAMIC Thu Jun  5 18:30:46 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux
PHP 8.1.33 (cli) (built: Jul  1 2025 21:17:52) (NTS gcc x86_64)
Copyright (c) The PHP Group
Zend Engine v4.1.33, Copyright (c) Zend Technologies
hyperf/cache                       3.1.63  A cache component for hyperf.
hyperf/code-parser                 3.1.63  A code parser component for Hyperf.
hyperf/codec                       3.1.63  A codec component for Hyperf.
hyperf/collection                  3.1.64  Hyperf Collection package which come from illuminate/collections
hyperf/command                     3.1.64  Command for hyperf
hyperf/conditionable               3.1.63  Hyperf Macroable package which come from illuminate/conditionable
hyperf/config                      3.1.63  An independent component that provides configuration container.
hyperf/config-center               3.1.63  The abstraction component of config center
hyperf/config-nacos                3.1.63  A nacos adapter for config center component.
hyperf/context                     3.1.63  A coroutine/application context library.
hyperf/contract                    3.1.63  The contracts of Hyperf.
hyperf/coordinator                 3.1.63  Hyperf Coordinator
hyperf/coroutine                   3.1.63  Hyperf Coroutine
hyperf/database                    3.1.63  A flexible database library.
hyperf/db-connection               3.1.63  A hyperf db connection handler for hyperf/database.
hyperf/devtool                     3.1.63  A Devtool for Hyperf.
hyperf/di                          3.1.63  A DI for Hyperf.
hyperf/dispatcher                  3.1.63  A HTTP Server for Hyperf.
hyperf/engine                      2.15.0  Coroutine engine provided by swoole.
hyperf/engine-contract             1.14.0  Contract for Coroutine Engine
hyperf/event                       3.1.63  an event manager that implements PSR-14.
hyperf/exception-handler           3.1.63  Exception handler for hyperf
hyperf/framework                   3.1.63  A coroutine framework that focuses on hyperspeed and flexible, specifically use for build microservices and middlewares.
hyperf/guzzle                      3.1.63  Swoole coroutine handler for guzzle
hyperf/http-message                3.1.63  microservice framework base on swoole
hyperf/http-server                 3.1.63  A HTTP Server for Hyperf.
hyperf/logger                      3.1.63  A logger component for hyperf.
hyperf/macroable                   3.1.63  Hyperf Macroable package which come from illuminate/macroable
hyperf/memory                      3.1.63  An independent component that use to operate and manage memory.
hyperf/model-listener              3.1.63  A model listener for Hyperf.
hyperf/nacos                       3.1.63  Nacos SDK
hyperf/pipeline                    3.1.63  Hyperf Macroable package which come from illuminate/pipeline
hyperf/pool                        3.1.63  An independent universal connection pool component.
hyperf/process                     3.1.63  A process component for hyperf.
hyperf/redis                       3.1.63  A redis component for hyperf.
hyperf/serializer                  3.1.63  A serializer component for Hyperf.
hyperf/server                      3.1.63  A base server library for Hyperf.
hyperf/stdlib                      3.1.63  A stdlib component for Hyperf.
hyperf/stringable                  3.1.63  Hyperf Stringable package which come from illuminate/support
hyperf/support                     3.1.63  A support component for Hyperf.
hyperf/tappable                    3.1.63  Hyperf Macroable package which come from illuminate/tappable
hyperf/testing                     3.1.63  Testing for hyperf

swoole

Swoole => enabled
Author => Swoole Team <team@swoole.com>
Version => 6.1.3
Built => Dec  1 2025 09:30:56
host byte order => little endian
coroutine => enabled with boost asm context
epoll => enabled
eventfd => enabled
signalfd => enabled
cpu_affinity => enabled
spinlock => enabled
rwlock => enabled
openssl => OpenSSL 3.5.1 1 Jul 2025
dtls => enabled
http2 => enabled
json => enabled
curl-native => enabled
curl-version => 7.76.1
zlib => 1.2.11
mutex_timedlock => enabled
pthread_barrier => enabled
futex => enabled
execinfo => enabled

Directive => Local Value => Master Value
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

Description:

升级到swoole 6.1.3后配置中心使用nacos,定时查询的逻辑下config-center-fetcher的process 内存占用上升。退回到6.1.2的版本就是正常的

Steps To Reproduce:

使用composer create-project hyperf/hyperf-skeleton创建示例项目,开启config-center & nacos 并且不要开启grpc使用http定时查询。即可发现config-center-fetcher的process 占用内存缓慢上升

Activity

  1. Ulyssesyi commented on Dec 1, 2025

    @Ulyssesyi
    ContributorAuthor

    @limingxinleo 大佬辛苦看下,是不是可以确认是swoole 底层的内存泄露

  2. suyar commented on Dec 15, 2025

    @suyar
    Contributor

    @Ulyssesyi 使用 http 有可能是 swoole curl 内存泄漏导致的,可以看 swoole 6.1.4 似乎修复了 https://github.com/swoole/swoole-src/releases/tag/v6.1.4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions