各位大佬,help help !
各位大佬好,最近本地运行项目,(客户端是一台工控机,24小时不关机的),服务端是 winserver环境,运行的是一套交互的系统,具体表现如下:1.服务端接收来自其他渠道的报警信息,放入redis
2.客户端从redis中取报警信息文本
3.redis删除此信息
目前在运行过程中,老是出现 偶尔出现如下报错:error log 如下:
2023-06-23 19:30:00.167 INFOc.hykj.audio.listener.RedisKeyExpirationListerner - 收到Redis过期回调:AUDIO_IDLE
2023-06-23 19:30:10.191 INFOc.hykj.audio.listener.RedisKeyExpirationListerner - 收到Redis过期回调:AUDIO_IDLE
2023-06-23 19:30:20.243 INFOc.hykj.audio.listener.RedisKeyExpirationListerner - 收到Redis过期回调:AUDIO_IDLE
2023-06-23 19:30:30.261 INFOc.hykj.audio.listener.RedisKeyExpirationListerner - 收到Redis过期回调:AUDIO_IDLE
2023-06-23 19:30:40.285 INFOc.hykj.audio.listener.RedisKeyExpirationListerner - 收到Redis过期回调:AUDIO_IDLE
2023-06-23 19:30:50.327 INFOc.hykj.audio.listener.RedisKeyExpirationListerner - 收到Redis过期回调:AUDIO_IDLE
2023-06-23 19:31:00.356 INFOc.hykj.audio.listener.RedisKeyExpirationListerner - 收到Redis过期回调:AUDIO_IDLE
2023-06-23 19:31:10.382 INFOc.hykj.audio.listener.RedisKeyExpirationListerner - 收到Redis过期回调:AUDIO_IDLE
2023-06-23 19:31:20.424 INFOc.hykj.audio.listener.RedisKeyExpirationListerner - 收到Redis过期回调:AUDIO_IDLE
2023-06-23 19:31:21.153 WARNio.netty.channel.DefaultChannelPipeline - An exceptionCaught() event was fired, and it reached at the tail of the pipeline. It usually means the last handler in the pipeline did not handle the exception.
java.io.IOException: 远程主机强迫关闭了一个现有的连接。
at sun.nio.ch.SocketDispatcher.read0(Native Method)
at sun.nio.ch.SocketDispatcher.read(SocketDispatcher.java:43)
at sun.nio.ch.IOUtil.readIntoNativeBuffer(IOUtil.java:223)
at sun.nio.ch.IOUtil.read(IOUtil.java:192)
at sun.nio.ch.SocketChannelImpl.read(SocketChannelImpl.java:378)
at io.netty.buffer.PooledByteBuf.setBytes(PooledByteBuf.java:256)
at io.netty.buffer.AbstractByteBuf.writeBytes(AbstractByteBuf.java:1132)
at io.netty.channel.socket.nio.NioSocketChannel.doReadBytes(NioSocketChannel.java:357)
at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:151)
at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:788)
at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:724)
at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:650)
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:562)
at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:997)
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:750)
2023-06-23 19:31:21.154 INFOcom.hykj.audio.handler.MqttNetCallback - 停止服务...
2023-06-23 19:31:21.318 INFOcom.zaxxer.hikari.HikariDataSource - HikariPool-1 - Shutdown initiated...
2023-06-23 19:31:21.320 INFOcom.zaxxer.hikari.HikariDataSource - HikariPool-1 - Shutdown completed.
2023-06-23 19:31:21.581 WARNcom.hykj.audio.utils.SerialPortUtils - 串口//./COM7关闭
2023-06-23 19:31:43.859 INFOcom.hykj.AudioApplication - Starting AudioApplication v1.0.0 using Java 1.8.0_361 on DESKTOP-KM9B675 with PID 200 (D:\hykj\server\hykj-audio.jar started by DESKTOP-KM9B675$ in D:\hykj\server)
2023-06-23 19:31:43.861 INFOcom.hykj.AudioApplication - The following 1 profile is active: "data"
2023-06-23 19:31:44.812 INFOo.s.d.r.config.RepositoryConfigurationDelegate - Multiple Spring Data modules found, entering strict repository configuration mode
2023-06-23 19:31:44.816 INFOo.s.d.r.config.RepositoryConfigurationDelegate - Bootstrapping Spring Data Redis repositories in DEFAULT mode.
2023-06-23 19:31:44.844 INFOo.s.d.r.config.RepositoryConfigurationDelegate - Finished Spring Data repository scanning in 12 ms. Found 0 Redis repository interfaces.
2023-06-23 19:31:45.640 INFOo.s.boot.web.embedded.tomcat.TomcatWebServer - Tomcat initialized with port(s): 8080 (http)
2023-06-23 19:31:45.651 INFOorg.apache.coyote.http11.Http11NioProtocol - Initializing ProtocolHandler ["http-nio-8080"]
2023-06-23 19:31:45.651 INFOorg.apache.catalina.core.StandardService - Starting service
2023-06-23 19:31:45.651 INFOorg.apache.catalina.core.StandardEngine - Starting Servlet engine:
2023-06-23 19:31:45.760 INFOo.a.c.core.ContainerBase...[/] - Initializing Spring embedded WebApplicationContext
2023-06-23 19:31:45.760 INFOo.s.b.w.s.c.ServletWebServerApplicationContext - Root WebApplicationContext: initialization completed in 1854 ms
2023-06-23 19:31:47.463 INFOc.hykj.framework.mqtt.config.MqttAutoConfiguration - hykj.audio
2023-06-23 19:31:47.463 INFOc.hykj.framework.mqtt.config.MqttAutoConfiguration - 未配置Mqtt消息接收类(此地方已经配置了回调,很多时候都是很可以重新启动成功,偶尔就会出现这个情况)
附上:回调成功log
2023-06-24 08:02:08.906 INFOcom.hykj.AudioApplication - Starting AudioApplication v1.0.0 using Java 1.8.0_361 on DESKTOP-KM9B675 with PID 6272 (D:\hykj\server\hykj-audio.jar started by DESKTOP-KM9B675$ in D:\hykj\server)
2023-06-24 08:02:08.914 INFOcom.hykj.AudioApplication - The following 1 profile is active: "data"
2023-06-24 08:02:09.938 INFOo.s.d.r.config.RepositoryConfigurationDelegate - Multiple Spring Data modules found, entering strict repository configuration mode
2023-06-24 08:02:09.941 INFOo.s.d.r.config.RepositoryConfigurationDelegate - Bootstrapping Spring Data Redis repositories in DEFAULT mode.
2023-06-24 08:02:09.985 INFOo.s.d.r.config.RepositoryConfigurationDelegate - Finished Spring Data repository scanning in 26 ms. Found 0 Redis repository interfaces.
2023-06-24 08:02:10.844 INFOo.s.boot.web.embedded.tomcat.TomcatWebServer - Tomcat initialized with port(s): 8080 (http)
2023-06-24 08:02:10.854 INFOorg.apache.coyote.http11.Http11NioProtocol - Initializing ProtocolHandler ["http-nio-8080"]
2023-06-24 08:02:10.854 INFOorg.apache.catalina.core.StandardService - Starting service
2023-06-24 08:02:10.854 INFOorg.apache.catalina.core.StandardEngine - Starting Servlet engine:
2023-06-24 08:02:11.466 INFOo.a.c.core.ContainerBase...[/] - Initializing Spring embedded WebApplicationContext
2023-06-24 08:02:11.467 INFOo.s.b.w.s.c.ServletWebServerApplicationContext - Root WebApplicationContext: initialization completed in 2498 ms
2023-06-24 08:02:13.326 INFOc.hykj.framework.mqtt.config.MqttAutoConfiguration - hykj.audio
2023-06-24 08:02:13.327 INFOc.hykj.framework.mqtt.config.MqttAutoConfiguration - 未配置Mqtt消息接收类
2023-06-24 08:02:13.578 INFOc.hykj.framework.mqtt.config.MqttAutoConfiguration - mqt配置监听:topic:hykj.audiolistener:com.hykj.audio.handler.MqttMessageListener
2023-06-24 08:02:13.583 INFOc.hykj.framework.mqtt.config.MqttAutoConfiguration - mqtt增加回调配置:mqttNetCallback
2023-06-24 08:02:13.737 INFOorg.apache.coyote.http11.Http11NioProtocol - Starting ProtocolHandler ["http-nio-8080"]
2023-06-24 08:02:13.749 INFOo.s.boot.web.embedded.tomcat.TomcatWebServer - Tomcat started on port(s): 8080 (http) with context path ''
2023-06-24 08:02:14.055 INFOcom.hykj.AudioApplication - Started AudioApplication in 5.657 seconds (JVM running for 6.144)
2023-06-24 08:02:15.340 INFOcom.hykj.AudioRunner - 发现全部串口:
2023-06-24 08:02:15.340 INFOcom.hykj.AudioRunner - 打开指定portName:COM7
2023-06-24 08:02:15.340 INFOcom.hykj.audio.utils.SerialPortUtils - 打开串口COM7
2023-06-24 08:02:15.353 INFOcom.hykj.audio.utils.SerialPortUtils - 打开串口COM7成功
2023-06-24 08:02:18.546 INFOc.hykj.audio.listener.RedisKeyExpirationListerner - 收到Redis过期回调:AUDIO_IDLE
加上断线重连,判断如果socket异常,did为空,不进行接下来的逻辑 或者改成HTTP上传!SOCKET只做连接状态,定时心跳! 有没有可能是本地网络不好 检查网络连接:确认客户端和服务端之间的网络连接是否稳定,并确保没有任何防火墙或网络配置导致通信中断。
检查串口连接:确认串口COM7的连接是否正常,检查是否有其他应用程序正在使用该串口。
检查Redis状态:确保Redis正常运行,并检查与Redis的通信是否正常。
分析报错现象:如果问题仍然存在,可以尝试根据报错发生的时间、频率以及相关操作的上下文来分析问题。查看是否有其他报错或警告信息,以及是否有特定的操作触发了报错。 XuYiXin 发表于 2023-6-25 16:10
加上断线重连,判断如果socket异常,did为空,不进行接下来的逻辑
已经加上去了,但是,并且也能成功回调,但是偶尔也不行.... 400h297004533 发表于 2023-6-27 19:35
检查网络连接:确认客户端和服务端之间的网络连接是否稳定,并确保没有任何防火墙或网络配置导致通信中断。 ...
感谢大佬,我这边按照流程捋一下
页:
[1]