用websocket长时间连接mirai-http2.5.2报错
-
最近遇到奇怪的问题,我的机器人程序是分为两个部分:
第一部分,部署在运行mirai的服务器上,用环回127.0.0.1地址websocket连接。
第二部分,在另一台服务器上用公网地址websocket连接mirai服务器。每天到凌晨的时候,使用公网地址连接的机器人程序就会收不到信息,但是使用环回地址连接的机器人程序仍然是正常运行的,直到我重启mirai才会解决,该问题观察了一个多星期了只会出现在凌晨的时候。
出现问题的时候,每收到一条信息的时候,mirai日志上就会出现以下报错:
[31m2022-06-26 07:26:28 E/Mah Debug: java.util.concurrent.CancellationException: ArrayChannel was cancelled java.util.concurrent.CancellationException: ArrayChannel was cancelled at kotlinx.coroutines.channels.AbstractChannel.cancel(AbstractChannel.kt:656) at kotlinx.coroutines.channels.ReceiveChannel$DefaultImpls.cancel$default(Channel.kt:279) at io.ktor.http.cio.websocket.DefaultWebSocketSessionImpl$runOutgoingProcessor$1.invokeSuspend(DefaultWebSocketSessionImpl.kt:182) at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33) at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106) at kotlinx.coroutines.EventLoop.processUnconfinedEvent(EventLoop.common.kt:69) at kotlinx.coroutines.DispatchedTaskKt.resumeUnconfined(DispatchedTask.kt:245) at kotlinx.coroutines.DispatchedTaskKt.dispatch(DispatchedTask.kt:161) at kotlinx.coroutines.CancellableContinuationImpl.dispatchResume(CancellableContinuationImpl.kt:397) at kotlinx.coroutines.CancellableContinuationImpl.cancel(CancellableContinuationImpl.kt:183) at kotlinx.coroutines.CancellableContinuationImpl.parentCancelled$kotlinx_coroutines_core(CancellableContinuationImpl.kt:190) at kotlinx.coroutines.ChildContinuation.invoke(JobSupport.kt:1474) at kotlinx.coroutines.JobSupport.notifyCancelling(JobSupport.kt:1499) at kotlinx.coroutines.JobSupport.tryMakeCancelling(JobSupport.kt:795) at kotlinx.coroutines.JobSupport.makeCancelling(JobSupport.kt:755) at kotlinx.coroutines.JobSupport.cancelImpl$kotlinx_coroutines_core(JobSupport.kt:671) at kotlinx.coroutines.JobSupport.parentCancelled(JobSupport.kt:637) at kotlinx.coroutines.ChildHandleNode.invoke(JobSupport.kt:1465) at kotlinx.coroutines.JobSupport.notifyCancelling(JobSupport.kt:1499) at kotlinx.coroutines.JobSupport.tryMakeCompletingSlowPath(JobSupport.kt:900) at kotlinx.coroutines.JobSupport.tryMakeCompleting(JobSupport.kt:863) at kotlinx.coroutines.JobSupport.cancelMakeCompleting(JobSupport.kt:696) at kotlinx.coroutines.JobSupport.cancelImpl$kotlinx_coroutines_core(JobSupport.kt:667) at kotlinx.coroutines.JobSupport.parentCancelled(JobSupport.kt:637) at kotlinx.coroutines.ChildHandleNode.invoke(JobSupport.kt:1465) at kotlinx.coroutines.JobSupport.notifyCancelling(JobSupport.kt:1499) at kotlinx.coroutines.JobSupport.makeCancelling(JobSupport.kt:747) at kotlinx.coroutines.JobSupport.cancelImpl$kotlinx_coroutines_core(JobSupport.kt:671) at kotlinx.coroutines.JobSupport.parentCancelled(JobSupport.kt:637) at kotlinx.coroutines.ChildHandleNode.invoke(JobSupport.kt:1465) at kotlinx.coroutines.JobSupport.notifyCancelling(JobSupport.kt:1499) at kotlinx.coroutines.JobSupport.tryMakeCancelling(JobSupport.kt:795) at kotlinx.coroutines.JobSupport.makeCancelling(JobSupport.kt:755) at kotlinx.coroutines.JobSupport.cancelImpl$kotlinx_coroutines_core(JobSupport.kt:671) at kotlinx.coroutines.JobSupport.parentCancelled(JobSupport.kt:637) at kotlinx.coroutines.ChildHandleNode.invoke(JobSupport.kt:1465) at kotlinx.coroutines.JobSupport.notifyCancelling(JobSupport.kt:1499) at kotlinx.coroutines.JobSupport.tryMakeCancelling(JobSupport.kt:795) at kotlinx.coroutines.JobSupport.makeCancelling(JobSupport.kt:755) at kotlinx.coroutines.JobSupport.cancelImpl$kotlinx_coroutines_core(JobSupport.kt:671) at kotlinx.coroutines.JobSupport.parentCancelled(JobSupport.kt:637) at kotlinx.coroutines.ChildHandleNode.invoke(JobSupport.kt:1465) at kotlinx.coroutines.JobSupport.notifyCancelling(JobSupport.kt:1499) at kotlinx.coroutines.JobSupport.tryMakeCancelling(JobSupport.kt:795) at kotlinx.coroutines.JobSupport.makeCancelling(JobSupport.kt:755) at kotlinx.coroutines.JobSupport.cancelImpl$kotlinx_coroutines_core(JobSupport.kt:671) at kotlinx.coroutines.JobSupport.cancelInternal(JobSupport.kt:632) at kotlinx.coroutines.JobSupport.cancel(JobSupport.kt:617) at kotlinx.coroutines.JobKt__JobKt.cancel(Job.kt:549) at kotlinx.coroutines.JobKt.cancel(Unknown Source) at kotlinx.coroutines.JobKt__JobKt.cancel$default(Job.kt:548) at kotlinx.coroutines.JobKt.cancel$default(Unknown Source) at io.ktor.server.cio.backend.ServerPipelineKt$startServerConnectionPipeline$1.invokeSuspend(ServerPipeline.kt:179) at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33) 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:749) at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:677) at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:664)
机器人程序都是使用Ariadne SDK写的
mirai 2.11.0
mirai-http2.5.2
Ariadne 0.7.14希望大佬们可以帮忙看看,谢谢!
现在每天早上起来第一件事就是重启mirai o(╥﹏╥)o
打算写一个定时重启脚本临时用着 -
我遇到了一样的问题
-
我这边用 mirai-ts 写的机器人也有同样的问题。只不过我这边是一启动没多久就报这个错了,但是能用。。。
-
@GeraltX 在 用websocket长时间连接mirai-http2.5.2报错 中说:
我这边用 mirai-ts 写的机器人也有同样的问题。只不过我这边是一启动没多久就报这个错了,但是能用。。。
今天再测试了一下,一开始是没问题的,但是我把 mirai-ts 的项目重新运行了,但是 mcl 没有重新运行,再收到消息就会报这个错了。