nginx / nginx/docker-nginx

Connection Timed out always seen for UDP when num req/rsp are matched given a wrong perception on upstream delay

Open
#877 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Shell
Stars
3.5k
Forks
1.8k
Avg merge
42m
Merged PRs (30d)
2

Description

Describe the bug

When number of UDP Req/Rsp matched session should be deleted without any error log

To reproduce

Configured UDP Req/Rsp to 10/10 and send 10 packet and receive 10 rsp

Expected behavior

Post 10 req/rsp session should be cleaned up without any error log saying timed out

Your environment

nginx:alpine

Additional context

                if (pscf->responses == NGX_MAX_INT32_VALUE
                    || (u->responses >= pscf->responses * u->requests))
                {

                    /*
                     * successfully terminate timed out UDP session
                     * if expected number of responses was received
                     */

                    handler = c->log->handler;
                    c->log->handler = NULL;

                    c->log->handler = handler;

                    ngx_stream_proxy_finalize(s, NGX_STREAM_OK);
                    return;
                }

I expect above condition should rather be

                if (pscf->responses == NGX_MAX_INT32_VALUE
                    || (u->responses >=  u->requests)) << like this
                {

                    /*

Seeing always log

2024/04/08 20:31:58 [error] 1932#0: *131 upstream timed out (110: Connection timed out) while proxying connection, udp client: 127.0.0.1, server: 0.0.0.0:3123, upstream: "127.0.0.1:8084", bytes from/to client:0/170, bytes from/to upstream:170/0

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the UDP stream proxy timeout handler containing the responses and requests condition shown in the issue, then trace how matched request/response counts trigger session cleanup. Reproduce the 10/10 UDP case and verify that a completed session exits without an upstream timed-out error log.

Written by the indexing model from the issue text.

Assessment

Tech stack
nginx
Domain
networking
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.