Skip to content

Panic fix: exit early if terminal size is 0 - #3418

Draft
Steven Gagniere (sgagniere) wants to merge 1 commit into
mainfrom
flink-terminal-size-panic-fix
Draft

Panic fix: exit early if terminal size is 0#3418
Steven Gagniere (sgagniere) wants to merge 1 commit into
mainfrom
flink-terminal-size-panic-fix

Conversation

@sgagniere

Copy link
Copy Markdown
Member

Release Notes

Breaking Changes

  • PLACEHOLDER

New Features

  • PLACEHOLDER

Bug Fixes

  • PLACEHOLDER

Checklist

  • I have successfully built and used a custom CLI binary, without linter issues from this PR.
  • I have clearly specified in the What section below whether this PR applies to Confluent Cloud, Confluent Platform, or both.
  • I have verified this PR in Confluent Cloud pre-prod or production environment, if applicable.
  • I have verified this PR in Confluent Platform on-premises environment, if applicable.
  • I have attached manual CLI verification results or screenshots in the Test & Review section below.
  • I have added appropriate CLI integration or unit tests for any new or updated commands and functionality.
  • I confirm that this PR introduces no breaking changes or backward compatibility issues.
  • I have indicated the potential customer impact if something goes wrong in the Blast Radius section below.
  • I have put checkmarks below confirming that the feature associated with this PR is enabled in:
    • Confluent Cloud prod
    • Confluent Cloud stag
    • Confluent Platform
    • Check this box if the feature is enabled for certain organizations only

What

A terminal with column or row size 0 will cause a panic in one of our dependencies. This PR adds a check right after the console parser is instantiated and checks the console parser's window dimensions during setup so that we can avert the crash when users attempt to type anything.

Blast Radius

References

Test & Review

TODO: Add testing results

Copilot AI review requested due to automatic review settings July 29, 2026 20:49
@confluent-cla-assistant

Copy link
Copy Markdown

🎉 All Contributor License Agreements have been signed. Ready to merge.
Please push an empty commit if you would like to re-run the checks to verify CLA status for all contributors.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR aims to prevent a panic in the Flink SQL shell caused by terminals reporting a zero-sized window, by validating terminal dimensions immediately after the console parser is initialized and exiting early when dimensions are invalid.

Changes:

  • Added a terminal window size validation after console parser setup in the cloud Flink shell startup path.
  • Added the same validation in the on-prem Flink shell startup path.
Comments suppressed due to low confidence (1)

pkg/flink/app/application.go:157

  • Same issue as the cloud path: returning here occurs after consoleParser.Setup() but before any cleanup is registered, so the terminal can be left in an altered state if the shell exits early. Tear down the console parser and restore stdin before returning.
	if winSize := consoleParser.GetWinSize(); winSize != nil && (winSize.Col == 0 || winSize.Row == 0) {
		return errors.NewErrorWithSuggestions("failed to determine terminal size or terminal size is 0", "Check that your terminal window has valid dimensions.")
	}

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +88 to +90
if winSize := consoleParser.GetWinSize(); winSize != nil && (winSize.Col == 0 || winSize.Row == 0) {
return errors.NewErrorWithSuggestions("failed to determine terminal size or terminal size is 0", "Check that your terminal window has valid dimensions.")
}
Comment on lines +88 to +90
if winSize := consoleParser.GetWinSize(); winSize != nil && (winSize.Col == 0 || winSize.Row == 0) {
return errors.NewErrorWithSuggestions("failed to determine terminal size or terminal size is 0", "Check that your terminal window has valid dimensions.")
}
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.

2 participants