mamoe / mirai

高效率 QQ 机器人支持库
https://mirai.mamoe.net
GNU Affero General Public License v3.0
14.28k stars 2.53k forks source link

二维码登录后不到1分钟,报错Timeout waiting for ConfigPush.然后退出登录! #2824

Open panmili opened 8 months ago

panmili commented 8 months ago

问题描述

二维码登录后不到1分钟,报错Timeout waiting for ConfigPush.然后退出登录!

复现

日志如下 2023-12-20 11:38:03 I/Net 1342081703: Successfully loaded group list: 71 in total. 2023-12-20 11:38:03 I/Net 1342081703: Scheduled refresh login session in 19d 23h 55min 0.0s. 2023-12-20 11:38:03 I/Net 1342081703: Scheduled key refresh in 23h 55min 0.0s. 2023-12-20 11:38:03 V/Bot 1342081703: Event: BotOnlineEvent(bot=Bot(1342081703)) 2023-12-20 11:38:03 I/Bot 1342081703: Bot login successful. 2023-12-20 11:38:04 I/Net 1342081703: Syncing friend message history: Success. 2023-12-20 11:39:03 W/Net 1342081703: Missing ConfigPush. Switching server... 2023-12-20 11:39:03 V/Bot 1342081703: Event: BotOfflineEvent.RequireReconnect(bot=Bot(1342081703), cause=java.lang.IllegalStateException: Timeout waiting for ConfigPush., reconnect=true) 2023-12-20 11:39:03 W/Bot 1342081703: Connection lost, reconnecting... (java.lang.IllegalStateException: Timeout waiting for ConfigPush.) 2023-12-20 11:39:03 V/Bot 1342081703: Event: BotOfflineEvent.Active(bot=Bot(1342081703), cause=java.lang.IllegalStateException: Timeout waiting for ConfigPush., reconnect=false) 2023-12-20 11:39:03 I/Bot 1342081703: Bot is closed manually with exception: java.lang.IllegalStateException: Timeout waiting for ConfigPush. java.lang.IllegalStateException: Timeout waiting for ConfigPush. at net.mamoe.mirai.internal.network.components.ConfigPushProcessorImpl.syncConfigPush(ConfigPushProcessor.kt:45) at net.mamoe.mirai.internal.network.components.ConfigPushProcessorImpl$syncConfigPush$1.invokeSuspend(ConfigPushProcessor.kt) at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33) at kotlinx.coroutines.internal.ScopeCoroutine.afterResume(Scopes.kt:33) at kotlinx.coroutines.AbstractCoroutine.resumeWith(AbstractCoroutine.kt:102) at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:46) at kotlinx.coroutines.internal.ScopeCoroutine.afterResume(Scopes.kt:33) at kotlinx.coroutines.AbstractCoroutine.resumeWith(AbstractCoroutine.kt:102) at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:46) at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:104) at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:570) at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:750) at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:677) at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:664)

mirai-core 版本

2.16.0

bot-protocol

ANDROID_WATCH

其他组件版本

No response

系统日志

No response

网络日志

No response

补充信息

No response

WitherVictor commented 7 months ago

我这边也差不多一样, mirai-core 2.16.0,协议用的 ANDROID_PHONE 8.9.90,但是在主机下挂同一个账号的 QQNT 就能一直挂住,挺神奇的

kkgg0521 commented 7 months ago

有解决办法了么 搞得我很头疼

kkgg0521 commented 7 months ago

我这边也差不多一样, mirai-core 2.16.0,协议用的 ANDROID_PHONE 8.9.90,但是在主机下挂同一个账号的 QQNT 就能一直挂住,挺神奇的

可以想办法 解决么

kkgg0521 commented 7 months ago

急求急求

kkgg0521 commented 7 months ago

问题描述

二维码登录后不到1分钟,报错Timeout waiting for ConfigPush.然后退出登录!

复现

日志如下 2023-12-20 11:38:03 I/Net 1342081703: Successfully loaded group list: 71 in total. 2023-12-20 11:38:03 I/Net 1342081703: Scheduled refresh login session in 19d 23h 55min 0.0s. 2023-12-20 11:38:03 I/Net 1342081703: Scheduled key refresh in 23h 55min 0.0s. 2023-12-20 11:38:03 V/Bot 1342081703: Event: BotOnlineEvent(bot=Bot(1342081703)) 2023-12-20 11:38:03 I/Bot 1342081703: Bot login successful. 2023-12-20 11:38:04 I/Net 1342081703: Syncing friend message history: Success. 2023-12-20 11:39:03 W/Net 1342081703: Missing ConfigPush. Switching server... 2023-12-20 11:39:03 V/Bot 1342081703: Event: BotOfflineEvent.RequireReconnect(bot=Bot(1342081703), cause=java.lang.IllegalStateException: Timeout waiting for ConfigPush., reconnect=true) 2023-12-20 11:39:03 W/Bot 1342081703: Connection lost, reconnecting... (java.lang.IllegalStateException: Timeout waiting for ConfigPush.) 2023-12-20 11:39:03 V/Bot 1342081703: Event: BotOfflineEvent.Active(bot=Bot(1342081703), cause=java.lang.IllegalStateException: Timeout waiting for ConfigPush., reconnect=false) 2023-12-20 11:39:03 I/Bot 1342081703: Bot is closed manually with exception: java.lang.IllegalStateException: Timeout waiting for ConfigPush. java.lang.IllegalStateException: Timeout waiting for ConfigPush. at net.mamoe.mirai.internal.network.components.ConfigPushProcessorImpl.syncConfigPush(ConfigPushProcessor.kt:45) at net.mamoe.mirai.internal.network.components.ConfigPushProcessorImpl$syncConfigPush$1.invokeSuspend(ConfigPushProcessor.kt) at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33) at kotlinx.coroutines.internal.ScopeCoroutine.afterResume(Scopes.kt:33) at kotlinx.coroutines.AbstractCoroutine.resumeWith(AbstractCoroutine.kt:102) at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:46) at kotlinx.coroutines.internal.ScopeCoroutine.afterResume(Scopes.kt:33) at kotlinx.coroutines.AbstractCoroutine.resumeWith(AbstractCoroutine.kt:102) at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:46) at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:104) at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:570) at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:750) at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:677) at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:664)

mirai-core 版本

2.16.0

bot-protocol

ANDROID_WATCH

其他组件版本

No response

系统日志

No response

网络日志

No response

补充信息

No response

大佬有方案了么

cjalchange commented 7 months ago

我这也碰到了, mirai-core 2.16.0,协议是 ANDROID_PAD 8.9.83,而且出现的概率还挺高的。

zhaodice commented 6 months ago

我提交了个补丁也许可以修复

kkgg0521 commented 6 months ago

我提交了个补丁也许可以修复

在哪里可能看到你的补丁

OOO-li-ooo commented 5 months ago

我提交了个补丁也许可以修复

可能会导致不停反复登陆

zhaodice commented 5 months ago

我提交了个补丁也许可以修复

可能会导致不停反复登陆

所以自己改吧!我把timeout改成了小时级

rrrxxxvvv commented 4 months ago

我提交了个补丁也许可以修复

可能会导致不停反复登陆

所以自己改吧!我把timeout改成了小时级

请问timeout在哪里设置呢?在mirai-core的开发中

zhaodice commented 4 months ago

我提交了个补丁也许可以修复

可能会导致不停反复登陆

所以自己改吧!我把timeout改成了小时级

请问timeout在哪里设置呢?在mirai-core的开发中

/*
 * Copyright 2019-2022 Mamoe Technologies and contributors.
 *
 * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
 * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
 *
 * https://github.com/mamoe/mirai/blob/dev/LICENSE
 */

package net.mamoe.mirai.internal.network.components

import kotlinx.coroutines.withTimeoutOrNull
import net.mamoe.mirai.event.EventPriority
import net.mamoe.mirai.event.events.BotOfflineEvent
import net.mamoe.mirai.event.globalEventChannel
import net.mamoe.mirai.event.nextEvent
import net.mamoe.mirai.internal.network.component.ComponentKey
import net.mamoe.mirai.internal.network.handler.NetworkHandler
import net.mamoe.mirai.internal.network.handler.selector.NetworkException
import net.mamoe.mirai.internal.network.protocol.packet.login.ConfigPushSvc
import net.mamoe.mirai.utils.MiraiLogger
import net.mamoe.mirai.utils.warning

/**
 * Job: Switch server if ConfigPush not received.
 */
internal interface ConfigPushProcessor {
    suspend fun syncConfigPush(network: NetworkHandler)

    companion object : ComponentKey<ConfigPushProcessor>
}

internal class ConfigPushProcessorImpl(
    private val logger: MiraiLogger,
) : ConfigPushProcessor {
    override suspend fun syncConfigPush(network: NetworkHandler) {
        val resp = withTimeoutOrNull(60_000 * 30) {
            globalEventChannel().nextEvent<ConfigPushSvc.PushReq.PushReqResponse>(
                EventPriority.MONITOR
            ) { it.bot == network.context.bot }
        }

        if (resp == null) {
            val bdhSyncer = network.context[BdhSessionSyncer]
            if (!bdhSyncer.hasSession) {
                //val e = IllegalStateException("Timeout waiting for ConfigPush.")
                /*
                val e = NetworkException("Timeout waiting for ConfigPush.",true)
                bdhSyncer.bdhSession.completeExceptionally(e)
                logger.warning { "Missing ConfigPush. Switching server..." }
                network.context[SsoProcessor].casFirstLoginResult(null, FirstLoginResult.CHANGE_SERVER)
                network.context.bot.components[EventDispatcher].broadcastAsync(
                    BotOfflineEvent.RequireReconnect(
                        network.context.bot,
                        e
                    )
                )*/
                logger.warning { "Missing ConfigPush. 丢失BDH通道,可能无法正常上传媒体数据,重启可能会解决问题" }
            }
        }
    }

}