Skip to content

[Improvement] [API] Apiserver OOM when downloading large task log #18459

Description

@xmg333

Search before asking

  • I had searched in the issues and found no similar issues.

What happened

When a user downloads a large task log, the apiserver can run out of memory. The whole RPC response body is read into memory at once. In our heap dump we saw a TransporterDecoder whose body was a byte[] of ~226MB — it was a queryTaskResult response. On 3.3.2 the decoder does new byte[bodyLength] without any size check, so any large response gets allocated whole.

Also, once a maxFrameSize guard is in place, a task log larger than the frame limit can no longer be downloaded — the log is returned as one big byte[] in a single RPC, so the request is rejected.

What you expected to happen

Large task logs should still be downloadable (streamed in chunks, not one big RPC), and the server shouldn't OOM on a large response.

How to reproduce

  1. Run a task that produces a large log file.
  2. Click "Download full log" or view the task result.
  3. On 3.3.2 the apiserver OOMs; with the frame guard, the large-log download fails.

Anything else

The OOM side is handled by the maxFrameSize check in TransporterDecoder. This issue also tracks making large-log download work under that limit (stream the log in chunks).

Version

3.3.2

Are you willing to submit PR?

  • Yes I am willing to submit a PR!

Code of Conduct

Metadata

Metadata

Assignees

Labels

backendimprovementmake more easy to user or prompt friendly

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions