Skip to content

DEVPROD-18354: Fix log ingestion memory bug#1499

Open
sophstad wants to merge 11 commits intoevergreen-ci:mainfrom
sophstad:DEVPROD-18354-3
Open

DEVPROD-18354: Fix log ingestion memory bug#1499
sophstad wants to merge 11 commits intoevergreen-ci:mainfrom
sophstad:DEVPROD-18354-3

Conversation

@sophstad
Copy link
Copy Markdown
Contributor

@sophstad sophstad commented Mar 31, 2026

DEVPROD-18354

Description

Improve duplicated log data by using a callback from the stream instead of an extra state.

Also update resmoke processing to create new strings with no references to what was ingested, allowing for proper garbage collection.

Note that this fix is not exactly viable in Firefox: Firefox's TextDecoder.decode() parses into UTF-16 which uses 2x the storage 😩

Testing

Validated via memory heap snapshot

Original:
image

Fix:
image

@sophstad sophstad marked this pull request as ready for review March 31, 2026 22:22
@sophstad sophstad requested a review from a team as a code owner March 31, 2026 22:22
Comment on lines 13 to 14
const ansiUp = new AnsiUp();

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Moving the stateful AnsiUp instance to a module-level singleton will cause color state to leak between log rows, resulting in incorrect rendering.
Severity: MEDIUM

Suggested Fix

Revert to creating a new AnsiUp instance for each row. To optimize performance, create a per-component instance using useMemo(() => new AnsiUp(), []). This isolates the state to each row while avoiding re-creation on every render.

Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent.
Verify if this is a real issue. If it is, propose a fix; if not, explain why it's not
valid.

Location: apps/parsley/src/components/LogRow/AnsiRow/index.tsx#L13-L14

Potential issue: The `AnsiUp` library is stateful, meaning color settings persist across
calls. By changing its instantiation from per-component to a single module-level
instance, the component now shares state across all log rows. If a log line sets a color
without resetting it at the line's end, a common case in CI logs, that color will
"bleed" into subsequent, unrelated log lines. This will cause visual corruption and
misrepresentation of log data, which is a core function of the application.

Did we get this right? 👍 / 👎 to inform future reviews.

@sophstad sophstad marked this pull request as draft April 1, 2026 15:06
@sophstad sophstad added parsley and removed spruce labels Apr 14, 2026
@sophstad sophstad marked this pull request as ready for review April 14, 2026 20:55
Comment thread apps/parsley/src/utils/resmoke/helpers.ts Outdated
Reject trailing characters after parsed JSON objects so resmoke helper parsing matches prior behavior and ignores malformed suffixes.

Made-with: Cursor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants