Skip to content

fix(query): a person's Trino query can break in transit at the ingress (OriginStatus 0), distinct from #1088 #1366

Open

Description

@malon64

Found while verifying v0.7-beta on kind, with main at c9046f3.

What fails

In local-full-e2e.yml run 44928734020 on main c9046f3 (checks=core, dev+prod), the DEV suite's person-access check failed:

17:57:48.548 ==> Checking viewer's data access as a person...
17:57:50.994 ERROR: The query to dev's Trino broke in transit: 'SELECT count(*) FROM sales_silver.accounts'
ERROR: the query failed for a reason other than an access decision: cannot reach Trino at trino-dev.olf.localhost: ChunkedEncodingError

The previous run of the same workflow on the same commit, 44913044289, passed.

How this differs from #1088

#1088 was a ~30 s hang followed by a break mid-response. It was closed by turning off Trino's HTTP compression. Compression is still off; v0.7-beta check 2 verified http-server.compression.enabled=false on both coordinators.

This failure has a different signature:

  • It is not a hang. The query's first POST /v1/statement broke about 10 ms after it was sent.
  • It is not a large response. Traefik logged a downstream body of only 742 bytes.
  • It did not reach Trino. The DEV coordinator logged no query for it: the last entries are three ICEBERG_CATALOG_ERROR queries from the expected-denial checks at 17:57:48.7–.8, then nothing.
  • Neither coordinator restarted.

Traefik's access log for that request, from the run's hop diagnosis:

StartUTC 17:57:50.984892683Z  POST /v1/statement  entryPoint websecure  service olf-dev-trino-8080@kubernetes
DownstreamStatus 200  OriginStatus 0  OriginContentSize 0  DownstreamContentSize 742  Duration 3.57 ms  RetryAttempts 0

OriginStatus 0 with DownstreamStatus 200 means Traefik began a 200 response to the client without a complete response from Trino. The requests just before it on the same route (POST, queued and executing polls, 17:57:46–48) all show origin 200.

Frequency

1 of the last 13 local-full-e2e runs on main. Searching the job logs of the 12 failed runs since 2026-11-20 14:30 for ChunkedEncodingError finds only this run.

Reproduce

  1. Dispatch the workflow repeatedly on main:
    gh workflow run local-full-e2e.yml -R OpenLakeForge/openlakeforge --ref main -f checks=core -f stage_scope=dev+prod
  2. Look for cannot reach Trino at trino-<stage>.olf.localhost: ChunkedEncodingError in the steps "Activate the revision in DEV and run the full e2e suite there" or "Run the full e2e suite against PROD". The run's hop diagnosis prints the Traefik access log; look for an entry with OriginStatus 0 on the Trino route.

Expected

A person's query through the ingress either completes or fails with a clear status. A body truncated at the proxy should not surface as ChunkedEncodingError.

Things to check

  • Whether Traefik reused an idle keep-alive connection to Trino that the coordinator had already closed. Compare Trino's http-server idle timeout with Traefik's forwardingTimeouts/idleConnTimeout.
  • Whether RetryAttempts 0 is expected, given that the request is a non-idempotent POST.
  • Whether the oauth2-proxy middleware on the route is involved, since it writes the response.

Activity

  1. malon64 commented on Nov 22, 2026

    @malon64
    CollaboratorAuthor

    Diagnosis from run 44928734020 (job 136920468051, artifact local-full-e2e-diagnostics-44928734020). No root cause with confidence, so no PR.

    What the evidence says

    1. The response had already started when it broke. The Traefik access-log entry has ServiceAddr/ServiceURL set but every Origin field at its initial value. Traefik v3.7.13 initialises OriginStatus/OriginDuration/OriginContentSize to 0 (InitServiceFields) and overwrites them only after the service handler returns (AddServiceFields, pkg/middlewares/accesslog/field_middleware.go). DownstreamStatus 200 and DownstreamContentSize 742 mean status and body bytes had been written to the client already. So the entry is a handler that did not return normally after the response began, not a request that "never reached a backend" as the access-log docs' OriginStatus 0 wording suggests. The pattern fits httputil.ReverseProxy aborting a streamed response with panic(http.ErrAbortHandler), which closes the client connection without finishing the body. recovery.go logs that only at DEBUG, which is why Traefik's INFO log has nothing else. I could not confirm the panic itself.
    2. Keep-alive race to Trino is ruled out. A reused backend connection that Trino had closed fails in RoundTrip, before any response header. Traefik's ErrorHandler then writes 502/504 and AddServiceFields runs, so the entry would show OriginStatus 502, not DownstreamStatus 200. The config agrees: Traefik's idleConnTimeout is the default 90 s, and the Traefik→Trino hop is plain HTTP on 8080 (ServiceURL http://10.244.1.27:8080), so it has no TLS or HTTP/2 involved. I could not find Trino's idle timeout in its docs (the HTTP server properties page does not list one).
    3. "Trino logged no query" is weaker than fix(query): a person's Trino query can break in transit at the ingress (OriginStatus 0), distinct from #1088 #1366 states. QueryMonitor logs a query only when it completes. If the POST reached Trino and the client then dropped, the query would be abandoned and logged ~5 minutes later, after the diagnostics dump. The dev coordinator log ends at 17:57:48.8 (three completed ICEBERG_CATALOG_ERROR queries), so whether the POST reached Trino is unknown. The response's 742 bytes equal every normal POST /v1/statement response in the same log (origin Content-Length), which suggests the body did come from Trino.
    4. oauth2-proxy is not the cause. forwardAuth answered static://202 for that request (oauth2-proxy-viewer log, 17:57:50). A forward-auth failure would return 500 (or the proxy's status), not 200. No errors middleware is on the route (modules/access/perimeter/main.tf defines only olf-strip-identity and the forwardAuth floors).
    5. Client side is not reusing a connection. TrinoClient calls requests.request per call (packages/lakehouse-services/openlakeforge_services/trino.py:134), and the access log shows a new client port for every request (172.18.0.1:35730, :35740, :35748, ...). So there is no stale client-side keep-alive. 172.18.0.1 is the Docker bridge gateway: the runner reaches Traefik through kind's published port (Docker's userland proxy), a hop the platform does not control.
    6. No coordinator or Traefik restart, no OOMKilled (RESTARTS 0 on both coordinators and Traefik).

    What I could not prove

    Which side of Traefik failed: the read of Trino's response body, the write to the client (through Docker's port proxy), or a context cancel. All three end in the same ErrAbortHandler abort and the same access-log shape. 1 in 13 runs, and one occurrence, is too little to separate them. I did not ship a fix because the only candidates left (Traefik transport knobs, a retry in the e2e) would be guesses, and a test-side retry would hide it from a real person's olf query.

    What would settle it on the next occurrence

    • Include the underlying exception text in TrinoUnreachableError (today only type(exc).__name__ survives). IncompleteRead(N bytes read, M more expected) vs InvalidChunkLength vs a TLS EOF distinguishes a short body from a bad chunk framing.
    • Capture Traefik at DEBUG for the route when the check fails (Request has been aborted [...]: net/http: abort Handler is logged at debug by recovery.go, and ReverseProxy logs the copy error through the same logger, which would name the failing read or write).
    • Capture the failed request's queryId (the POST response body is in hand when nextUri is followed; here it was not), so the coordinator log can be searched for the abandoned query later.

    Priority stays P1 while it is rare. No PR opened.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions