Skip to content

当群员列表缓存文件不完整时, 发生 MalformedInputException 导致 bot init 失败 #2399

@zhaodice

Description

@zhaodice

问题描述

在登录时加载Group member缓存期间时出现的错误(但不确定是不是因为缓存原因)

复现

根据用户的反馈,在直接登录时加载群缓存时就复现了,目前还在调查是否和缓存有关,打算让用户删除缓存尝试

mirai-core 版本

2.13.2

bot-protocol

ANDROID_PHONE

其他组件版本

No response

系统日志

[17:42:43] [INFO] Starting mirai-console... 
[17:42:43] [INFO] 

==================================[ Mirai consosle 2.13.2 ]===================================
__ __ __ __ ______ __
| \ / \ \ | \/ \ | \
| ▓▓\ / ▓▓\▓▓ ______ ______ \▓▓ ▓▓▓▓▓▓\ ______ _______ _______ ______ | ▓▓ ______
| ▓▓▓\ / ▓▓▓ \/ \ | \| \ ▓▓ \▓▓/ \| \ / \/ \| ▓▓/ \
| ▓▓▓▓\ ▓▓▓▓ ▓▓ ▓▓▓▓▓▓\ \▓▓▓▓▓▓\ ▓▓ ▓▓ | ▓▓▓▓▓▓\ ▓▓▓▓▓▓▓\ ▓▓▓▓▓▓▓ ▓▓▓▓▓▓\ ▓▓ ▓▓▓▓▓▓\
| ▓▓\▓▓ ▓▓ ▓▓ ▓▓ ▓▓ \▓▓/ ▓▓ ▓▓ ▓▓ __| ▓▓ | ▓▓ ▓▓ | ▓▓\▓▓ \| ▓▓ | ▓▓ ▓▓ ▓▓ ▓▓
| ▓▓ \▓▓▓| ▓▓ ▓▓ ▓▓ | ▓▓▓▓▓▓▓ ▓▓ ▓▓__/ \ ▓▓__/ ▓▓ ▓▓ | ▓▓_\▓▓▓▓▓▓\ ▓▓__/ ▓▓ ▓▓ ▓▓▓▓▓▓▓▓
| ▓▓ \▓ | ▓▓ ▓▓ ▓▓ \▓▓ ▓▓ ▓▓\▓▓ ▓▓\▓▓ ▓▓ ▓▓ | ▓▓ ▓▓\▓▓ ▓▓ ▓▓\▓▓ \
\▓▓ \▓▓\▓▓\▓▓ \▓▓▓▓▓▓▓\▓▓ \▓▓▓▓▓▓ \▓▓▓▓▓▓ \▓▓ \▓▓\▓▓▓▓▓▓▓ \▓▓▓▓▓▓ \▓▓ \▓▓▓▓▓▓▓

[17:42:44] [INFO] Loaded account secrets from local cache. 
[17:42:44] [INFO] ECDH key is valid. 
[17:42:44] [INFO] Saved account secrets to local cache for fast login. 
[17:42:44] [INFO] Login successful. 
[17:42:44] [INFO] Server time updated, serverTime: 1671529365, diff: 1ms=0.001s 
[17:42:44] [INFO] Syncing friend message history... 
[17:42:44] [INFO] Loaded 111 friends from local cache. 
[17:42:44] [INFO] Start loading stranger list... 
[17:42:44] [INFO] Start loading friendGroup list... 
[17:42:44] [INFO] Start loading group list... 
[17:42:44] [INFO] Successfully loaded stranger list: 0 in total 
[17:42:44] [INFO] Online OtherClients: MOA-AL00(MOBILE) 
[17:42:44] [INFO] Successfully loaded friendGroup list: 14 in total 
[17:42:44] [INFO] Loaded 3 members from local cache for group ................
................................
[17:42:45] [WARNING] Network selector received exception, closing bot. (kotlinx.coroutines.JobCancellationException: Parent job is Cancelling; job=z{Cancelling}@aa95aa0) 
[17:42:45] [ERROR] Exception in coroutine 'unnamed' 
[17:42:45] [ERROR] net.mamoe.mirai.internal.deps.io.ktor.utils.io.charsets.MalformedInputException: Input length = 1
	at net.mamoe.mirai.internal.deps.io.ktor.utils.io.charsets.CharsetJVMKt.throwExceptionWrapped(Unknown Source:15)
	at net.mamoe.mirai.internal.deps.io.ktor.utils.io.charsets.EncodingKt.net.mamoe.mirai.internal.deps.io.ktor.utils.io.charsets.CharsetJVMKt.decode(SourceFile:112)
                                                                       decode
	at net.mamoe.mirai.utils.MiraiUtils__IOKt.net.mamoe.mirai.internal.deps.io.ktor.utils.io.charsets.EncodingKt.decode$default(Unknown Source:9)
                                           readAllText
	at net.mamoe.mirai.utils.MiraiUtils.readAllText(Unknown Source:0)
	at net.mamoe.mirai.utils.FileKt.readText(Unknown Source:8)
	at net.mamoe.mirai.internal.network.GroupMemberListCaches.a(SourceFile:29)
	at net.mamoe.mirai.internal.network.components.ContactUpdaterImpl.net.mamoe.mirai.internal.network.components.ContactUpdaterImpl.addGroupToBot(SourceFile:102)
                                                                   access$addGroupToBot
	at net.mamoe.mirai.internal.network.components.ContactUpdaterImpl$reloadGroupList$2$2$1$1.invokeSuspend(SourceFile:177)
	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(Unknown Source:5)
	at kotlinx.coroutines.DispatchedTask.run(Unknown Source:109)
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(SourceFile:85)
                                                            kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask
                                                            kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker
                                                            run

[17:42:45] [INFO] Loaded 791 members from local cache for group ..............
........................
[17:42:46] [WARNING] An exception was thrown during 'loading groups' of Bot 3103132950. Trying to ignore the error and continue logging in... 
[17:42:46] [ERROR] Exception in coroutine 'BotInitProcessor.init' 
[17:42:46] [ERROR] java.lang.IllegalStateException: Exception in attached Job 'BotInitProcessor.init'
	at net.mamoe.mirai.internal.network.handler.state.JobAttachStateObserver$stateChanged0$1.invokeSuspend(SourceFile:74)
	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(Unknown Source:5)
	at kotlinx.coroutines.DispatchedTask.run(Unknown Source:109)
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(SourceFile:85)
                                                            kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask
                                                            kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker
                                                            run
Caused by: net.mamoe.mirai.internal.deps.io.ktor.utils.io.charsets.MalformedInputException: Input length = 1
	at net.mamoe.mirai.internal.deps.io.ktor.utils.io.charsets.CharsetJVMKt.throwExceptionWrapped(Unknown Source:15)
	at net.mamoe.mirai.internal.deps.io.ktor.utils.io.charsets.EncodingKt.net.mamoe.mirai.internal.deps.io.ktor.utils.io.charsets.CharsetJVMKt.decode(SourceFile:112)
                                                                       decode
	at net.mamoe.mirai.utils.MiraiUtils__IOKt.net.mamoe.mirai.internal.deps.io.ktor.utils.io.charsets.EncodingKt.decode$default(Unknown Source:9)
                                           readAllText
	at net.mamoe.mirai.utils.MiraiUtils.readAllText(Unknown Source:0)
	at net.mamoe.mirai.utils.FileKt.readText(Unknown Source:8)
	at net.mamoe.mirai.internal.network.GroupMemberListCaches.a(SourceFile:29)
	at net.mamoe.mirai.internal.network.components.ContactUpdaterImpl.net.mamoe.mirai.internal.network.components.ContactUpdaterImpl.addGroupToBot(SourceFile:102)
                                                                   access$addGroupToBot
	at net.mamoe.mirai.internal.network.components.ContactUpdaterImpl$reloadGroupList$2$2$1$1.invokeSuspend(SourceFile:177)
	... 3 more
	Suppressed: net.mamoe.mirai.utils.StacktraceException: Unwrapped exception: StateSwitchingException(old=StateLoading, new=StateClosed, cause=kotlinx.coroutines.JobCancellationException: Parent job is Cancelling; job=z{Cancelled}@aa95aa0)
[17:42:46] [INFO] Bot login successful. 
[17:42:46] [INFO] Bot cancelled: Bot closed 
[17:42:46] [INFO] ->>Login Operation finished.<<-

网络日志

No response

补充信息

原始信息已被混淆,这是使用mapping.txt 解混淆的结果,可能有出入。

Metadata

Metadata

Assignees

No one assigned

    Labels

    M优先级: 主要s:core子系统: mirai-coret:bug类型: bug

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions