Skip to content

OCPBUGS-105314: Fix xterm ResizeObserver crash on uninitialized dimensions - #16918

Merged
openshift-merge-bot[bot] merged 1 commit into
openshift:mainfrom
ericahinkleRH:OCPBUGS-105314-fix-xterm-resize
Aug 7, 2026
Merged

OCPBUGS-105314: Fix xterm ResizeObserver crash on uninitialized dimensions#16918
openshift-merge-bot[bot] merged 1 commit into
openshift:mainfrom
ericahinkleRH:OCPBUGS-105314-fix-xterm-resize

Conversation

@ericahinkleRH

@ericahinkleRH ericahinkleRH commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Analysis / Root cause:
PR #16498 (OCPBUGS-84649, merged Jul 30) replaced the terminal resize logic in terminal.tsx with a ResizeObserver-based pattern. The guard on line 94 used optional chaining (_renderService?.dimensions) to check if xterm's render service was initialized, but dimensions is a getter — when _renderService exists but is partially initialized, the getter throws Cannot read properties of undefined (reading 'dimensions') instead of returning undefined. This uncaught error fails any Cypress test that navigates to a debug terminal page, causing a 74% flake rate on e2e-gcp-console.

Solution description:
Replaced the broken optional chaining guard with a try-catch around fit.fit(). If the fit addon throws because xterm's render service isn't ready, the callback safely returns without crashing.

Screenshots / screen recording:
N/A — no visual changes.

Test setup:
N/A — fix is verified by existing debug-pod.cy.ts Cypress tests passing consistently.

Test cases:

  1. Verify debug terminal page loads without uncaught TypeError
  2. Verify terminal still resizes correctly after initialization
  3. Verify e2e-gcp-console CI passes without the debug-pod flake

Browser conformance:

  • Chrome
  • Firefox
  • Safari (or Epiphany on Linux)

Additional info:
This bug has caused a 74% failure rate on e2e-gcp-console since PR #16498 merged, affecting 17 unique PRs.

Jira: https://issues.redhat.com/browse/OCPBUGS-105314

Reviewers and assignees:
/cc @jcaianirh

Summary by CodeRabbit

  • Bug Fixes
    • Improved terminal resizing reliability by safely handling errors during fitting, resize notifications, and input synchronization.
    • Prevented incomplete resize operations when an internal error occurs.

@openshift-merge-bot

Copy link
Copy Markdown
Contributor

Pipeline controller notification
This repo is configured to use the pipeline controller. Second-stage tests will be triggered either automatically or after lgtm label is added, depending on the repository configuration. The pipeline controller will automatically detect which contexts are required and will utilize /test Prow commands to trigger the second stage.

For optional jobs, comment /test ? to see a list of all defined jobs. To trigger manually all jobs from second stage use /pipeline required command.

This repository is configured in: LGTM mode

@openshift-ci-robot openshift-ci-robot added jira/severity-important Referenced Jira bug's severity is important for the branch this PR is targeting. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. labels Aug 6, 2026
@openshift-ci-robot

Copy link
Copy Markdown
Contributor

@ericahinkleRH: This pull request references Jira Issue OCPBUGS-105314, which is invalid:

  • expected the bug to target the "5.0.0" version, but no target version was set

Comment /jira refresh to re-evaluate validity if changes to the Jira bug are made, or edit the title of this pull request to link to a different bug.

The bug has been updated to refer to the pull request using the external bug tracker.

Details

In response to this:

Analysis / Root cause:
PR #16498 (OCPBUGS-84649, merged Jul 30) replaced the terminal resize logic in terminal.tsx with a ResizeObserver-based pattern. The guard on line 94 used optional chaining (_renderService?.dimensions) to check if xterm's render service was initialized, but dimensions is a getter — when _renderService exists but is partially initialized, the getter throws Cannot read properties of undefined (reading 'dimensions') instead of returning undefined. This uncaught error fails any Cypress test that navigates to a debug terminal page, causing a 74% flake rate on e2e-gcp-console.

Solution description:
Replaced the broken optional chaining guard with a try-catch around fit.fit(). If the fit addon throws because xterm's render service isn't ready, the callback safely returns without crashing.

Screenshots / screen recording:
N/A — no visual changes.

Test setup:
N/A — fix is verified by existing debug-pod.cy.ts Cypress tests passing consistently.

Test cases:

  1. Verify debug terminal page loads without uncaught TypeError
  2. Verify terminal still resizes correctly after initialization
  3. Verify e2e-gcp-console CI passes without the debug-pod flake

Browser conformance:

  • Chrome
  • Firefox
  • Safari (or Epiphany on Linux)

Additional info:
This bug has caused a 74% failure rate on e2e-gcp-console since PR #16498 merged, affecting 17 unique PRs.

Jira: https://issues.redhat.com/browse/OCPBUGS-105314

Reviewers and assignees:
/cc @jcaianirh

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@openshift-ci-robot openshift-ci-robot added the jira/invalid-bug Indicates that a referenced Jira bug is invalid for the branch this PR is targeting. label Aug 6, 2026
@openshift-ci
openshift-ci Bot requested a review from jcaianirh August 6, 2026 16:17
@coderabbitai

coderabbitai Bot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository: openshift/coderabbit/.coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: b91110ee-8bae-4378-9826-a9749f8a728c

📥 Commits

Reviewing files that changed from the base of the PR and between 48eaa7b and 2c826a6.

📒 Files selected for processing (1)
  • frontend/public/components/terminal.tsx
🚧 Files skipped from review as they are similar to previous changes (1)
  • frontend/public/components/terminal.tsx

Walkthrough

The terminal resize callback now catches exceptions across fitting, resize notification, and textarea synchronization. An exception stops the remaining resize processing.

Changes

Terminal resize handling

Layer / File(s) Summary
Guard terminal resize processing
frontend/public/components/terminal.tsx
The callback replaces the internal xterm dimension check with try/catch handling around the complete resize sequence.

Estimated code review effort: 2 (Simple) | ~10 minutes

Suggested reviewers: jcaianirh

🚥 Pre-merge checks | ✅ 15
✅ Passed checks (15 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the xterm ResizeObserver crash fix and includes the required Jira issue prefix.
Description check ✅ Passed The description covers root cause, solution, testing, browser status, additional impact, and reviewer information.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Stable And Deterministic Test Names ✅ Passed The commit changes only frontend/public/components/terminal.tsx. It adds no Ginkgo test files or It/Describe/Context/When titles, so no unstable test name exists to flag.
Test Structure And Quality ✅ Passed The PR changes only frontend/public/components/terminal.tsx; no Ginkgo test files or test blocks were added or modified, so these requirements are not applicable.
Microshift Test Compatibility ✅ Passed The pull request changes only frontend/public/components/terminal.tsx and adds no Ginkgo e2e tests, so MicroShift API compatibility checks do not apply.
Single Node Openshift (Sno) Test Compatibility ✅ Passed The commit changes only frontend/public/components/terminal.tsx and adds no Ginkgo e2e tests, so SNO compatibility checks do not apply.
Topology-Aware Scheduling Compatibility ✅ Passed The pull request changes only frontend/public/components/terminal.tsx, adding try/catch around xterm resize handling; it adds no deployment, operator, controller, or scheduling constraints.
Ote Binary Stdout Contract ✅ Passed The commit changes only frontend/public/components/terminal.tsx; it adds no OTE binary, suite setup, or process-level stdout write.
Ipv6 And Disconnected Network Test Compatibility ✅ Passed The commit changes only frontend/public/components/terminal.tsx and adds no Ginkgo e2e tests or networking operations; the IPv6/disconnected test check does not apply.
No-Weak-Crypto ✅ Passed The only changed file adds error handling around xterm resizing; the diff contains no MD5, SHA1, DES, RC4, Blowfish, ECB, custom crypto, or secret comparisons.
Container-Privileges ✅ Passed The only changed file is terminal.tsx, and its diff contains resize error handling only; no privileged, hostPID, hostNetwork, hostIPC, SYS_ADMIN, root, or allowPrivilegeEscalation settings are added.
No-Sensitive-Data-In-Logs ✅ Passed The commit only adds exception handling in the terminal resize callback; it adds no logging and exposes no sensitive data.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands.

@openshift-ci openshift-ci Bot added the component/core Related to console core functionality label Aug 6, 2026
@logonoff

logonoff commented Aug 6, 2026

Copy link
Copy Markdown
Member

/pipeline required

@openshift-merge-bot

Copy link
Copy Markdown
Contributor

Scheduling tests matching the pipeline_run_if_changed or not excluded by pipeline_skip_if_only_changed parameters:
/test e2e-gcp-console
/test e2e-playwright

@sg00dwin sg00dwin left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

/lgtm

@openshift-ci openshift-ci Bot added the lgtm Indicates that a PR is ready to be merged. label Aug 6, 2026
@openshift-merge-bot

Copy link
Copy Markdown
Contributor

Tests from second stage were triggered manually. Pipeline can be controlled only manually, until HEAD changes. Use command to trigger second stage.

@ericahinkleRH

Copy link
Copy Markdown
Contributor Author

/test e2e-gcp-console-techpreview

@ericahinkleRH

Copy link
Copy Markdown
Contributor Author

/test e2e-gcp-console

2 similar comments
@ericahinkleRH

Copy link
Copy Markdown
Contributor Author

/test e2e-gcp-console

@ericahinkleRH

Copy link
Copy Markdown
Contributor Author

/test e2e-gcp-console

@openshift-ci openshift-ci Bot removed the lgtm Indicates that a PR is ready to be merged. label Aug 7, 2026
@ericahinkleRH

Copy link
Copy Markdown
Contributor Author

/test backend

…sions

The ResizeObserver callback accesses xterm's internal dimensions getter
via fit.fit() and _syncTextArea(), both of which throw when the render
service is partially initialized. Wrap the entire resize sequence in a
try-catch so the callback safely skips the resize instead of crashing.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@ericahinkleRH
ericahinkleRH force-pushed the OCPBUGS-105314-fix-xterm-resize branch from 48eaa7b to 2c826a6 Compare August 7, 2026 14:57
@TheRealJon

Copy link
Copy Markdown
Member

/jira refresh

@openshift-ci-robot openshift-ci-robot added the jira/valid-bug Indicates that a referenced Jira bug is valid for the branch this PR is targeting. label Aug 7, 2026
@openshift-ci-robot

Copy link
Copy Markdown
Contributor

@TheRealJon: This pull request references Jira Issue OCPBUGS-105314, which is valid. The bug has been moved to the POST state.

3 validation(s) were run on this bug
  • bug is open, matching expected state (open)
  • bug target version (5.0.0) matches configured target version for branch (5.0.0)
  • bug is in the state New, which is one of the valid states (NEW, ASSIGNED, POST)
Details

In response to this:

/jira refresh

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@openshift-ci-robot openshift-ci-robot removed the jira/invalid-bug Indicates that a referenced Jira bug is invalid for the branch this PR is targeting. label Aug 7, 2026

@TheRealJon TheRealJon left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

/lgtm

@openshift-ci openshift-ci Bot added the lgtm Indicates that a PR is ready to be merged. label Aug 7, 2026
@openshift-merge-bot

Copy link
Copy Markdown
Contributor

Scheduling tests matching the pipeline_run_if_changed or not excluded by pipeline_skip_if_only_changed parameters:
/test e2e-gcp-console
/test e2e-playwright

@openshift-ci

openshift-ci Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: ericahinkleRH, sg00dwin, TheRealJon

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci openshift-ci Bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Aug 7, 2026
@TheRealJon

Copy link
Copy Markdown
Member

/verified by CI

@openshift-ci-robot openshift-ci-robot added the verified Signifies that the PR passed pre-merge verification criteria label Aug 7, 2026
@openshift-ci-robot

Copy link
Copy Markdown
Contributor

@TheRealJon: This PR has been marked as verified by CI.

Details

In response to this:

/verified by CI

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@openshift-ci

openshift-ci Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

@ericahinkleRH: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/e2e-playwright 2c826a6 link false /test e2e-playwright

Full PR test history. Your PR dashboard.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

@openshift-merge-bot
openshift-merge-bot Bot merged commit 1dfb9ea into openshift:main Aug 7, 2026
10 of 11 checks passed
@openshift-ci-robot

Copy link
Copy Markdown
Contributor

@ericahinkleRH: Jira Issue Verification Checks: Jira Issue OCPBUGS-105314
✔️ This pull request was pre-merge verified.
✔️ All associated pull requests have merged.
✔️ All associated, merged pull requests were pre-merge verified.

Jira Issue OCPBUGS-105314 has been moved to the MODIFIED state and will move to the VERIFIED state when the change is available in an accepted nightly payload. 🕓

Details

In response to this:

Analysis / Root cause:
PR #16498 (OCPBUGS-84649, merged Jul 30) replaced the terminal resize logic in terminal.tsx with a ResizeObserver-based pattern. The guard on line 94 used optional chaining (_renderService?.dimensions) to check if xterm's render service was initialized, but dimensions is a getter — when _renderService exists but is partially initialized, the getter throws Cannot read properties of undefined (reading 'dimensions') instead of returning undefined. This uncaught error fails any Cypress test that navigates to a debug terminal page, causing a 74% flake rate on e2e-gcp-console.

Solution description:
Replaced the broken optional chaining guard with a try-catch around fit.fit(). If the fit addon throws because xterm's render service isn't ready, the callback safely returns without crashing.

Screenshots / screen recording:
N/A — no visual changes.

Test setup:
N/A — fix is verified by existing debug-pod.cy.ts Cypress tests passing consistently.

Test cases:

  1. Verify debug terminal page loads without uncaught TypeError
  2. Verify terminal still resizes correctly after initialization
  3. Verify e2e-gcp-console CI passes without the debug-pod flake

Browser conformance:

  • Chrome
  • Firefox
  • Safari (or Epiphany on Linux)

Additional info:
This bug has caused a 74% failure rate on e2e-gcp-console since PR #16498 merged, affecting 17 unique PRs.

Jira: https://issues.redhat.com/browse/OCPBUGS-105314

Reviewers and assignees:
/cc @jcaianirh

Summary by CodeRabbit

  • Bug Fixes
  • Improved terminal resizing reliability by safely handling errors during fitting, resize notifications, and input synchronization.
  • Prevented incomplete resize operations when an internal error occurs.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. component/core Related to console core functionality jira/severity-important Referenced Jira bug's severity is important for the branch this PR is targeting. jira/valid-bug Indicates that a referenced Jira bug is valid for the branch this PR is targeting. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. lgtm Indicates that a PR is ready to be merged. verified Signifies that the PR passed pre-merge verification criteria

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants