Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Interactive console becomes unresponsive after ";" query #700

Closed
aidansteele opened this issue Jul 28, 2021 · 2 comments
Closed

Interactive console becomes unresponsive after ";" query #700

aidansteele opened this issue Jul 28, 2021 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@aidansteele
Copy link

Description: When I enter a line of only a semicolon into the interactive query console, it becomes unresponsive. Ctrl+C and Ctrl+D no longer work. The only option is to Ctrl+Z and then manually SIGKILL the steampipe and postgres processes.

Potential cause:

This code is executed when a query is only the semicolon character:

// if the line is ONLY a semicolon, do nothing and restart interactive session
if strings.TrimSpace(query) == ";" {
c.restartInteractiveSession()
return "", nil
}

It appears to shortcircuit the typical query execution path, so the main REPL hangs here forever:

// wait for the resultsStreamer to have streamed everything out
// this is to be sure the previous command has completed streaming
c.resultsStreamer.Wait()

A workaround: Elsewhere in the file there is a workaround to return control back to the main REPL. Pasting this workaround (c.resultsStreamer.Done()) in the first code excerpt does appear to "fix" this bug:

// HACK mark result streamer as done so we do not wait for it before restarting prompt
// TODO would be better if result stream checked if it was started
c.resultsStreamer.Done()

Discussion: To be honest, I'm not 100% sure what the purpose of the "do nothing and restart interactive session" functionality is - so I can't submit a PR that I'm confident is the correct way to fix this. Hope this bug report helps nonetheless.

@binaek
Copy link
Contributor

binaek commented Jul 28, 2021

@aidansteele Thank you for the detailed information on the issue. This will be a great help when debugging the issue

We recently did a major refactor of the interactive prompt.

This must have crept in then.

We will take a look into this and publish a fix.

@kaidaguerre
Copy link
Contributor

kaidaguerre commented Jul 29, 2021

@aidansteele many thanks for digging into this issue. I have released a fix in version Steampipe version 0.7.1

As @binaek89 mentioned, we have been overhauling the interactive prompt and there is a little more rationalisation still required.

The fix you identified is the good tactical solution and that is essentially what I have implemented for now. Medium term, I will be looking at simplifying the result streamer to remove underlying issue.

ahirreddy pushed a commit to ahirreddy/steampipe that referenced this issue Jul 8, 2024
Co-authored-by: misraved <ved@turbot.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants