Skip to content

fix: demote remote QUIC stream NO_ERROR cancels from ERR to debug - #1742

Open
vulragrag-star wants to merge 1 commit into
cloudflare:masterfrom
vulragrag-star:fix/1726-benign-remote-stream-cancel
Open

vulragrag-star wants to merge 1 commit into
cloudflare:masterfrom
vulragrag-star:fix/1726-benign-remote-stream-cancel

Conversation

@vulragrag-star

Copy link
Copy Markdown

Summary

Browsers that close long-lived streams (SSE / WebSocket / log follow) cause the edge to cancel the corresponding QUIC stream with error code 0 (NO_ERROR). quic.StreamError with Remote=true and ErrorCode=0 then bubbled up through the proxy and was logged at ERR in two places:

  1. proxy.logRequestError — empty ERR line with error="stream N canceled by remote with error code 0"
  2. connection.handleDataStreamRequest failed at ERR

That matches the report in #1726 and creates false positives in monitoring (Datadog / Grafana / etc.). Per RFC 9113, RST_STREAM with NO_ERROR is an intentional, non-erroneous close.

Fix

  • Add connection.IsBenignRemoteStreamCancel (typed errors.As on *quic.StreamError).
  • Demote those cases to Debug in both log sites.
  • Skip the requestErrors Prometheus increment for the benign case.

Real stream errors (non-zero code, or local cancel) still log at ERR and still increment the metric.

Test plan

  • go test ./connection/ -run TestIsBenignRemoteStreamCancel
  • go test ./proxy/ -run TestLogRequestError
  • CI green on this PR

Fixes #1726

Browsers closing long-lived streams (SSE/WebSocket) surface as
quic.StreamError with Remote=true and ErrorCode=0. Logging those at ERR
and incrementing requestErrors created false positives in monitoring
(issue cloudflare#1726). Treat them as debug and skip the error metric.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

🐛 Normal HTTP/2 stream cancellations (error code 0 / NO_ERROR) are logged at ERR level

1 participant