Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

内存耗尽 #1176

Closed
zhou01 opened this issue Dec 24, 2019 · 9 comments · Fixed by swoft-cloud/swoft-component#560
Closed

内存耗尽 #1176

zhou01 opened this issue Dec 24, 2019 · 9 comments · Fixed by swoft-cloud/swoft-component#560

Comments

@zhou01
Copy link

zhou01 commented Dec 24, 2019

Q A
Bug report? yes
Feature request? yes
Swoft version 2.0
Swoole version 4.4.10
PHP version 7.2.11
Runtime environment CentOS 7

Describe the bug
系统运行一段时间后,出现message:
[2019-12-24 15:25:56 *80647.7] ERROR php_swoole_server_rshutdown (ERRNO 503): Fatal error: Uncaught ErrorException: Allowed memory size of 134217728 bytes exhausted (tried to allocate 131072 bytes) in /data/wwwroot/api-swoft.mama.cn/vendor/swoft/http-message/src/Response.php:225
Stack trace:
#0 /data/wwwroot/api-swoft.mama.cn/app/Common/ErrorDispatcher.php(62): App\Common\ErrorDispatcher->handleError(1, 'Allowed memory ...', '/data/wwwroot/a...', 225)
#1 [internal function]: App\Common\ErrorDispatcher->App\Common{closure}()
#2 {main}
thrown in /data/wwwroot/api-swoft.mama.cn/vendor/swoft/http-message/src/Response.php on line 225
[2019-12-24 15:25:56 $80619.0] WARNING swManager_check_exit_status: worker#7[pid=80647] abnormal exit, status=255, signal=0

@zhou01
Copy link
Author

zhou01 commented Dec 24, 2019

Swoft version | 2.0.7

@inhere
Copy link
Member

inhere commented Dec 24, 2019

有啥特殊操作吗?
只用了http-server 还有其他啥吗?

@zhou01
Copy link
Author

zhou01 commented Dec 25, 2019

只用了http-server

@zl00733
Copy link

zl00733 commented Dec 26, 2019

用swoole-tracker 监控内存溢出

@zhou01
Copy link
Author

zhou01 commented Dec 30, 2019

在bean.php关闭logger功能之后,用redis(用连接池)的get方法,会导致内存不断增高。(大家可以试试,不知道是不是只有我的才会)

@liangwhGH
Copy link

好的,加油

@zhou01
Copy link
Author

zhou01 commented Dec 30, 2019

有啥特殊操作吗?
只用了http-server 还有其他啥吗?

在bean.php关闭logger功能之后,用redis(用连接池)的get方法,会导致内存不断增高。

@zhou01
Copy link
Author

zhou01 commented Dec 31, 2019

总结问题:使用redis的get方法的时候会调用logger的counting方法,该方法会不断的计数(导致内存泄露的真正原因),一旦把logger设置enable为false,则会导致logger中countting数组不被释放。
Swoft\Redis\Connection\Connection.php
image
Swoft\Log\Logger.php
image
image

@inhere
Copy link
Member

inhere commented Jan 17, 2020

@zhou01 log 问题已经修复了。等发版

inhere added a commit to swoft-cloud/swoft-log that referenced this issue Jan 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants