最近家里三桩喜事,妹妹订婚、小宝办酒、大哥乔迁新居,请了三天假,最后一天讨论组爆出cas 登录总是403跨越问题,
初步分析可能是cas登录成功了 casclient没有处理成功导致casclient未登陆状态。
休假回来,查看系统日志发现,
CasServer 登录成功了
CasClient 报错
ERROR client.util.CommonUtils 442 getResponseFromServer- Unexpected end of file from server
在stackoverflow找到答案,如下:
“Unexpected end of file” implies that the remote server accepted and closed the connection without sending a response. It’s possible that the remote system is too busy to handle the request, or that there’s a network bug that randomly drops connections.
With the information available it’s impossible to say what’s going wrong. If you have access to the servers in question you can use packet sniffing tools to find what exactly is sent and received, and look at logs to of the server process to see if there are any error messages.
意思就是说“意外的文件结束”意味着远程服务器接受并关闭连接,而不发送响应。远程系统可能太忙,无法处理请求,或者有网络错误随机丢弃连接。
查看网络问题ping 不通,让运维开通ICMP
观察日志:
现象消失
问题又复现:
查看日志
11-Sep-2019 11:56:06.964 SEVERE [http-bio-8443-exec-2298] org.apache.coyote.http11.AbstractHttp11Processor.process Error processing request
java.lang.IllegalArgumentException: Control character in cookie value or attribute.
at org.apache.tomcat.util.http.LegacyCookieProcessor.isV0Separator(LegacyCookieProcessor.java:729)
at org.apache.tomcat.util.http.LegacyCookieProcessor.processCookieHeader(LegacyCookieProcessor.java:526)
at org.apache.tomcat.util.http.LegacyCookieProcessor.parseCookieHeader(LegacyCookieProcessor.java:256)
at org.apache.catalina.connector.Request.parseCookies(Request.java:3059)
at org.apache.catalina.connector.Request.getServerCookies(Request.java:2075)
at org.apache.catalina.connector.CoyoteAdapter.parseSessionCookiesId(CoyoteAdapter.java:1211)
at org.apache.catalina.connector.CoyoteAdapter.postParseRequest(CoyoteAdapter.java:918)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:497)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1132)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:684)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:285)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:745)
获取tomcat pid
netstat -antp | grep 8080
查看pid状态
netstat -antp | grep 121112
Linux中查看socket状态:
cat /proc/net/sockstat #(这个是ipv4的)
sockets: used 137
TCP: inuse 49 orphan 0 tw 3272 alloc 52 mem 46
UDP: inuse 1 mem 0
RAW: inuse 0
FRAG: inuse 0 memory 0
说明:
sockets: used:已使用的所有协议套接字总量
TCP: inuse:正在使用(正在侦听)的TCP套接字数量。其值≤ netstat –lnt | grep ^tcp | wc –l
TCP: orphan:无主(不属于任何进程)的TCP连接数(无用、待销毁的TCP socket数)
TCP: tw:等待关闭的TCP连接数。其值等于netstat –ant | grep TIME_WAIT | wc –l
TCP:alloc(allocated):已分配(已建立、已申请到sk_buff)的TCP套接字数量。其值等于netstat –ant | grep ^tcp | wc –l
TCP:mem:套接字缓冲区使用量(单位不详。用scp实测,速度在4803.9kB/s时:其值=11,netstat –ant 中相应的22端口的Recv-Q=0,Send-Q≈400)
UDP:inuse:正在使用的UDP套接字数量
RAW:
FRAG:使用的IP段数量
后记:
出差又报错
查询原因是:
从后端调用rest接口,该接口属于内部接口.
处理方式
访问的url链接中,不用域名,而是选用ip+端口的方式.
又报错了
"Unexpected end of file" implies that the remote server accepted and closed the connection without sending a response. It's possible that the remote system is too busy to handle the request, or that there's a network bug that randomly drops connections.
远程系统太忙了没法处理请求,一种是网络问题随机丢弃连接
With the information available it's impossible to say what's going wrong. If you have access to the servers in question you can use packet sniffing tools to find what exactly is sent and received, and look at logs to of the server process to see if there are any error messages.