Mrs4s / go-cqhttp

cqhttp的golang实现,轻量、原生跨平台.
GNU Affero General Public License v3.0
10.41k stars 1.63k forks source link

[Bug]: qsign崩溃后重启,gocq无法正确的重连 #2303

Closed mmmjie closed 1 year ago

mmmjie commented 1 year ago

请确保您已阅读以上注意事项,并勾选下方的确认框。

go-cqhttp 版本

dev

运行环境

Ubuntu

运行架构

ARM [64] (别名:AArch64 / ARMv8)

连接方式

WebSocket (反向)

使用协议

0 | iPad

重现步骤

gocq dev版对接qsign1.1.5 协议6,arm64 gocq启动会提示 [2023-07-19 10:00:45] [INFO]: 使用服务器 http://127.0.0.1:26005 进行数据包签名 [2023-07-19 10:00:50] [WARNING]: 注册QQ实例时出现错误: Get "http://127.0.0.1:26005/register?uin=1921659661&android_id=61636562353566363037383136346263&guid=95e072cc2e7e8f406a90de90acd4e062&qimei36=808037972e4a3091935909fd100014c1730d&key=114514": context deadline exceeded (Client.Timeout exceeded while awaiting headers) server: http://127.0.0.1:26005/

但不影响使用,可以正常发消息不会风控, 但如果qisn崩溃过一次然后自动重启了,那gocq连接qsign,qsign会报错第一次连接需要客户端ID,这时候需要gocq手动关闭重新启动,然后发送一次相关信息才可以正确的链接,不然后面发消息会直接提示风控发不出去。

以下是qsign相关日志 moe.fuqiuluo.api.MissingKeyError: First use must be submitted with android_id and guid. at moe.fuqiuluo.api.MissingKeyError.(exceptions.kt) at moe.fuqiuluo.api.QsignKt.requestSign(qsign.kt:70) at moe.fuqiuluo.api.QsignKt.access$requestSign(qsign.kt:1) at moe.fuqiuluo.api.QsignKt$sign$2.invokeSuspend(qsign.kt:45) at moe.fuqiuluo.api.QsignKt$sign$2.invoke(qsign.kt) at moe.fuqiuluo.api.QsignKt$sign$2.invoke(qsign.kt) at io.ktor.server.routing.Route$buildPipeline$1$1.invokeSuspend(Route.kt:116) at io.ktor.server.routing.Route$buildPipeline$1$1.invoke(Route.kt) at io.ktor.server.routing.Route$buildPipeline$1$1.invoke(Route.kt) at io.ktor.util.pipeline.SuspendFunctionGun.loop(SuspendFunctionGun.kt:120) at io.ktor.util.pipeline.SuspendFunctionGun.proceed(SuspendFunctionGun.kt:78) at io.ktor.util.pipeline.SuspendFunctionGun.execute$ktor_utils(SuspendFunctionGun.kt:98) at io.ktor.util.pipeline.Pipeline.execute(Pipeline.kt:77) at io.ktor.server.routing.Routing$executeResult$$inlined$execute$1.invokeSuspend(Pipeline.kt:478) at io.ktor.server.routing.Routing$executeResult$$inlined$execute$1.invoke(Pipeline.kt) at io.ktor.server.routing.Routing$executeResult$$inlined$execute$1.invoke(Pipeline.kt) at io.ktor.util.debug.ContextUtilsKt.initContextInDebugMode(ContextUtils.kt:17) at io.ktor.server.routing.Routing.executeResult(Routing.kt:190) at io.ktor.server.routing.Routing.interceptor(Routing.kt:64) at io.ktor.server.routing.Routing$Plugin$install$1.invokeSuspend(Routing.kt:140) at io.ktor.server.routing.Routing$Plugin$install$1.invoke(Routing.kt) at io.ktor.server.routing.Routing$Plugin$install$1.invoke(Routing.kt) at io.ktor.util.pipeline.SuspendFunctionGun.loop(SuspendFunctionGun.kt:120) at io.ktor.util.pipeline.SuspendFunctionGun.proceed(SuspendFunctionGun.kt:78) at io.ktor.server.engine.BaseApplicationEngineKt$installDefaultTransformationChecker$1.invokeSuspend(BaseApplicationEngine.kt:124) at io.ktor.server.engine.BaseApplicationEngineKt$installDefaultTransformationChecker$1.invoke(BaseApplicationEngine.kt) at io.ktor.server.engine.BaseApplicationEngineKt$installDefaultTransformationChecker$1.invoke(BaseApplicationEngine.kt) at io.ktor.util.pipeline.SuspendFunctionGun.loop(SuspendFunctionGun.kt:120) at io.ktor.util.pipeline.SuspendFunctionGun.proceed(SuspendFunctionGun.kt:78) at io.ktor.server.application.hooks.CallFailed$install$1$1.invokeSuspend(CommonHooks.kt:45) at io.ktor.server.application.hooks.CallFailed$install$1$1.invoke(CommonHooks.kt) at io.ktor.server.application.hooks.CallFailed$install$1$1.invoke(CommonHooks.kt) at kotlinx.coroutines.intrinsics.UndispatchedKt.startUndispatchedOrReturn(Undispatched.kt:78) at kotlinx.coroutines.CoroutineScopeKt.coroutineScope(CoroutineScope.kt:264) at io.ktor.server.application.hooks.CallFailed$install$1.invokeSuspend(CommonHooks.kt:44) at io.ktor.server.application.hooks.CallFailed$install$1.invoke(CommonHooks.kt) at io.ktor.server.application.hooks.CallFailed$install$1.invoke(CommonHooks.kt) at io.ktor.util.pipeline.SuspendFunctionGun.loop(SuspendFunctionGun.kt:120) at io.ktor.util.pipeline.SuspendFunctionGun.proceed(SuspendFunctionGun.kt:78) at io.ktor.util.pipeline.SuspendFunctionGun.execute$ktor_utils(SuspendFunctionGun.kt:98) at io.ktor.util.pipeline.Pipeline.execute(Pipeline.kt:77) at io.ktor.server.engine.DefaultEnginePipelineKt$defaultEnginePipeline$1$invokeSuspend$$inlined$execute$1.invokeSuspend(Pipeline.kt:478) at io.ktor.server.engine.DefaultEnginePipelineKt$defaultEnginePipeline$1$invokeSuspend$$inlined$execute$1.invoke(Pipeline.kt) at io.ktor.server.engine.DefaultEnginePipelineKt$defaultEnginePipeline$1$invokeSuspend$$inlined$execute$1.invoke(Pipeline.kt) at io.ktor.util.debug.ContextUtilsKt.initContextInDebugMode(ContextUtils.kt:17) at io.ktor.server.engine.DefaultEnginePipelineKt$defaultEnginePipeline$1.invokeSuspend(DefaultEnginePipeline.kt:118) at io.ktor.server.engine.DefaultEnginePipelineKt$defaultEnginePipeline$1.invoke(DefaultEnginePipeline.kt) at io.ktor.server.engine.DefaultEnginePipelineKt$defaultEnginePipeline$1.invoke(DefaultEnginePipeline.kt) at io.ktor.util.pipeline.SuspendFunctionGun.loop(SuspendFunctionGun.kt:120) at io.ktor.util.pipeline.SuspendFunctionGun.proceed(SuspendFunctionGun.kt:78) at io.ktor.util.pipeline.SuspendFunctionGun.execute$ktor_utils(SuspendFunctionGun.kt:98) at io.ktor.util.pipeline.Pipeline.execute(Pipeline.kt:77) at io.ktor.server.netty.NettyApplicationCallHandler$handleRequest$1$invokeSuspend$$inlined$execute$1.invokeSuspend(Pipeline.kt:478) at io.ktor.server.netty.NettyApplicationCallHandler$handleRequest$1$invokeSuspend$$inlined$execute$1.invoke(Pipeline.kt) at io.ktor.server.netty.NettyApplicationCallHandler$handleRequest$1$invokeSuspend$$inlined$execute$1.invoke(Pipeline.kt) at io.ktor.util.debug.ContextUtilsKt.initContextInDebugMode(ContextUtils.kt:17) at io.ktor.server.netty.NettyApplicationCallHandler$handleRequest$1.invokeSuspend(NettyApplicationCallHandler.kt:119) at io.ktor.server.netty.NettyApplicationCallHandler$handleRequest$1.invoke(NettyApplicationCallHandler.kt) at io.ktor.server.netty.NettyApplicationCallHandler$handleRequest$1.invoke(NettyApplicationCallHandler.kt) at kotlinx.coroutines.intrinsics.UndispatchedKt.startCoroutineUndispatched(Undispatched.kt:44) at kotlinx.coroutines.CoroutineStart.invoke(CoroutineStart.kt:112) at kotlinx.coroutines.AbstractCoroutine.start(AbstractCoroutine.kt:126) at kotlinx.coroutines.BuildersKt__Builders_commonKt.launch(Builders.common.kt:56) at kotlinx.coroutines.BuildersKt.launch(Unknown Source) at io.ktor.server.netty.NettyApplicationCallHandler.handleRequest(NettyApplicationCallHandler.kt:37) at io.ktor.server.netty.NettyApplicationCallHandler.channelRead(NettyApplicationCallHandler.kt:29) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:444) at io.netty.channel.AbstractChannelHandlerContext.access$600(AbstractChannelHandlerContext.java:61) at io.netty.channel.AbstractChannelHandlerContext$7.run(AbstractChannelHandlerContext.java:425) at io.netty.util.concurrent.AbstractEventExecutor.runTask(AbstractEventExecutor.java:174) at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:167) at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:470) at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:569) at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:997) at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74) at io.ktor.server.netty.EventLoopGroupProxy$Companion.create$lambda$1$lambda$0(NettyApplicationEngine.kt:296) at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) at java.base/java.lang.Thread.run(Thread.java:1589)

期望的结果是什么?

可以正确的重新建立连接

实际的结果是什么?

@@

简单的复现代码/链接(可选)

No response

日志记录(可选)

No response

补充说明(可选)

No response

coder9029 commented 1 year ago

+1,我昨天部署也遇到了

Erstwhile-Liu commented 1 year ago

因为qsign崩溃后内存被释放掉了,之前注册的实例就没了,重启qsign后需要重新注册实例才能正常调用,所以等go-cq作者更新适配自动注册实例应该就可以解决了

ghost commented 1 year ago

好像是注册时间只有5秒慢一点就失败了。

KomeiDiSanXian commented 1 year ago

2309 你看看我刚提交的这个pr有没有解决你的这个问题,记得把签名服务器自动注册实例打开,应该就没这个问题了

至于那个错误是因为go-cq的请求client的超时时间设置为5秒,五秒后就返回超时,断开连接了,就收不到qsign那边的回复了