Open valeriob opened 1 month ago
Hmm, could be. Are you running in a GUI / ASP.NET / non-console environment?
Can you reproduce the problem consistently?
If yes, does making this tweak to the library make a difference?
diff --git a/src/Renci.SshNet/SshCommand.cs b/src/Renci.SshNet/SshCommand.cs
index 6bfd5742..96188e4c 100644
--- a/src/Renci.SshNet/SshCommand.cs
+++ b/src/Renci.SshNet/SshCommand.cs
@@ -279,7 +279,7 @@ public Task ExecuteAsync(CancellationToken cancellationToken = default)
_cts = null;
_cancellationRequested = false;
- _tcs = new TaskCompletionSource<object>(TaskCreationOptions.RunContinuationsAsynchronously);
+ _tcs = new TaskCompletionSource<object>(TaskCreationOptions.None);
_userToken = cancellationToken;
_channel = _session.CreateChannelSession();
Hello @Rob-Hague i'm running on a dotnet 7 console program, it blocks after 1 hour, but id depends on the load i guess. At the moment i got back to version 2023.0.1 and it's up for one day without issues.
Probably the issue is something else, i got a lock also with the older version : i think something gets stuck when the connection is unstable, we are connecting to devices that move around connected via GSM.
Probably more similar to : https://github.com/sshnet/SSH.NET/issues/462
In that case I'm not sure if there is something actionable here. I think my prior comment about TaskCreationOptions
was nonsensical because there are no continuations attached to the Task when using the sync Execute
At the moment i had to put the ssh command execution on a dedicated thread and add a watchdog to kill if not completed after some timeout.
Hi, i'm trying latest release 2024.1.0 and i think i found an issue with the api, there is a deadlock in the Renci.SshNet.SshCommand.Execute()
is it due the sync over async antipattern ?
Probably makes sense to do a fully async api to avoid the issue ?