Panic fix: exit early if terminal size is 0 - #3418
Draft
Steven Gagniere (sgagniere) wants to merge 1 commit into
Draft
Panic fix: exit early if terminal size is 0#3418Steven Gagniere (sgagniere) wants to merge 1 commit into
Steven Gagniere (sgagniere) wants to merge 1 commit into
Conversation
|
🎉 All Contributor License Agreements have been signed. Ready to merge. |
There was a problem hiding this comment.
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.") | ||
| } |
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.
Release Notes
Breaking Changes
New Features
Bug Fixes
Checklist
Whatsection below whether this PR applies to Confluent Cloud, Confluent Platform, or both.Test & Reviewsection below.Blast Radiussection below.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