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

Fix CancelAsync Cause Deadlock #1345

Merged
merged 9 commits into from
Mar 24, 2024
Merged

Conversation

zeotuan
Copy link
Contributor

@zeotuan zeotuan commented Mar 7, 2024

Fix CancelAsync causing deadlocking:

it now signal WaitHandle of Cancelled event after sending SIGTERM/SIGKILL signal to try to abort the request.

close #1147 and close #1023

@zeotuan zeotuan marked this pull request as ready for review March 7, 2024 02:14
Copy link
Collaborator

@Rob-Hague Rob-Hague left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be possible to add a test for forceKill = true as well?

src/Renci.SshNet/SshCommand.cs Outdated Show resolved Hide resolved
@@ -356,13 +357,12 @@ public string EndExecute(IAsyncResult asyncResult)
/// <summary>
/// Cancels command execution in asynchronous scenarios.
/// </summary>
public void CancelAsync()
/// <param name="forceKill">if true send SIGKILL instead of SIGTERM.</param>
public void CancelAsync(bool forceKill = false)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps we drop the Async suffix here (and obsolete CancelAsync) as it is not an async method. @WojciechNagorski?

@zeotuan zeotuan requested a review from Rob-Hague March 21, 2024 22:55
Copy link
Collaborator

@WojciechNagorski WojciechNagorski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately, I don't have much time for this project at the moment. Only PRs that have @Rob-Hague's approval are verified and merged by me.

@WojciechNagorski WojciechNagorski merged commit db3d7e8 into sshnet:develop Mar 24, 2024
1 check 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
3 participants