You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@seatunnel.apache.org by "SEZ9 (via GitHub)" <gi...@apache.org> on 2026/09/13 11:31:37 UTC

[I] [Feature][Zeta] Bound the size of REST log-content responses [seatunnel]

SEZ9 opened a new issue, #12295:
URL: https://github.com/apache/seatunnel/issues/12295

   ### Search before asking
   
   - [X] I had searched in the [feature](https://github.com/apache/seatunnel/issues?q=is%3Aissue+label%3A%22Feature%22) and found no similar feature requirement.
   
   ### Description
   
   The REST log-content endpoints read the whole file into a `String` before writing the response, with no upper bound:
   
   ```java
   // LogBaseServlet#prepareLogResponse
   String logContent = FileUtils.readFileToStr(new File(canonicalFilePath).toPath());
   write(resp, logContent);
   ```
   
   ```java
   // FileUtils#readFileToStr
   byte[] bytes = Files.readAllBytes(path);
   return new String(bytes);
   ```
   
   `RestHttpGetCommandProcessor` carries an equivalent copy for REST v1.
   
   That means a single `GET /logs/<name>` on a long-running streaming job's log file materialises the entire file as a byte array **and** again as a `String` on the heap. A multi-gigabyte log — normal for a job that has been streaming for weeks — can push the node into a long GC pause or an `OutOfMemoryError`, taking down the whole engine node rather than just failing the request.
   
   The existing path-traversal guard in `prepareLogResponse` is intact; this is purely about response size.
   
   ### Usage Scenario
   
   An operator opens a job log through the Web UI or `curl`s the log endpoint on a node whose log files have grown large. Today that is enough to destabilise the node. There is no configuration knob to prevent it.
   
   Proposal: add `seatunnel.engine.http.log-response-max-size-mb` (default large enough to be a safety net rather than a behaviour change) and return the **tail** of the file when it exceeds the limit — the tail being the useful part when diagnosing a failure. The tail must be aligned to a line boundary, otherwise slicing at an arbitrary byte offset splits a multi-byte UTF-8 character and the response starts with a replacement character.
   
   ### Related issues
   
   _No response_
   
   ### Are you willing to submit a PR?
   
   - [X] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] [Feature][Zeta] Bound the size of REST log-content responses [seatunnel]

Posted by "davidzollo (via GitHub)" <gi...@apache.org>.
davidzollo closed issue #12295: [Feature][Zeta] Bound the size of REST log-content responses
URL: https://github.com/apache/seatunnel/issues/12295


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] [Feature][Zeta] Bound the size of REST log-content responses [seatunnel]

Posted by "SEZ9 (via GitHub)" <gi...@apache.org>.
SEZ9 commented on issue #12295:
URL: https://github.com/apache/seatunnel/issues/12295#issuecomment-5658990623

   Thanks for the detailed report — reading the whole file via `Files.readAllBytes` and then materialising it again as a `String` is a real risk for long-running streaming jobs. A PR is welcome.
   
   A few requests for the PR:
   
   - Cover both the `LogBaseServlet#prepareLogResponse` path and the REST v1 copy in `RestHttpGetCommandProcessor`, ideally by deduplicating them into a shared helper, and keep the existing path-traversal guard unchanged.
   - Read only the tail rather than loading the whole file, and align the start to a line boundary as you propose so multi-byte UTF-8 characters are not split.
   - Consider making it visible to callers (e.g. a marker line or response header) that the content was truncated.
   - Document the new `seatunnel.engine.http.log-response-max-size-mb` option and add a unit test with a file larger than the limit.
   
   Could you also state the intended default value explicitly in the PR description? A large default that acts as a safety net without changing behaviour for typical files sounds like the right call.
   
   <!-- streview-comment:1038 -->


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org