Connection reset by peer: socket write error

现场反馈,有一个导出报错,点导出按钮之后,等待一会之后就报错。
1.要现场发回来weblogic日志:
Caused by: java.net.SocketException: Connection reset by peer: socket write error
at java.net.SocketOutputStream.socketWrite0(Native Method) ~[na:1.6.0_43]
at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:92) ~[na:1.6.0_43]
at java.net.SocketOutputStream.write(SocketOutputStream.java:136) ~[na:1.6.0_43]
at weblogic.servlet.internal.ChunkOutput.writeChunkNoTransfer(ChunkOutput.java:591) ~[weblogic.jar:10.3.5.0]
at weblogic.servlet.internal.ChunkOutput.writeChunks(ChunkOutput.java:540) ~[weblogic.jar:10.3.5.0]
at weblogic.servlet.internal.ChunkOutput.flush(ChunkOutput.java:427) ~[weblogic.jar:10.3.5.0]
at weblogic.servlet.internal.ChunkOutput$2.checkForFlush(ChunkOutput.java:648) ~[weblogic.jar:10.3.5.0]
at weblogic.servlet.internal.ChunkOutput.write(ChunkOutput.java:333) ~[weblogic.jar:10.3.5.0]
at weblogic.servlet.internal.ChunkOutputWrapper.write(ChunkOutputWrapper.java:148) ~[weblogic.jar:10.3.5.0]
at weblogic.servlet.internal.ServletOutputStreamImpl.write(ServletOutputStreamImpl.java:148) ~[weblogic.jar:10.3.5.0]
at com.gg.report.rtprojectbase.action.RExportAction.ggExcel(ggExportAction.java:308) ~[RExportAction.class:na]
… 55 common frames omitted

可以分析出ggExportAction.java:308
while ((bytesRead = pi.read(blobbytes)) != -1) {
sos.write(blobbytes, 0, bytesRead); 这一行报错
}

2.Caused by: java.net.SocketException: Connection reset by peer: socket write error
这种错误是客户端连服务器的连接被关闭了。通常是服务器向客户端发数据,但浏览器关闭了,但是现在显然不是这种情况。

3.为了找到中断的原因,用wireshark捕获包看看。
6802 75.325554 10.11.15.157 10.10.15.120 HTTP 1404 POST /web/gg/report/rExportAction.do?userId=gg&reportYear=2020&reportMonth=5 HTTP/1.1 (application/x-www-form-urlencoded)
6803 75.326541 10.10.15.120 10.11.15.157 TCP 60 9001 → 49269 [ACK] Seq=401432 Ack=82634 Win=99712 Len=0
7992 105.327785 10.10.15.120 10.11.15.157 HTTP 738 HTTP/1.1 502 Bad Gateway (text/html)
Hypertext Transfer Protocol
HTTP/1.1 502 Bad Gateway\r\n
[Expert Info (Chat/Sequence): HTTP/1.1 502 Bad Gateway\r\n]
[HTTP/1.1 502 Bad Gateway\r\n]
[Severity level: Chat]
[Group: Sequence]
Response Version: HTTP/1.1
Status Code: 502
[Status Code Description: Bad Gateway]
Response Phrase: Bad Gateway
Server: nginx/1.9.3\r\n
Date: Wed, 17 Jun 2020 01:31:01 GMT\r\n
Content-Type: text/html\r\n
Content-Length: 506\r\n
[Content length: 506]
Connection: keep-alive\r\n
ETag: “58726d6a-1fa”\r\n
\r\n
[HTTP response 94/95]
[Time since request: 30.002700000 seconds]
[Prev request in frame: 6802]
[Prev response in frame: 7992]
[Request in frame: 8584]
[Next request in frame: 10221]
[Next response in frame: 11009]
[Request URI [truncated]: /web/gg/report/rExportAction.do?userId=gg&reportYear=2020&reportMonth=5&]
File Data: 506 bytes

10221 174.046939 10.11.15.157 10.10.15.120 HTTP 1404 POST /web/gg/report/rExportAction.do?userId=gg&reportYear=2020&reportMonth=5 HTTP/1.1 (application/x-www-form-urlencoded)
10222 174.049086 10.10.15.120 10.11.15.157 TCP 60 9001 → 49269 [ACK] Seq=402800 Ack=85334 Win=99712 Len=0
11009 204.049191 10.10.15.120 10.11.15.157 HTTP 743 HTTP/1.1 504 Gateway Time-out (text/html)
Hypertext Transfer Protocol
HTTP/1.1 504 Gateway Time-out\r\n
[Expert Info (Chat/Sequence): HTTP/1.1 504 Gateway Time-out\r\n]
[HTTP/1.1 504 Gateway Time-out\r\n]
[Severity level: Chat]
[Group: Sequence]
Response Version: HTTP/1.1
Status Code: 504
[Status Code Description: Gateway Time-out]
Response Phrase: Gateway Time-out
Server: nginx/1.9.3\r\n
Date: Wed, 17 Jun 2020 01:31:49 GMT\r\n
Content-Type: text/html\r\n
Content-Length: 506\r\n
[Content length: 506]
Connection: keep-alive\r\n
ETag: “58726d6a-1fa”\r\n
\r\n
[HTTP response 95/95]
[Time since request: 30.002252000 seconds]
[Prev request in frame: 8584]
[Prev response in frame: 9566]
[Request in frame: 10221]
[Request URI [truncated]: /web/gg/report/rExportAction.do?userId=gg&reportYear=2020&reportMonth=5&]
File Data: 506 bytes

从捕获多次点击功能的包来看,都是等待了30s,之后就报网关错误,说明连接被某个东西断掉了。weblogic里面没有这种配置,可能是防火墙,可能是其他。

4.可以看到nginx相关报错,检查其配置文件:
location /web/gg {
proxy_send_timeout 30;
proxy_read_timeout 30;

}
proxy_read_timeout:连接成功后_等候后端服务器响应时间_其实已经进入后端的排队之中等候处理(也可以说是后端服务器处理请求的时间)
proxy_send_timeout :后端服务器数据回传时间_就是在规定时间之内后端服务器必须传完所有的数据

5.把这两个参数都调整为300, 再次测试通过。

你可能感兴趣的:(互联网技术,weblogic)