Skip to content

fix: drain SSH stdout/stderr while command runs to avoid large-output deadlock#258

Merged
gescheit merged 1 commit intoannetutil:mainfrom
znick:drain-ssh-output
Jan 27, 2026
Merged

fix: drain SSH stdout/stderr while command runs to avoid large-output deadlock#258
gescheit merged 1 commit intoannetutil:mainfrom
znick:drain-ssh-output

Conversation

@znick
Copy link
Contributor

@znick znick commented Jan 26, 2026

Before fix:

./cli -debug -hostname HOST -login LOGIN -devtype pc -command 'cat 2mb.txt' -password PASSWORD -json  > /dev/null
2026-01-27T00:03:06.936+0100	DEBUG	ssh/ssh.go:768	open connection	{"host": "HOST", "port": 22, "addresses": []}
2026-01-27T00:03:06.937+0100	DEBUG	ssh/ssh.go:1123	tcp dial	{"address": "HOST:22"}
2026-01-27T00:03:07.011+0100	DEBUG	ssh/ssh.go:1135	tcp ssh	{"address": "HOST:22"}
2026-01-27T00:03:07.364+0100	DEBUG	ssh/ssh.go:877	passwordCallback	{"passwordIndex": 0}
2026-01-27T00:03:07.459+0100	DEBUG	ssh/ssh.go:421	run cmd	{"cmd": "cat 2mb.txt"}

stuck forever, because nobody reads stdout

(2mb.txt - file with 2MB size)

@znick znick changed the title fix: drain SSH stdout/stderr while command runs to avoid large-output… fix: drain SSH stdout/stderr while command runs to avoid large-output deadlock Jan 26, 2026
@znick znick marked this pull request as ready for review January 26, 2026 23:08
@gescheit gescheit merged commit 3c37947 into annetutil:main Jan 27, 2026
5 checks passed
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