[BUG] 运行一段时间后间歇性出现ExternalResourceLeak报错
ReinWD opened this issue · 3 comments
ReinWD commented
bot发送图片达到一定数量后,mirai控制台输出警告信息显示可能出现资源泄露情况
服务器内存占用随进程运行不断升高
2021-08-11 17:08:34 V/Bot.2*********4: [兰*********8)] 星*********1) -> 对
2021-08-11 17:08:35 V/Bot.2*********4: [兰*********8)] 星*********1) -> 方便
2021-08-11 17:08:36 E/ExternalResourceLeakObserver: A resource leak occurred, use ExternalResource.close to avoid it!! (holder=net.mamoe.mirai.internal.utils.ExternalResourceImplByFile$ResourceHolder@6f0c3f7c)
net.mamoe.mirai.internal.utils.ExternalResourceLeakObserver$ExternalResourceCreateStackTrace
at java.base/java.lang.Thread.getStackTrace(Thread.java:1602)
at net.mamoe.mirai.internal.utils.ExternalResourceHolder.<init>(ExternalImageImpls.kt:71)
at net.mamoe.mirai.internal.utils.ExternalResourceImplByFile$ResourceHolder.<init>(ExternalImageImpls.kt:105)
at net.mamoe.mirai.internal.utils.ExternalResourceImplByFile.<init>(ExternalImageImpls.kt:112)
at net.mamoe.mirai.utils.ExternalResource$Companion.create(ExternalResource.kt:164)
at net.mamoe.mirai.utils.ExternalResource$Companion.create$default(ExternalResource.kt:160)
at net.mamoe.mirai.utils.ExternalResource$Companion.create(ExternalResource.kt:146)
at net.mamoe.mirai.utils.FileCacheStrategy$TempCache.newCache(FileCacheStrategy.kt:107)
at net.mamoe.mirai.utils.ExternalResource$Companion.create(ExternalResource.kt:190)
at net.mamoe.mirai.utils.ExternalResource$Companion.create$default(ExternalResource.kt:189)
at com.github.yyuueexxiinngg.onebot.util.CQMessgeParserKt$tryResolveMedia$3.invokeSuspend(CQMessgeParser.kt:468) at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:571)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:750)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:678)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:665)
at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:571)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:750)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:678)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:665)
2021-08-11 17:08:49 V/Bot.2*********4: [兰*********8)] A*********3) -> 反正*****************猫
2021-08-11 17:08:49 V/Bot.2*********4: [兰*********8)] 星*********1) -> 缺*********法
......
2021-08-12 08:39:23 V/Bot.2*********4: [[*********趴(30/30)(6*********1)] Y*********u(2*********6) -> 查看仓库
2021-08-12 08:39:26 V/Bot.2*********4: Event: BeforeImageUploadEvent(target=Group(6*********1), source=net.mamoe.mirai.inte
rnal.utils.ExternalResourceImplByFile@1f1b8e62)
2021-08-12 08:39:27 V/Bot.2*********4: Event: Succeed(target=Group(6*********1), source=net.mamoe.mirai.internal.utils.Exte
rnalResourceImplByFile@1f1b8e62, image=[mirai:image:{3902BFF2-49BF-75D4-6A51-1F7A92777194}.jpg])
2021-08-12 08:39:27 V/Bot.2*********4: Event: GroupMessagePreSendEvent(target=Group(6*********1), message=[mirai:at:2*********6]的仓库:[mirai:image:{3902BFF2-49BF-75D4-6A51-1F7A92777194}.jpg]
持有卡片数: 301
普通卡收集: 116/118
稀有卡收集: 129/129
超稀有收集: 15/15
图鉴完成度: 260/262
当前群排名: 第1位)
2021-08-12 08:39:27 V/Bot.2*********4: Group(6*********1) <- [mirai:at:2*********6]的仓库:[mirai:image:{3902BFF2-49BF-75D4-6A
51-1F7A92777194}.jpg]\n持有卡片数: 301\n普通卡收集: 116/118\n稀有卡收集: 129/129\n超稀有收集: 15/15\n图鉴完成度: 260/262
\n当前群排名: 第1位
2021-08-12 08:39:27 V/Bot.2*********4: Event: GroupMessagePostSendEvent(target=Group(*********), message=[mirai:at:2*********6]的仓库:[mirai:image:{3902BFF2-49BF-75D4-6A51-1F7A92777194}.jpg]
持有卡片数: 301
普通卡收集: 116/118
稀有卡收集: 129/129
超稀有收集: 15/15
图鉴完成度: 260/262
当前群排名: 第1位, exception=null, receipt=net.mamoe.mirai.message.MessageReceipt@167150ea)
2021-08-12 08:39:36 E/ExternalResourceLeakObserver: A resource leak occurred, use ExternalResource.close to avoid it!! (holder=net.mamoe.mirai.internal.utils.ExternalResourceImplByFile$ResourceHolder@b1e39db)
net.mamoe.mirai.internal.utils.ExternalResourceLeakObserver$ExternalResourceCreateStackTrace
at java.base/java.lang.Thread.getStackTrace(Thread.java:1602)
at net.mamoe.mirai.internal.utils.ExternalResourceHolder.<init>(ExternalImageImpls.kt:71)
at net.mamoe.mirai.internal.utils.ExternalResourceImplByFile$ResourceHolder.<init>(ExternalImageImpls.kt:105)
at net.mamoe.mirai.internal.utils.ExternalResourceImplByFile.<init>(ExternalImageImpls.kt:112)
at net.mamoe.mirai.utils.ExternalResource$Companion.create(ExternalResource.kt:164)
at net.mamoe.mirai.utils.ExternalResource$Companion.create$default(ExternalResource.kt:160)
at net.mamoe.mirai.utils.ExternalResource$Companion.create(ExternalResource.kt:146)
at net.mamoe.mirai.utils.FileCacheStrategy$TempCache.newCache(FileCacheStrategy.kt:107)
at net.mamoe.mirai.utils.ExternalResource$Companion.create(ExternalResource.kt:190)
at net.mamoe.mirai.utils.ExternalResource$Companion.create$default(ExternalResource.kt:189)
at com.github.yyuueexxiinngg.onebot.util.CQMessgeParserKt$tryResolveMedia$3.invokeSuspend(CQMessgeParser.kt:468) at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:571)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:750)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:678)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:665)
2021-08-12 08:39:36 E/ExternalResourceLeakObserver: A resource leak occurred, use ExternalResource.close to avoid it!! (holder=net.mamoe.mirai.internal.utils.ExternalResourceImplByFile$ResourceHolder@10bdcb04)
net.mamoe.mirai.internal.utils.ExternalResourceLeakObserver$ExternalResourceCreateStackTrace
at java.base/java.lang.Thread.getStackTrace(Thread.java:1602)
at net.mamoe.mirai.internal.utils.ExternalResourceHolder.<init>(ExternalImageImpls.kt:71)
at net.mamoe.mirai.internal.utils.ExternalResourceImplByFile$ResourceHolder.<init>(ExternalImageImpls.kt:105)
at net.mamoe.mirai.internal.utils.ExternalResourceImplByFile.<init>(ExternalImageImpls.kt:112)
at net.mamoe.mirai.utils.ExternalResource$Companion.create(ExternalResource.kt:164)
at net.mamoe.mirai.utils.ExternalResource$Companion.create$default(ExternalResource.kt:160)
at net.mamoe.mirai.utils.ExternalResource$Companion.create(ExternalResource.kt:146)
at net.mamoe.mirai.utils.FileCacheStrategy$TempCache.newCache(FileCacheStrategy.kt:107)
at net.mamoe.mirai.utils.ExternalResource$Companion.create(ExternalResource.kt:190)
at net.mamoe.mirai.utils.ExternalResource$Companion.create$default(ExternalResource.kt:189)
at com.github.yyuueexxiinngg.onebot.util.CQMessgeParserKt$tryResolveMedia$3.invokeSuspend(CQMessgeParser.kt:468)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:571)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:750)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:678)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:665)
......
2021-08-12 08:57:36 E/ExternalResourceLeakObserver: A resource leak occurred,...
......
2021-08-12 10:45:36 E/ExternalResourceLeakObserver: A resource leak occurred,...
复现
- 部署mirai-2.7-RC-dev-3
- 部署HoshinoBot,连接使用 ws_reverse: localhost:8080,res目录 需要单独下载后部署至HoshinoBot同级目录,包含游戏机器人所需要的图片信息
- 在hoshinoBot中安装插件pokemanpcr
- 在群组内发送“查看仓库”指令,会收到bot返回的截图信息
- 发送图片次数达到一定数量后,间隔一段时间会报错一次
版本
onebot-0.3.4
- all
mirai-core-2.7-RC-dev-3-all
mirai-console-2.7-RC-dev-3-all
服务器内存只有1GB mirai进程在报错时实际占用 25.4%, 重启后实际占用20.5%,重启前uptime 2天左右
ReinWD commented
log中只截取了两份完整片段及两个间歇性报错的时间点,聊天内容隐去
最后两段上下文都是正常的文字聊天记录
yyuueexxiinngg commented
ReinWD commented
感谢。