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

hubble observe does not work with stdin redirection #809

Closed
bimmlerd opened this issue Nov 7, 2022 · 4 comments · Fixed by #815
Closed

hubble observe does not work with stdin redirection #809

bimmlerd opened this issue Nov 7, 2022 · 4 comments · Fixed by #815
Labels
⌨️ area/cli Impacts the command line interface of any command in the repository. 🐛 kind/bug This is a bug in the Hubble logic.

Comments

@bimmlerd
Copy link
Member

bimmlerd commented Nov 7, 2022

Trying to avoid a useless use of cat I typed hubble observe < cilium-55s8v-hubble_observe.json, but was greeted with a cryptic failed to connect to 'localhost:4245': connection error: desc = "transport: error while dialing: dial tcp [::1]:4245: connect: connection refused". Typing cat cilium-55s8v-hubble_observe.json | hubble observe worked fine.

I'm guessing that the error stems from it trying and failing to connect to some cluster because tty detection (?) fails in this case. cc @gandro.

This happens both on zsh (5.8.1) and bash (5.2) on macOS Ventura 13.0 with hubble v0.10.0

@bimmlerd bimmlerd added 🐛 kind/bug This is a bug in the Hubble logic. ⌨️ area/cli Impacts the command line interface of any command in the repository. labels Nov 7, 2022
@bimmlerd
Copy link
Member Author

bimmlerd commented Nov 7, 2022

hubble/cmd/observe/flows.go

Lines 157 to 160 in a24aa4b

if fi.Mode()&os.ModeNamedPipe != 0 {
// read flows from stdin
client = newIOReaderObserver(os.Stdin)
logger.Logger.Debug("Reading flows from stdin")
looks like the culprit, I suspect input redirection is different from a FIFO pipe?

@gandro
Copy link
Member

gandro commented Nov 7, 2022

Reproducible on linux-amd64 (archlinux)

@rolinh
Copy link
Member

rolinh commented Nov 14, 2022

I have a patch here, could you confirm that it works for you?

@bimmlerd
Copy link
Member Author

Works for me, nice 🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
⌨️ area/cli Impacts the command line interface of any command in the repository. 🐛 kind/bug This is a bug in the Hubble logic.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants