This is an automated email from the ASF dual-hosted git repository.

github-merge-queue[bot] pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/texera.git


The following commit(s) were added to refs/heads/main by this push:
     new b4b06482e8 fix(k8s): disable the request timeout on version zips 
(#9353)
b4b06482e8 is described below

commit b4b06482e84f83e114891dc3086bdf3bcd1c9817
Author: Kunwoo (Chris) <[email protected]>
AuthorDate: Mon Nov 9 02:28:31 2026 +0000

    fix(k8s): disable the request timeout on version zips (#9353)
    
    ### What changes were proposed in this PR?
    
    Problem. The static HTTPRoute rule that sends `/api/dataset`,
    `/api/access/dataset`, `/api/model` and `/api/access/model` to
    file-service has no `timeouts` block, so Envoy Gateway leaves the route
    timeout unset and Envoy applies its 15s default. That timeout runs until
    the upstream response is complete, so it covers the body too. `GET
    /api/dataset/{did}/versionZip` and `GET /api/model/{mid}/versionZip`
    stream a zip that file-service builds as it goes, so any version whose
    zip takes longer than 15s is cut off mid-body, after the 200 has gone
    out.
    
    Fix. Adds a rule that matches only the two versionZip paths
    (`^/api/(dataset|model)/\d+/versionZip$`) and sets `timeouts.request:
    "0s"`, the value #9349 sets on `texera-rustfs-route`. Envoy Gateway
    ranks regular-expression matches above path prefixes, so this rule wins
    over `/api/dataset` and `/api/model`, and every other file-service call
    keeps the 15s default.
    
    Why "0s" and not a large finite value. In Envoy Gateway 1.6.3 a rule's
    request timeout also sets the route's stream idle timeout
    (`idleTimeout()` in `internal/xds/translator/route.go`). "0s" turns it
    off, and a finite N sets it to max(1h, N). So a finite value would not
    catch a stalled stream any sooner than an hour; it would only cap the
    total download time, which grows with the archive size and the reader's
    bandwidth and has no natural bound. The cost is that a stalled
    versionZip stream no longer falls back to Envoy's 5-minute stream idle
    timeout, and stays open until the client or file-service closes it.
    
    ```
    Before:  GET /api/dataset/{did}/versionZip -> file-service rule (no 
timeouts) -> cut at 15s
    After:   GET /api/dataset/{did}/versionZip -> versionZip rule (request 
"0s") -> streams to the end
    ```
    
    Not included. The RustFS route is #9349. The other file-service calls
    under `/api/dataset` and `/api/model` keep the 15s default.
    
    ### Any related issues, documentation, discussions?
    
    Closes #9352. Follows #9349, which makes the same change on
    `texera-rustfs-route` (#9351).
    
    ### How was this PR tested?
    
    Rendered the static routes and ran the chart's values check.
    
    ```
    cd bin/k8s && helm template texera . --namespace texera-dev --show-only 
templates/base/gateway/gateway-routes.yaml
    bash bin/k8s/tests/test_helm_values.sh
    ```
    
    The new rule renders with `type: RegularExpression`, `value:
    "^/api/(dataset|model)/\\d+/versionZip$"` and `timeouts.request: "0s"`,
    and the four PathPrefix matches still have no `timeouts`.
    `test_helm_values.sh` passes (188 template value references across 60
    files, 4 exempt).
    
    Reproduced against the real file-service with Envoy 1.36.4, the Envoy
    that Envoy Gateway 1.6.3 deploys, using the routes Envoy Gateway
    generates for today's rule (path prefix, no route timeout) and for the
    new one (`safe_regex`, `timeout: 0s`, `idle_timeout: 0s`), with its 32
    KiB connection buffer limits. The local dataset's zip is only 3.9 MB,
    and a slow reader alone could not show the cut, because Envoy had passed
    the whole body to the loopback socket buffers before the 15s ran out. A
    hop that throttles file-service's response to 100 KiB/s stood in for a
    version whose zip takes longer than 15s to build. Before, the download
    was cut at 16.0s after 813,383 of 3,913,563 bytes (HTTP 200, curl exit
    18), and Envoy counted one `upstream_rq_timeout`. After, all 3,913,563
    bytes arrived in 46s. On the same listener, `/api/dataset/list` still
    took the prefix rule, and `/api/model/1/versionZip` reached file-service
    through the new rule.
    
    No Kubernetes cluster was used. Envoy Gateway's translation of the rule
    was checked by reading its 1.6.3 source (`processRouteTimeout`,
    `buildXdsRoute` and `idleTimeout()`, and the route sort that ranks
    regular expressions above prefixes), not by deploying it.
    
    ### Was this PR authored or co-authored using generative AI tooling?
    
    Generated-by: Claude Code, Claude Opus 5.5
    
    ---------
    
    Co-authored-by: Meng Wang <[email protected]>
---
 bin/k8s/templates/base/gateway/gateway-routes.yaml | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/bin/k8s/templates/base/gateway/gateway-routes.yaml 
b/bin/k8s/templates/base/gateway/gateway-routes.yaml
index 990a89bbbc..e498090b82 100644
--- a/bin/k8s/templates/base/gateway/gateway-routes.yaml
+++ b/bin/k8s/templates/base/gateway/gateway-routes.yaml
@@ -57,6 +57,18 @@ spec:
       backendRefs:
         - name: workflow-compiling-service-svc
           port: 9090
+    # A version zip streams for as long as it takes to build and download, so 
Envoy's 15s
+    # default would cut it off mid-body. "0s" also drops the stream idle 
timeout; a finite value
+    # would only raise it to 1h or more. Envoy Gateway ranks this regex above 
the path prefixes.
+    - matches:
+        - path:
+            type: RegularExpression
+            value: "^/api/(dataset|model)/\\d+/versionZip$"
+      timeouts:
+        request: "0s"
+      backendRefs:
+        - name: file-service-svc
+          port: 9092
     - matches:
         - path:
             type: PathPrefix

Reply via email to