H-K-Y / Genshin_Impact_bot

原神bot,这是一个基于nonebot和HoshinoBot的原神娱乐及信息查询插件,包含原神抽卡,丘丘语翻译,找资源点等功能
GNU General Public License v3.0
393 stars 85 forks source link

更新地图导致内存溢出 #57

Closed lhhxxxxx closed 2 years ago

lhhxxxxx commented 3 years ago

2核4g都会溢出内存。。。。群里都在建议关掉自动更新手动替换。。。

考虑缓冲一下吧

H-K-Y commented 3 years ago

不会吧,我服务器2g内存都能跑啊,是最新的版本吗? 你提供一下python版本,32位还是64位,依赖库的版本和报错日志

H-K-Y commented 3 years ago

等会,我想起个事,你用的不会是32位的python吧

lhhxxxxx commented 3 years ago

Linux不分位数的呀

(在群里的话直接去群里讨论吧?)

H-K-Y commented 3 years ago

你能提供一下python版本,依赖库的版本和报错日志吗? 而且Linux有32位啊

lhhxxxxx commented 3 years ago

Python 3.9.5 [GCC 7.5.0] on linux (linux的Python应该是不分位数的,我的系统是64位)

lhhxxxxx commented 3 years ago

aiocache 0.11.1 aiocqhttp 1.4.2 aiodns 3.0.0 aiofiles 0.7.0 aiohttp 3.7.4.post0 anyio 3.3.1 appdirs 1.4.4 APScheduler 3.7.0 async-timeout 3.0.1 attrs 21.2.0 backports.entry-points-selectable 1.1.0 beautifulsoup4 4.9.3 blinker 1.4 CacheControl 0.12.6 cachy 0.3.0 cattrs 1.8.0 cchardet 2.1.7 certifi 2021.5.30 cffi 1.14.6 chardet 4.0.0 charset-normalizer 2.0.6 cleo 0.8.1 click 7.1.2 clikit 0.6.2 crashtest 0.3.1 cryptography 3.4.8 cycler 0.10.0 distlib 0.3.3 filelock 3.0.12 fuzzywuzzy 0.18.0 h11 0.12.0 h2 4.0.0 hpack 4.0.0 html5lib 1.1 httpcore 0.13.7 httpx 0.19.0 Hypercorn 0.11.2 hyperframe 6.0.1 idna 3.2 itsdangerous 2.0.1 jeepney 0.7.1 Jinja2 3.0.1 jmespath 0.10.0 keyring 21.8.0 kiwisolver 1.3.2 langid 1.1.6 lockfile 0.12.2 loguru 0.5.3 lxml 4.6.2 MarkupSafe 2.0.1 matplotlib 3.4.3 msgpack 1.0.2 multidict 5.1.0 nonebot 1.8.4 numpy 1.21.2 packaging 20.9 pastel 0.2.1 peony-twitter 1.1.7 pexpect 4.8.0 Pillow 8.3.2 pip 21.2.4 pkginfo 1.7.1 platformdirs 2.4.0 poetry 1.1.10 poetry-core 1.0.6 priority 2.0.0 ptyprocess 0.7.0 pycares 4.0.0 pycparser 2.20 pygtrie 2.4.2 pylev 1.4.0 pyparsing 2.4.7 python-dateutil 2.8.2 python-magic 0.4.24 pytz 2021.1 PyYAML 5.4.1 Quart 0.14.1 requests 2.26.0 requests-cache 0.8.1 requests-toolbelt 0.9.1 rfc3986 1.5.0 SecretStorage 3.3.1 setuptools 56.0.0 shellingham 1.4.0 six 1.16.0 sniffio 1.2.0 sogou-tr-free 0.0.11 soupsieve 2.2.1 sqlitedict 1.7.0 tencentcloud-sdk-python 3.0.492 tinydb 4.5.2 toml 0.10.2 tomlkit 0.7.2 typing-extensions 3.10.0.2 tzlocal 2.1 url-normalize 1.4.3 urllib3 1.26.7 virtualenv 20.8.1 webencodings 0.5.1 Werkzeug 2.0.1 wsproto 1.0.0 yarl 1.6.3 zhconv 1.4.2

H-K-Y commented 3 years ago

HoshinoBot的报错信息呢

lhhxxxxx commented 3 years ago

[465120.987727] [ pid ] uid tgid total_vm rss pgtables_bytes swapents oom_score_adj name [465120.987808] [ 6451] 0 6451 426916 349471 3272704 0 0 python3 [465120.987809] Out of memory: Kill process 6451 (python3) score 724 or sacrifice child [465120.989608] Killed process 6451 (python3) total-vm:1707664kB, anon-rss:1396160kB, file-rss:1724kB, shmem-rss:0kB

lhhxxxxx commented 3 years ago

hoshinobot没有报错,直接被kill了,这是日志

H-K-Y commented 3 years ago

你发多点不行吗?从启动到kill

lhhxxxxx commented 3 years ago

ok

lhhxxxxx commented 3 years ago

2021-10-02 15:36:32.117 | INFO | hoshino.modules.Genshin_Impact_bot.query_resource_points.query_resource_points:up_map:145 - 正在更新地图数据 Killed

log没有任何输出,直接被kill了

H-K-Y commented 3 years ago

从启动到kill的日志,兄弟

lhhxxxxx commented 3 years ago

目前情况是,有概率能更新成功,有概率直接kill

lhhxxxxx commented 3 years ago

哪端的日志

H-K-Y commented 3 years ago

就hoshinobot

lhhxxxxx commented 3 years ago

控制台日志的话,除了我发的都没用。。。 后台errorlog无显示 ujson module not found, using json [2021-10-02 15:45:14,138 config] INFO: Succeeded to load config of "groupmaster" [2021-10-02 15:45:14,139 config] WARNING: Not found config of "akgacha" [2021-10-02 15:45:14,139 config] WARNING: Not found config of "Genshin_Impact_bot" [2021-10-02 15:45:14,139 config] WARNING: Not found config of "xcw" [2021-10-02 15:45:14,140 config] WARNING: Not found config of "aichat" [2021-10-02 15:45:14,140 config] WARNING: Not found config of "botmanage" [2021-10-02 15:45:14,140 config] WARNING: Not found config of "egenshin" [2021-10-02 15:45:14,141 config] INFO: Succeeded to load config of "pcrclanbattle" [2021-10-02 15:45:14,141 config] WARNING: Not found config of "dice" [2021-10-02 15:45:14,141 config] INFO: Succeeded to load config of "priconne" [2021-10-02 15:45:14,620 nonebot] INFO: Succeeded to import "hoshino.modules.groupmaster.chat" [2021-10-02 15:45:14,623 nonebot] INFO: Succeeded to import "hoshino.modules.groupmaster.sleeping_set" [2021-10-02 15:45:14,771 nonebot] INFO: Succeeded to import "hoshino.modules.groupmaster.antiqks" [2021-10-02 15:45:14,774 nonebot] INFO: Succeeded to import "hoshino.modules.groupmaster.anti_holo" [2021-10-02 15:45:14,777 nonebot] INFO: Succeeded to import "hoshino.modules.groupmaster.join_approve" [2021-10-02 15:45:14,778 nonebot] INFO: Succeeded to import "hoshino.modules.groupmaster.anti_abuse" [2021-10-02 15:45:14,780 nonebot] INFO: Succeeded to import "hoshino.modules.groupmaster.random_repeater" [2021-10-02 15:45:14,781 nonebot] INFO: Succeeded to import "hoshino.modules.groupmaster.anti_asoul" [2021-10-02 15:45:14,782 nonebot] INFO: Succeeded to import "hoshino.modules.groupmaster.group_notice" [2021-10-02 15:45:14,784 nonebot] INFO: Succeeded to import "hoshino.modules.groupmaster.anti_msg_recall" [2021-10-02 15:45:15,424 nonebot] INFO: Succeeded to import "hoshino.modules.akgacha.weibo" [2021-10-02 15:45:15,424 nonebot] INFO: Succeeded to import "hoshino.modules.akgacha.prtsres" [2021-10-02 15:45:15,425 nonebot] INFO: Succeeded to import "hoshino.modules.akgacha.akgacha" [2021-10-02 15:45:15,436 nonebot] INFO: Succeeded to import "hoshino.modules.Genshin_Impact_bot.artifact_collect" [2021-10-02 15:45:15,437 nonebot] INFO: Succeeded to import "hoshino.modules.Genshin_Impact_bot.artifact_rate" [2021-10-02 15:45:15,437 nonebot] INFO: Succeeded to import "hoshino.modules.Genshin_Impact_bot.config" [2021-10-02 15:45:15,438 nonebot] INFO: Succeeded to import "hoshino.modules.Genshin_Impact_bot.qiu_qiu_translation" [2021-10-02 15:45:15,444 nonebot] INFO: Succeeded to import "hoshino.modules.Genshin_Impact_bot.material_remind" 2021-10-02 15:45:15.460 | INFO | hoshino.modules.Genshin_Impact_bot.query_resource_points.query_resource_points:up_label_and_point_list:124 - 正在更新资源点数据 2021-10-02 15:45:15.685 | INFO | hoshino.modules.Genshin_Impact_bot.query_resource_points.query_resource_points:up_label_and_point_list:137 - 资源点数据更新完成 2021-10-02 15:45:15.686 | INFO | hoshino.modules.Genshin_Impact_bot.query_resource_points.query_resource_points:up_map:145 - 正在更新地图数据 Killed

lhhxxxxx commented 3 years ago

之前发的那个Linux的kill日志显示,进程的总虚拟内存到1.6G,实际占用物理内存到1.3G的时候被系统kill了,此时虚拟内存占用磁盘空间1724K

lhhxxxxx commented 3 years ago

嘶,刚刚看了下,成功的那次我后台其他进程被顶掉了

H-K-Y commented 3 years ago

你除了运行hoshino还运行了别的耗内存的程序吧.......... 更新地图的时候会有1G内存的占用峰值,然后回落到200MB左右,你服务器内存不够了系统会随机杀进程...........

lhhxxxxx commented 3 years ago

1.6G的时候被强制kill,说明不止1.6G,而且以后地图可能更大。。。

lhhxxxxx commented 3 years ago

这次主要是半夜我服务器炸了,所以。。。。

lhhxxxxx commented 3 years ago

断点看了一下,问题好像出在image上?

H-K-Y commented 3 years ago

是的,就是image读取数据的时候占内存峰值高,裁切完就没事了

H-K-Y commented 3 years ago

你跑HoshinoBot的时候把别的程序关了试试,预留2G空闲内存试试跑一下

zangxx66 commented 3 years ago

用swap可以解决

lhhxxxxx commented 3 years ago

用swap可以解决

说来听听?

zangxx66 commented 3 years ago

用swap可以解决

说来听听?

我是1核2g的机器,创建了一个4g的swap空间解决了内存不足的问题

H-K-Y commented 3 years ago

用swap可以解决

说来听听?

我是1核2g的机器,创建了一个4g的swap空间解决了内存不足的问题

你们服务器上是还跑了别的东西吗?,我的服务器也是单核2g,只跑了机器人,没用swap也没出过事

zangxx66 commented 3 years ago

用swap可以解决

说来听听?

我是1核2g的机器,创建了一个4g的swap空间解决了内存不足的问题

你们服务器上是还跑了别的东西吗?,我的服务器也是单核2g,只跑了机器人,没用swap也没出过事

除了go-cqhttp和hoshino我还跑了yobot和nginx

H-K-Y commented 3 years ago

用swap可以解决

说来听听?

我是1核2g的机器,创建了一个4g的swap空间解决了内存不足的问题

你们服务器上是还跑了别的东西吗?,我的服务器也是单核2g,只跑了机器人,没用swap也没出过事

除了go-cqhttp和hoshino我还跑了yobot和nginx

不开swap会killed?

zangxx66 commented 3 years ago

用swap可以解决

说来听听?

我是1核2g的机器,创建了一个4g的swap空间解决了内存不足的问题

你们服务器上是还跑了别的东西吗?,我的服务器也是单核2g,只跑了机器人,没用swap也没出过事

除了go-cqhttp和hoshino我还跑了yobot和nginx

不开swap会killed?

是的,不开swap的话内存不够用

Nuevo009 commented 3 years ago

感谢 @zangxx66 提醒,在甲骨文 1c1G 的 amd 小机子上开了 2G 的 swap ,现在正常运行了()