机器人运行中,当我使用okhttp3进行http请求的时候,会出现机器人直接掉线的情况,请问有人知道是什么原因吗?偶尔出现。QQ截图20230320032144.png
错误信息:2023-03-20 02:46:33 V/Bot.3489291735: Event: BotOfflineEvent.Dropped(bot=Bot(3489291735), cause=HeartbeatFailedException: 3489291735.StatHeartbeat, recoverable=true, cause=PacketTimeoutException(message=3489291735.StatHeartbeat Scheduler: Timeout receiving action response, cause=kotlinx.coroutines.TimeoutCancellationException: Timed out waiting for 5000 ms), reconnect=true)
2023-03-20 02:46:33 W/Bot.3489291735: Connection lost, reconnecting... (HeartbeatFailedException: 3489291735.StatHeartbeat, recoverable=true, cause=PacketTimeoutException(message=3489291735.StatHeartbeat Scheduler: Timeout receiving action response, cause=kotlinx.coroutines.TimeoutCancellationException: Timed out waiting for 5000 ms))
2023-03-20 02:46:33 W/Bot.3489291735: An exception occurred when processing event. Subscriber scope: '<unnamed>'. Broadcaster scope: 'Bot 3489291735.EventDispatcher'
java.lang.IllegalStateException: NetworkHandler is already closed.
at net.mamoe.mirai.internal.network.handler.CommonNetworkHandler$StateClosed.sendPacketImpl(CommonNetworkHandler.kt:389)
at net.mamoe.mirai.internal.network.handler.CommonNetworkHandler.sendPacketImpl(CommonNetworkHandler.kt:36)
at net.mamoe.mirai.internal.network.handler.NetworkHandlerSupport.sendAndExpect(NetworkHandlerSupport.kt:123)
at net.mamoe.mirai.internal.network.handler.NetworkHandlerSupport$sendAndExpect$1.invokeSuspend(NetworkHandlerSupport.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.DispatchedTask.run(DispatchedTask.kt:233)
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)
Suppressed: kotlinx.coroutines.TimeoutCancellationException: Timed out waiting for 5000 ms
at kotlinx.coroutines.TimeoutKt.TimeoutCancellationException(Timeout.kt:184)
at kotlinx.coroutines.TimeoutCoroutine.run(Timeout.kt:154)
at kotlinx.coroutines.EventLoopImplBase$DelayedRunnableTask.run(EventLoop.common.kt:508)
at kotlinx.coroutines.EventLoopImplBase.processNextEvent(EventLoop.common.kt:284)
at kotlinx.coroutines.DefaultExecutor.run(DefaultExecutor.kt:108)
at java.base/java.lang.Thread.run(Unknown Source)
最后是一句2023-03-20 02:47:03 I/Bot.3489291735: Bot cancelled: Bot closed。
我看了下我的代码,QQ截图20230320032403.png
QQ截图20230320032421.png 大概率是到这个地方报错了。但是我也不确定是不是代码的问题,因为大部分时间都正常。我刚学kotlin不是很懂,麻烦大佬们看看。
- Home
- BUG反馈
-
0
Votes2
Posts168
Views -
0
Votes1
Posts86
Views -
0
Votes1
Posts68
Views -
0
Votes1
Posts211
Views -
4
Votes27
Posts3457
Views -
0
Votes5
Posts487
Views -
0
Votes1
Posts99
Views -
0
Votes7
Posts302
Views -
0
Votes6
Posts159
Views -
0
Votes3
Posts228
Views -
0
Votes3
Posts170
Views -
0
Votes5
Posts195
Views -
0
Votes2
Posts164
Views -
0
Votes7
Posts1462
Views -
0
Votes1
Posts99
Views -
0
Votes3
Posts180
Views -
0
Votes1
Posts241
Views -
0
Votes7
Posts282
Views -
0
Votes2
Posts293
Views -
0
Votes2
Posts209
Views