-
Notifications
You must be signed in to change notification settings - Fork 326
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
linux: fix a hang if there are no reads from the tty #1623
linux: fix a hang if there are no reads from the tty #1623
Conversation
marked as a draft, as I need to test it more |
4555a83
to
a8a67b4
Compare
a8a67b4
to
61c2d7d
Compare
this PR fixes the problem as expected 🎉 |
/approve |
61c2d7d
to
c1c2271
Compare
c1c2271
to
50b60e2
Compare
50b60e2
to
67d862e
Compare
int ret, container_exit_code = 0, last_process; | ||
cleanup_close int terminal_fd_from = -1; | ||
cleanup_close int terminal_fd_to = -1; | ||
const size_t max_events = 10; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it make sense to make this a definition with an added comment about what it's for?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not sure, I can add a comment if you feel we need it, but this is an arbitrary limit defined only to avoid using the same constant multiple times.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No worries. This is fine, too. A #define is just a habit.
commit 1832c17 introduced the change. Signed-off-by: Giuseppe Scrivano <[email protected]>
Signed-off-by: Giuseppe Scrivano <[email protected]>
Signed-off-by: Giuseppe Scrivano <[email protected]>
Signed-off-by: Giuseppe Scrivano <[email protected]>
67d862e
to
c687e11
Compare
Ephemeral COPR build failed. @containers/packit-build please check. |
c687e11
to
66be626
Compare
Signed-off-by: Giuseppe Scrivano <[email protected]>
avoid a "crun exec" hang when the the other end of the terminal stopped reading. That happened because `copy_fd_to_fd` tried to write everything that it has received from the source fd, so it would hang the current process. Prevent that using non blocking file descriptors and using epoll to detect when the file descriptor is available for write. Fixes: https://issues.redhat.com/browse/OCPBUGS-45632 Signed-off-by: Giuseppe Scrivano <[email protected]>
66be626
to
8b972be
Compare
@saschagrunert @haircommander PTAL. It is ready to merge (assuming a happy CI) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
avoid a "crun exec" hang when the the other end of the terminal stopped reading.
That happened because
copy_fd_to_fd
tried to write everything that it has received from the source fd, so it would hang the current process. Prevent that using non blocking file descriptors and using epoll to detect when the file descriptor is available for write.Fixes: https://issues.redhat.com/browse/OCPBUGS-45632