darkoperator / darkoperator/Posh-SSH

Invoke-SSHCommand times out quickly even when Timeout parameter is set

Open
#339 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
PowerShell
Stars
1.1k
Forks
222
PR merge metrics
No merged PRs in 30d

Description

I'm having an issue with Invoke-SSHCommand with timeouts. If I set the timeout to e.g. 2 minutes, I still get an exception from within the CheckAsyncProcessing function and the EndExecute method after approx 30 seconds:

At G:\My Drive\PowerShell\Modules\posh-ssh\2.2\Posh-SSH.psm1:260 char:25                                                
+                         $Output = $_.cmd.EndExecute($_.Async)                                                         
+                         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~                                                         
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException                                           
    + FullyQualifiedErrorId : SshOperationTimeoutException

Looking elsewhere, the timeout on the BeginExecute seems to be set to 50ms.
Is it possible to set a user defined timeout for this background processing?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in Posh-SSH.psm1 around line 260 and trace CheckAsyncProcessing through BeginExecute and EndExecute, focusing on how the Timeout parameter is applied to background processing. Reproduce the approximately 30-second failure with a longer timeout, then verify that the configured timeout controls the operation instead.

Written by the indexing model from the issue text.

Assessment

Tech stack
powershell
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.