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

java.lang.IllegalStateException: wLoginSigInfoField is not yet initialized #2449

Closed
zhaodice opened this issue Jan 21, 2023 · 4 comments · Fixed by #2450
Closed

java.lang.IllegalStateException: wLoginSigInfoField is not yet initialized #2449

zhaodice opened this issue Jan 21, 2023 · 4 comments · Fixed by #2450
Labels
M 优先级: 主要 s:core 子系统: mirai-core t:bug 类型: bug
Milestone

Comments

@zhaodice
Copy link
Contributor

zhaodice commented Jan 21, 2023

问题描述

用的 https://github.com/mamoe/mirai/actions/runs/3933352388 的action版本
挂机一晚上后发现断线且没有自动重连,似乎是重连条件出现误判?
重启后完全正常,故而这个问题并不紧急,只是先提出来放在这里

复现

挂机一晚上加一上午,不太好复现

mirai-core 版本

1.14.0(ACTION 3933352388)

bot-protocol

ANDROID_PHONE

其他组件版本

No response

系统日志

[11:29:56] [INFO] ECDH key is valid. 
[11:29:56] [ERROR] Error while decoding packet 'ByteReadPacket(0 bytes remaining)' 
[11:29:56] [ERROR] net.mamoe.mirai.internal.network.components.PacketCodecException: java.lang.IllegalStateException: Received packet returnCode = -10008, which may mean session expired.
	at net.mamoe.mirai.internal.network.components.PacketCodecImpl.parseSsoFrame(PacketCodec.kt:178)
	at net.mamoe.mirai.internal.network.components.PacketCodecImpl.decodeRaw(PacketCodec.kt:128)
	at net.mamoe.mirai.internal.network.handler.CommonNetworkHandler$PacketDecodePipeline.decodePacket(CommonNetworkHandler.kt:148)
	at net.mamoe.mirai.internal.network.handler.CommonNetworkHandler$PacketDecodePipeline.access$decodePacket(CommonNetworkHandler.kt:102)
	at net.mamoe.mirai.internal.network.handler.CommonNetworkHandler$PacketDecodePipeline$1.invokeSuspend(CommonNetworkHandler.kt:125)
	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
	at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
	at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:164)
	at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:472)
	at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:500)
	at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:989)
	at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
	at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
	at java.lang.Thread.run(Thread.java:919)
Caused by: java.lang.IllegalStateException: Received packet returnCode = -10008, which may mean session expired.
	... 14 more

[11:29:56] [INFO] parserXml failed, then return false 
[11:29:56] [WARNING] Exception in resumeConnection. 
[11:29:56] [WARNING] Network selector received exception, closing bot. (java.lang.IllegalStateException: NetworkHandler is already closed.) 
[11:29:56] [WARNING] Exception in resumeConnection. 
[11:29:56] [INFO] ECDH key is invalid, start to fetch ecdh public key from server. 
[11:29:56] [INFO] Successfully fetched ecdh public key from server. 
[11:29:57] [ERROR] Exception in coroutine 'unnamed' 
[11:29:57] [ERROR] ExceptionInPacketCodecException(cause=java.lang.IllegalStateException: wLoginSigInfoField is not yet initialized)
	at net.mamoe.mirai.internal.network.handler.CommonNetworkHandler.handleExceptionInDecoding$passToExceptionHandler(CommonNetworkHandler.kt:57)
	at net.mamoe.mirai.internal.network.handler.CommonNetworkHandler.handleExceptionInDecoding(CommonNetworkHandler.kt:74)
	at net.mamoe.mirai.internal.network.handler.CommonNetworkHandler$PacketDecodePipeline$1.invokeSuspend(CommonNetworkHandler.kt:129)
	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
	at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
	at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:164)
	at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:472)
	at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:497)
	at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:989)
	at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
	at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
	at java.lang.Thread.run(Thread.java:919)
Caused by: java.lang.IllegalStateException: wLoginSigInfoField is not yet initialized
	at net.mamoe.mirai.internal.network.components.AccountSecrets.getWLoginSigInfo(AccountSecretsManager.kt:55)
	at net.mamoe.mirai.internal.network.QQAndroidClient.getWLoginSigInfo(Unknown Source:2)
	at net.mamoe.mirai.internal.network.components.PacketCodecImpl.decodeRaw(PacketCodec.kt:122)
	at net.mamoe.mirai.internal.network.handler.CommonNetworkHandler$PacketDecodePipeline.decodePacket(CommonNetworkHandler.kt:148)
	at net.mamoe.mirai.internal.network.handler.CommonNetworkHandler$PacketDecodePipeline.access$decodePacket(CommonNetworkHandler.kt:102)
	at net.mamoe.mirai.internal.network.handler.CommonNetworkHandler$PacketDecodePipeline$1.invokeSuspend(CommonNetworkHandler.kt:125)
	... 9 more

[11:29:57] [ERROR] Error while decoding packet 'ByteReadPacket(0 bytes remaining)' 
[11:29:57] [ERROR] java.lang.IllegalStateException: wLoginSigInfoField is not yet initialized
	at net.mamoe.mirai.internal.network.components.AccountSecrets.getWLoginSigInfo(AccountSecretsManager.kt:55)
	at net.mamoe.mirai.internal.network.QQAndroidClient.getWLoginSigInfo(Unknown Source:2)
	at net.mamoe.mirai.internal.network.components.PacketCodecImpl.decodeRaw(PacketCodec.kt:122)
	at net.mamoe.mirai.internal.network.handler.CommonNetworkHandler$PacketDecodePipeline.decodePacket(CommonNetworkHandler.kt:148)
	at net.mamoe.mirai.internal.network.handler.CommonNetworkHandler$PacketDecodePipeline.access$decodePacket(CommonNetworkHandler.kt:102)
	at net.mamoe.mirai.internal.network.handler.CommonNetworkHandler$PacketDecodePipeline$1.invokeSuspend(CommonNetworkHandler.kt:125)
	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
	at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
	at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:164)
	at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:472)
	at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:497)
	at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:989)
	at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
	at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
	at java.lang.Thread.run(Thread.java:919)

[11:29:57] [INFO] Login successful 
[11:29:57] [INFO] Saved account secrets to local cache for fast login. 
[11:29:57] [INFO] Login successful. 
[11:29:57] [INFO] Server time updated, serverTime: 1674271797, diff: 0ms=0.0s 
[11:29:57] [INFO] Scheduled refresh login session in 19d 23h 55min 0.0s. 
[11:29:57] [INFO] Scheduled key refresh in 23h 55min 0.0s. 
[11:29:57] [INFO] Bot is closed manually with exception: java.lang.IllegalStateException: NetworkHandler is already closed. 
[11:29:57] [INFO] Bot cancelled: Bot closed 



### 网络日志

```text
暂时没有打开log功能,如有需要这里可以试图重新复现进行补充

补充信息

No response

@zhaodice
Copy link
Contributor Author

似乎和 #2447 的错误差不多,但我这个是挂机很久很久才出现的,当时是完全正常,出问题重启后也完全正常

@zhaodice zhaodice changed the title 挂机一晚上后发现断线且没有自动重连(可能是在判断是否能重连时出现误判?) java.lang.IllegalStateException: wLoginSigInfoField is not yet initialized Jan 21, 2023
@cssxsh
Copy link
Contributor

cssxsh commented Jan 21, 2023

Received packet returnCode = -10008, which may mean session expired.

session cacahe 过期了

@zhaodice
Copy link
Contributor Author

Received packet returnCode = -10008, which may mean session expired.

session cacahe 过期了

但是重启之后就正常了,也许可以加个自动重连逻辑?

@cssxsh
Copy link
Contributor

cssxsh commented Jan 21, 2023

自动重连逻辑 本来就有
你这里遇到了失效的情况,网络层断掉了

类似的 issue 有提过
#2148

sandtechnology added a commit to sandtechnology/mirai that referenced this issue Jan 21, 2023
@Him188 Him188 added t:bug 类型: bug M 优先级: 主要 s:core 子系统: mirai-core labels Jan 28, 2023
@Him188 Him188 added this to the 2.15.0-RC milestone Jan 28, 2023
Him188 added a commit that referenced this issue Mar 21, 2023
* Handle rare case on packet pipeline
Fix #2449, should help #1603

* Fix and improve tips and improve the readability of code

* Improve wording of tips

Co-authored-by: Him188 <[email protected]>

* Change d2Key error type to PROTOCOL_UPDATED

* Reformat code

---------

Co-authored-by: Him188 <[email protected]>
StageGuard pushed a commit to StageGuard/mirai that referenced this issue Apr 14, 2023
* Handle rare case on packet pipeline
Fix mamoe#2449, should help mamoe#1603

* Fix and improve tips and improve the readability of code

* Improve wording of tips

Co-authored-by: Him188 <[email protected]>

* Change d2Key error type to PROTOCOL_UPDATED

* Reformat code

---------

Co-authored-by: Him188 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
M 优先级: 主要 s:core 子系统: mirai-core t:bug 类型: bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants