nginx report upstream timed out (10060: A connection attempt failed)但实际上服务收到了请求

nginx report upstream timed out (10060: A connection attempt failed)but actually the service received the request

OS: windows 10

服务类型:SpringBoot

构建的HTTP服务器

我的场景是提供附件上传接口,附件base64编码后作为body参数上传到服务。在大多数情况下它可以正常工作。今天遇到一个请求,大小6M左右,每次nginx都会报“upstream timed out (10060: A connection attempt failed)”。blow是nginx的errorlog。

所以我用wireshark抓包,发现两个网络包之间有1分钟的间隔,可能是这个原因,但我不知道怎么解释。有人遇到过同样的问题吗?

Wireshark 图片:

nginx 错误日志:

2021/09/26 14:02:59 [debug] 24844#25224: *115 http upstream dummy handler
2021/09/26 14:02:59 [debug] 24844#25224: worker cycle
2021/09/26 14:02:59 [debug] 24844#25224: select event: fd:560 wr:0
2021/09/26 14:02:59 [debug] 24844#25224: select event: fd:608 wr:0
2021/09/26 14:02:59 [debug] 24844#25224: select event: fd:616 wr:0
2021/09/26 14:02:59 [debug] 24844#25224: select timer: 57
2021/09/26 14:02:59 [debug] 24844#25224: select ready 0
2021/09/26 14:02:59 [debug] 24844#25224: timer delta: 63
2021/09/26 14:02:59 [debug] 24844#25224: *115 event timer del: 616: 548607287
2021/09/26 14:02:59 [debug] 24844#25224: *115 http upstream request: "/xxx/yyy?"
2021/09/26 14:02:59 [debug] 24844#25224: *115 http upstream process upstream
2021/09/26 14:02:59 [error] 24844#25224: *115 upstream timed out (10060: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond) while reading upstream, client: 127.0.0.1, server: localhost, request: "POST /xxx/yyy HTTP/1.1", upstream: "http://127.0.0.1:9099/xxx/yyy", host: "localhost:80"
2021/09/26 14:02:59 [debug] 24844#25224: *115 http upstream exit: 00000000
2021/09/26 14:02:59 [debug] 24844#25224: *115 finalize http upstream request: 502
2021/09/26 14:02:59 [debug] 24844#25224: *115 finalize http proxy request
2021/09/26 14:02:59 [debug] 24844#25224: *115 free rr peer 1 0
2021/09/26 14:02:59 [debug] 24844#25224: *115 close http upstream connection: 616
2021/09/26 14:02:59 [debug] 24844#25224: *115 free: 02B7D598, unused: 88
2021/09/26 14:02:59 [debug] 24844#25224: *115 select del event fd:616 ev:768````

增加proxy_read_timeout

proxy_read_timeout 300;