Repository navigation
fix(server): truncate oversized log lines and catch buffer allocation errors - #6469
Open
sentry[bot] wants to merge 1 commit into
Open
sentry[bot] wants to merge 1 commit into
sentry[bot] wants to merge 1 commit into
Conversation
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub. 4 Skipped Deployments
|
Contributor
Contributor
There was a problem hiding this comment.
Warden clearance. Complete security and confidentiality review of 3bc1f9551aa8a4177f9c8298421bf94cc2612ae5 found no high or medium security findings and no confidentiality findings. Any new push dismisses this approval. Analysis run
Contributor
Warden: approvedNo high or medium security findings and no confidentiality findings. Reviewed |
This branch is waiting to be deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What is this about?
Stopping the OpenWork server from crashing when it writes a very large log line.
What problem does it solve?
Some requests, such as
/workspace/:id/opencode/*orsession-groups/events, return large responses. The JSON log record for one can exceed Node's internal buffer allocation limit. Writing it then throwsRangeError: Failed to allocate memory, which crashes the server. Logging must never fail an otherwise successful request, and this breaks that rule.What was the situation before?
The log output error check only recognized specific system error codes:
EPIPE,ERR_STREAM_DESTROYED,ENOSPC,EDQUOT, andEIO. ARangeErrorhas no.codeproperty, so it was re-thrown and crashed the server.How is this implemented?
apps/server/src/log-utils.ts: log output helpers moved here so they can be unit-tested without the full server dependency tree.truncateLogLine: caps each line at 2 MiB and appends[LOG TRUNCATED].isUnavailableLogOutputError: now treatsRangeErroras suppressible.writeLogLine: catchesRangeError, skips that one record, and keeps stdout logging active for later requests.What else changed?
none
Release note
OpenWork server no longer crashes when a request returns a very large response; oversized log lines are shortened instead.
Evidence
apps/server/test/server-log-output.test.tscovering truncation boundaries and error classification. This description links no test results or report.Fixes DESKTOP-APP-3F
@sentry <feedback>: Autofix iterates on these changes@sentry stop iterating: Autofix stops iterating on this runThis PR was automatically generated by Sentry at no cost. You can adjust this setting at any time.