-
-
Notifications
You must be signed in to change notification settings - Fork 30
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
Allow request_exec with async I/O and more #576
Merged
Merged
Conversation
This file contains 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
pbrezina
force-pushed
the
extras
branch
3 times, most recently
from
February 2, 2024 15:53
e166d74
to
92572c3
Compare
psf-chronographer
bot
added
the
bot:chronographer:provided
There is a change note present in this PR
label
Feb 2, 2024
webknjaz
reviewed
Feb 3, 2024
webknjaz
reviewed
Feb 3, 2024
webknjaz
reviewed
Feb 3, 2024
webknjaz
reviewed
Feb 3, 2024
webknjaz
reviewed
Feb 3, 2024
webknjaz
reviewed
Feb 3, 2024
webknjaz
reviewed
Feb 3, 2024
webknjaz
reviewed
Feb 3, 2024
webknjaz
reviewed
Feb 3, 2024
webknjaz
reviewed
Feb 3, 2024
webknjaz
reviewed
Feb 3, 2024
webknjaz
reviewed
Feb 3, 2024
webknjaz
reviewed
Feb 3, 2024
webknjaz
reviewed
Feb 3, 2024
webknjaz
reviewed
Feb 3, 2024
webknjaz
reviewed
Feb 3, 2024
webknjaz
reviewed
Feb 3, 2024
pbrezina
force-pushed
the
extras
branch
5 times, most recently
from
February 5, 2024 12:16
de1d4eb
to
87fc2bd
Compare
It is ready for next round of review. I addresses all comments, leaving few as "unresolved" in case you want to discuss it further. |
webknjaz
reviewed
Feb 5, 2024
webknjaz
reviewed
Feb 5, 2024
webknjaz
reviewed
Feb 5, 2024
webknjaz
reviewed
Feb 5, 2024
webknjaz
reviewed
Feb 5, 2024
webknjaz
reviewed
Feb 5, 2024
pbrezina
force-pushed
the
extras
branch
2 times, most recently
from
February 6, 2024 10:11
6561702
to
822f443
Compare
To allow asynchronous handling of the execution.
OpenSSH now supports receiving signals for a long time. This is useful when you need to communicate with a process via signals.
If recv_nonblocking is called and the ssh command ended with EOF and empty output, the following error is produced because nbytes == SSS_EOF == -127: ``` File "src/pylibsshext/channel.pyx", line 112, in pylibsshext.channel.Channel.read_nonblocking SystemError: Negative size passed to PyBytes_FromStringAndSize ``` It is better to handle it gracefully.
When doing asynchronous I/O it is usefull to know when EOF is hit after polling for data.
It may happen that a garbage collector collects Session object befor unclosed Channel. Then Channel's destructor tries to close the channel, libssh session is accessed but it is already freed, thus causing segfault. Keeping reference to the Session object makes sure that Session is collected after Channel.
Thank you. It is ready for next round. |
webknjaz
approved these changes
Feb 6, 2024
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.
Thank you for the well-explained patch!
webknjaz
reviewed
Feb 6, 2024
Previous implementation of wait_for_svc_ready_state was not robust enough as it could return even if further ssh connections kept failing.
webknjaz
pushed a commit
that referenced
this pull request
May 31, 2024
As of #576, `ssh` client started being used in tests to ensure that sshd is ready to receive connectoins. That PR failed to include this patch so it's being applied separately.
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.
This PR add calls to
libssh
request_exec()
and relevant functions in orderto allow non-blocking async I/O. I need this to replace
parallel-ssh
whichunfortunately became a dead project, incompatible with Python 3.12+.
Additionally, it adds call to
libssh
request_send_signal()
which allows tosend signals to the remote process if SSH server supports it.
I also fixed few bugs that I stumbled upon.
SUMMARY
$sbj.
ISSUE TYPE
ADDITIONAL INFORMATION
N/A