Home > Mobile >  nginx report upstream timed out (10060: A connection attempt failed)but actually the service receive
nginx report upstream timed out (10060: A connection attempt failed)but actually the service receive

Time:09-29

os: windows 10

service type: an http server build by spring boot

My scenario is to provide an attachment upload interface, the attachment is uploaded to the service as a body parameter after base64 encoding.It works normally in most cases.Today I came across a request, its size is about 6M, every time nginx will report "upstream timed out (10060: A connection attempt failed".Blow is the nginx errorlog.

So I use wireshark to capture the packets, I found that there is a one minute gap between two network packets, it may be the reason,but I don't know how to explain that.Has anyone encountered the same problem?

wireshark picture

nginx error log:

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````

CodePudding user response:

increase proxy_read_timeout

proxy_read_timeout 300;

  • Related