前端使用的vue连接后端webSocket
后端一直报这个错误 java.io.EOFException
java.io.EOFException at org.apache.tomcat.util.net.NioEndpoint$NioSocketWrapper.fillReadBuffer(NioEndpoint.java:1231) at org.apache.tomcat.util.net.NioEndpoint$NioSocketWrapper.read(NioEndpoint.java:1141) at org.apache.tomcat.websocket.server.WsframeServer.onDataAvailable(WsframeServer.java:75) at org.apache.tomcat.websocket.server.WsframeServer.doonDataAvailable(WsframeServer.java:183) at org.apache.tomcat.websocket.server.WsframeServer.notifyDataAvailable(WsframeServer.java:162) at org.apache.tomcat.websocket.server.WsHttpUpgradeHandler.upgradeDispatch(WsHttpUpgradeHandler.java:156) at org.apache.coyote.http11.upgrade.UpgradeProcessorInternal.dispatch(UpgradeProcessorInternal.java:60) at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:59) at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:888) at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1597) at org.apache.tomcat.util.net.SocketProcessorbase.run(SocketProcessorbase.java:49) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) at java.lang.Thread.run(Thread.java:748)
一直以为是前端设置的接口超时时间导致的,然后经过修改前端接口超时时间也没有明显效果
1.然后想到了曲线救国的方式
就是前端每次失败时候调用close方法的时候再重新调用一次连接方法,哈哈哈哈哈,然后就会出现下面的这种情况
admin加入webSocket!当前人数为1 15:10:32.687 [QuartzScheduler_RuoyiScheduler-iZ8vb3puchpd0at9ah4fjfZ1635729154459_ClusterManager] WARN c.a.d.p.DruidAbstractDataSource - [testConnectionInternal,1489] - discard long time none received connection. , jdbcUrl : jdbc:mysql://localhost:3306/uw?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8, version : 1.2.4, lastPacketReceivedIdleMillis : 204783 发生错误 java.io.EOFException at org.apache.tomcat.util.net.NioEndpoint$NioSocketWrapper.fillReadBuffer(NioEndpoint.java:1231) at org.apache.tomcat.util.net.NioEndpoint$NioSocketWrapper.read(NioEndpoint.java:1141) at org.apache.tomcat.websocket.server.WsframeServer.onDataAvailable(WsframeServer.java:75) at org.apache.tomcat.websocket.server.WsframeServer.doonDataAvailable(WsframeServer.java:183) at org.apache.tomcat.websocket.server.WsframeServer.notifyDataAvailable(WsframeServer.java:162) at org.apache.tomcat.websocket.server.WsHttpUpgradeHandler.upgradeDispatch(WsHttpUpgradeHandler.java:156) at org.apache.coyote.http11.upgrade.UpgradeProcessorInternal.dispatch(UpgradeProcessorInternal.java:60) at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:59) at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:888) at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1597) at org.apache.tomcat.util.net.SocketProcessorbase.run(SocketProcessorbase.java:49) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) at java.lang.Thread.run(Thread.java:748) admin断开webSocket连接!当前人数为0 15:11:18.752 [http-nio-8081-exec-28] DEBUG c.r.s.m.S.selectRolesByUserName - [debug,137] - ==> Preparing: select distinct r.role_id, r.role_name, r.role_key, r.role_sort, r.data_scope, r.menu_check_strictly, r.dept_check_strictly, r.status, r.del_flag, r.create_time, r.remark from sys_role r left join sys_user_role ur on ur.role_id = r.role_id left join sys_user u on u.user_id = ur.user_id left join sys_dept d on u.dept_id = d.dept_id WHERe r.del_flag = '0' and u.user_name = ? 15:11:18.753 [http-nio-8081-exec-28] DEBUG c.r.s.m.S.selectRolesByUserName - [debug,137] - ==> Parameters: admin(String) 15:11:18.812 [http-nio-8081-exec-28] DEBUG c.r.s.m.S.selectRolesByUserName - [debug,137] - <== Total: 1 15:11:18.813 [http-nio-8081-exec-28] DEBUG c.r.s.m.S.selectPostsByUserName - [debug,137] - ==> Preparing: select p.post_id, p.post_name, p.post_code from sys_post p left join sys_user_post up on up.post_id = p.post_id left join sys_user u on u.user_id = up.user_id where u.user_name = ? 15:11:18.814 [http-nio-8081-exec-28] DEBUG c.r.s.m.S.selectPostsByUserName - [debug,137] - ==> Parameters: admin(String) 15:11:18.822 [http-nio-8081-exec-28] DEBUG c.r.s.m.S.selectPostsByUserName - [debug,137] - <== Total: 1 admin加入webSocket!当前人数为1 15:12:06.444 [QuartzScheduler_RuoyiScheduler-iZ8vb3puchpd0at9ah4fjfZ1635729154459_ClusterManager] WARN c.a.d.p.DruidAbstractDataSource - [testConnectionInternal,1489] - discard long time none received connection. , jdbcUrl : jdbc:mysql://localhost:3306/uw?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8, version : 1.2.4, lastPacketReceivedIdleMillis : 93002 15:12:14.201 [QuartzScheduler_RuoyiScheduler-iZ8vb3puchpd0at9ah4fjfZ1635729154459_MisfireHandler] ERROR c.a.d.f.s.StatFilter - [internalAfterStatementExecute,487] - slow sql 12790 millis. SELECT COUNT(TRIGGER_NAME) FROM QRTZ_TRIGGERS WHERe SCHED_NAME = 'RuoyiScheduler' AND NOT (MISFIRE_INSTR = -1) AND NEXT_FIRE_TIME < ? AND TRIGGER_STATE = ?[1635750709411,"WAITING"] 发生错误 java.io.EOFException at org.apache.tomcat.util.net.NioEndpoint$NioSocketWrapper.fillReadBuffer(NioEndpoint.java:1231)
循环往复的调用,但是这个有一个问题就是 在点开的间隙如果来消息那么是接收不到的。
2.经过学习,可能是nginx的原因,将nginx接口的超时时间加长就好了
具体如下:
location /socket/ { proxy_pass http://xxxxx/socket/; proxy_http_version 1.1; proxy_connect_timeout 86400s; proxy_read_timeout 86400s; proxy_send_timeout 86400s; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; proxy_set_header X-real-ip $remote_addr; proxy_set_header X-Forwarded-For $remote_addr; }
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)