Skip to content

[fix][backend] add MaxBytes limit to ListSpansRepeat to prevent…#568

Merged
SharkeyChen merged 1 commit into
mainfrom
feat/trajectory-max-bytes
Jun 30, 2026
Merged

[fix][backend] add MaxBytes limit to ListSpansRepeat to prevent…#568
SharkeyChen merged 1 commit into
mainfrom
feat/trajectory-max-bytes

Conversation

@SharkeyChen

Copy link
Copy Markdown
Collaborator

… OOM in trajectory backfill

When a traceID contains a large number of spans, ListSpansRepeat would fetch all pages into memory without any bound, potentially causing OOM in TCE instances during backfill tasks.

This adds a configurable MaxBytes parameter to ListSpansRepeat. When the accumulated span size exceeds the limit, it returns ErrMaxBytesExceeded. GetTrajectories catches this error, logs a warning, and returns an empty trajectory map to skip oversized traces gracefully.

The limit is configured per workspace via BackfillConfig.TrajectoryMaxBytes. When unset (0), the original unlimited behavior is preserved.

What type of PR is this?

Check the PR title

  • This PR title match the format: [<type>][<scope>] <description>. For example: [fix][backend] flaky fix
  • The description of this PR title is user-oriented and clear enough for others to understand.
  • Add documentation if the current PR requires user awareness at the usage level.
  • This PR is written in English. PRs not in English will not be reviewed.

(Optional) Translate the PR title into Chinese

(Optional) More detailed description for this PR(en: English/zh: Chinese)

en:
zh(optional):

(Optional) Which issue(s) this PR fixes

… OOM in trajectory backfill

When a traceID contains a large number of spans, ListSpansRepeat would
fetch all pages into memory without any bound, potentially causing OOM
in TCE instances during backfill tasks.

This adds a configurable MaxBytes parameter to ListSpansRepeat. When the
accumulated span size exceeds the limit, it returns ErrMaxBytesExceeded.
GetTrajectories catches this error, logs a warning, and returns an empty
trajectory map to skip oversized traces gracefully.

The limit is configured per workspace via BackfillConfig.TrajectoryMaxBytes.
When unset (0), the original unlimited behavior is preserved.
@SharkeyChen SharkeyChen changed the title [fix][observability] add MaxBytes limit to ListSpansRepeat to prevent… [fix][backend] add MaxBytes limit to ListSpansRepeat to prevent… Jun 30, 2026
@SharkeyChen SharkeyChen merged commit 015ccb5 into main Jun 30, 2026
11 of 12 checks passed
@SharkeyChen SharkeyChen deleted the feat/trajectory-max-bytes branch June 30, 2026 11:19
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.

3 participants