GetPageSpeed

NGINX HTTP/3 Reload Drops Connections: Cause and Fix

You change one line in a config file and run systemctl reload nginx. NGINX promises a graceful reload: old workers finish their work, new workers take over, and nobody notices. Over HTTP/1.1 and HTTP/2 that promise mostly holds. Over HTTP/3 it breaks: every NGINX HTTP/3 reload quietly drops a handful of visitors who happened to be connecting at that moment.

Nothing appears in the error log. Browsers retry, often over HTTP/2, so the visitor sees a page that takes a second longer, or an image that never loads. On our own production server, an NGINX HTTP/3 reload cut about five connections every time.

This article shows the code in NGINX that drops them, measurements on separate machines and on production, and the fix that ships in NGINX-MOD 1.30.7-82.

Symptoms of the NGINX HTTP/3 Reload Bug

The bug only hits connections that are new when the reload happens. Long-lived connections are not affected, which is why it is easy to miss. Here is what it looks like from a client:

We first saw it on www.getpagespeed.com. The first fresh HTTP/3 request one second after a reload failed in half a second, while the same request before and after succeeded.

The Root Cause: Retiring Workers Close Handshakes at Once

When NGINX reloads, the master starts new worker processes and tells the old ones to shut down gracefully. Each old worker then calls ngx_close_idle_connections(), which sets c->close on every idle connection and calls its read handler. For QUIC connections that handler is ngx_quic_input_handler() in src/event/quic/ngx_event_quic.c:

    if (c->close) {
        c->close = 0;

        if (!ngx_exiting || !qc->streams.initialized) {
            qc->error = NGX_QUIC_ERR_NO_ERROR;
            qc->error_reason = "graceful shutdown";
            ngx_quic_close_connection(c, NGX_ERROR);
            return;
        }

        if (!qc->closing && qc->conf->shutdown) {
            qc->conf->shutdown(c);
        }

        return;
    }

The flag qc->streams.initialized is set only when the TLS handshake has completed. So a connection whose handshake is still in progress takes the first branch. NGINX sends CONNECTION_CLOSE immediately, and the client gets an error instead of the page it asked for.

Established connections take the second branch. For HTTP/3, ngx_http_v3_shutdown() sends GOAWAY and asks QUIC to close the connection once no request is active. That sounds graceful, but it has two more problems:

The same code is in stock NGINX 1.30.7 and in the current mainline. The QUIC socket handling during reload (the separate QUIC reload bug fixed by quic_bpf) does not help here. Even with perfect packet steering, the retiring worker closes these connections itself.

Measuring It on Separate Machines

We measured on three Linode machines in one region: a client, a router and a server, connected by two private VLANs. The router adds delay and packet loss with netem, with every offload disabled so that loss is decided per packet. The server runs each build from its published RPM, with two workers and quic_bpf on.

Each run opens 60 fresh HTTP/3 connections, one every 100 ms, each fetching a 10 kB object with curl 8.23 and a 15 second limit. The server is reloaded 2 seconds into the run. Ten rounds, with the builds in a new random order every round, give 600 connections per cell. The “no reload” arm runs stock NGINX without the reload, to show what the path itself costs. The second NGINX-MOD 1.30.7-82 arm repeats the same build to show the noise floor.

Bar chart of fresh HTTP/3 connections lost across an NGINX HTTP/3 reload, of 600 per cell: stock NGINX 1.30.7 12 on a clean 100 ms path and 40 at 200 ms with 1 % loss, NGINX-MOD 1.30.7-80 9 and 22, NGINX-MOD 1.30.7-82 0 and 0

Path Stock NGINX 1.30.7 Stock, no reload NGINX-MOD 1.30.7-80 NGINX-MOD 1.30.7-82 NGINX-MOD 1.30.7-82, repeat
100 ms round trip, no loss 12 of 600 failed 0 of 600 9 of 600 0 of 600 0 of 600
200 ms round trip, 1 % loss 40 of 600 failed 16 of 600 22 of 600 0 of 600 0 of 600

On a clean path, stock NGINX loses about one fresh connection per reload. With distance and loss, it loses about four, and the reload adds 24 failures to the 16 the path causes anyway. NGINX-MOD 1.30.7-80, which already carries our earlier QUIC fixes, still loses 9 and 22. NGINX-MOD 1.30.7-82 loses none in either cell, in both arms, reload included.

The failures on the affected builds are exactly the symptoms above: ERR_DRAINING and send failures (curl 56 and 55), and “Could not connect” (curl 7).

Production: www.getpagespeed.com

Our own site runs NGINX-MOD with quic_bpf on. We probed it from a client on a long, lossy residential path: 60 fresh HTTP/3 connections per run, a reload 2 seconds in, alternating with runs without a reload.

www.getpagespeed.com With a reload Without a reload
Before the fix 53 of 600 failed 1 of 600
With the fix 0 of 300 failed 0 of 300

On this path the handshake takes long, so a reload caught connections that had started up to 1.3 seconds before it. Each reload cost about five visitors their connection. After the update, none.

The Fix in NGINX-MOD

NGINX-MOD 1.30.7-82 changes what a retiring worker does with its QUIC connections. In short, it never closes a connection that is still on its way to the first response:

In our measurements the old workers of NGINX-MOD 1.30.7-82 were gone 1.1 to 3.7 seconds after the reload in 39 of 40 runs, against 0.8 to 3.2 seconds for stock NGINX. In the remaining run an old worker lived 10.2 seconds while it waited for a connection that had gone silent.

Also in This Release: quic_bpf on CentOS 7

The quic_bpf directive needs eBPF support for socket maps, which the CentOS 7 kernel (3.10) does not have. Until now, nginx -t accepted quic_bpf on; there, and then NGINX refused to start:

[alert] failed to create BPF map (1: Operation not permitted)
[emerg] ngx_quic_bpf_module failed to initialize, check limits

Starting with NGINX-MOD 1.30.7-81, NGINX starts and logs one warning with the reason instead:

[warn] "quic_bpf" is ignored: BPF not permitted, the kernel lacks support for it (Linux 5.7+ is required) or RLIMIT_MEMLOCK is too low (1: Operation not permitted)

On a newer kernel with SELinux enforcing, the same fallback names the boolean you need:

[warn] "quic_bpf" is ignored: BPF access denied, if SELinux is enforcing, run "setsebool -P nginx_quic_bpf 1" (13: Permission denied)

Without quic_bpf, NGINX still serves HTTP/3, but reloads lose QUIC packets to the reuseport bug described in our quic_bpf article. On CentOS 7 with its stock kernel, keep reloads rare, or move to a kernel that supports BPF socket maps.

Get the Fix

The fix ships in NGINX-MOD 1.30.7-82 for RHEL, CentOS, AlmaLinux, Rocky Linux, Fedora and Amazon Linux. NGINX-MOD is our NGINX build with fixes and features that upstream does not ship. You will not find this one in stock NGINX.

Requires a Pro subscription or higher.

If you already run NGINX-MOD, update it. The package replaces the running binary gracefully, so no restart is needed:

sudo dnf -y update nginx-mod

If you run the standard nginx package, enable the NGINX-MOD repository and swap the packages. Your configuration stays as it is:

sudo dnf -y install https://extras.getpagespeed.com/release-latest.rpm
sudo dnf config-manager --enable getpagespeed-extras-nginx-mod
sudo dnf -y swap nginx nginx-mod
sudo systemctl enable --now nginx

On CentOS 7, use yum and yum-config-manager --enable in place of dnf and dnf config-manager --enable.

Then confirm the release. It must be 82 or later:

rpm -q nginx-mod
rpm -q --changelog nginx-mod | head -n 9

The newest changelog entry starts with “HTTP/3: a reload no longer breaks connections on slow or lossy paths”.

The fix needs no configuration. For the full benefit on a server with several workers, keep quic_bpf on; at the top of nginx.conf, outside the http block:

quic_bpf on;

Testing: Does a Reload Drop Your HTTP/3 Visitors?

You need a curl with HTTP/3 support on a client machine. On RHEL-based systems, our curl-latest package provides one. This loop opens 60 fresh HTTP/3 connections, one every 100 ms, and prints the result of each:

for i in $(seq 1 60); do
  ( out=$(curl -sS --http3-only --max-time 10 -o /dev/null \
      -w "%{http_code} %{time_total}" "https://example.com/robots.txt?probe=$i" 2>&1)
    echo "$(date +%T.%N) $i $out" ) &
  sleep 0.1
done; wait

Start it, and about two seconds later reload NGINX on the server:

sudo systemctl reload nginx

Use a static file, as above, so the probe does not make your application render 60 pages. Every line should show 200. On an affected server, a few lines close to the reload show 000 with ERR_DRAINING or “Could not connect”. Run it from a distant client: on a fast local link the handshake is too short to catch often.

Performance Considerations

The change only matters while a worker is retiring. During normal operation NGINX-MOD runs the same code path as before, so there is no cost per request.

A retiring worker may live a few seconds longer while it finishes handshakes and first requests. It still holds the old configuration’s memory during that time. With frequent reloads on a large configuration, set worker_shutdown_timeout to cap how long old workers may stay, for example:

worker_shutdown_timeout 30s;

Our measurements use one client implementation (curl with ngtcp2), small responses and independent random loss. Bursty loss and browsers with their own retry logic are not covered by these numbers.

Security Best Practices

The fix adds no directive and accepts no new connections on a retiring worker: those still go to the new workers. A connection kept on an old worker is served under the configuration it was opened with, exactly like an HTTP/2 request that is still running during a reload.

Retiring workers are bounded by time. A client cannot hold an old worker open by staying silent, and worker_shutdown_timeout remains the hard limit.

Troubleshooting

HTTP/3 requests still fail after reloads. Check rpm -q nginx-mod: releases before 82 do not have the complete fix. Then check whether quic_bpf is active. Without it, a reload loses QUIC packets to a different bug, explained in our quic_bpf article.

quic_bpf logs "quic_bpf" is ignored. The warning names the reason. Permission denied (13) means SELinux: run setsebool -P nginx_quic_bpf 1 and restart NGINX. Operation not permitted (1) on an old kernel means BPF socket maps are not available there.

Old workers stay for minutes after a reload. That is not this fix: long downloads and WebSocket connections keep old workers alive on any build. Use worker_shutdown_timeout to bound it.

HTTP/3 is slow rather than failing. That is a different problem. See HTTP/3 slow after one lost packet and NGINX HTTP/3 BBR.

Conclusion

Applying this fix once is the easy part. Keeping every host fixed as configs evolve and NGINX versions roll forward is where regressions creep back in. GetPageSpeed Amplify runs scheduled gixy scans across every host and ties findings to live NGINX runtime metrics. Drop-in compatible with the deprecated nginx-amplify-agent (EOL January 2026).

A graceful NGINX HTTP/3 reload should be invisible. In stock NGINX it is not: every reload closes the connections that are still being set up, and on long or lossy paths that means several visitors each time. The cause is one condition in the QUIC input handler that treats a handshake in progress as something to close rather than something to finish.

NGINX-MOD 1.30.7-82 lets those connections finish, verified on separate machines and on our own production traffic. Subscribe to the GetPageSpeed repository to get it, along with every other fix we ship ahead of upstream.

Exit mobile version