Welcome to the Inedo Forums! Check out the Forums Guide for help getting started.
If you are experiencing any issues with the forum software, please visit the Contact Form on our website and let us know!
[Buildmaster] - SshException: Unable to send channel request
-
Hello Inedo, the community, everyone,
One of our scripts is running into an issue in buildmaster.
This script is involved in a deployment pipeline that has been used with success for a long time.Basically, it consists in an Otterscript dealing with a build variable by sending it as an argument to a subsequent Shell script invoked with SHCall.
When this argument exceeds 34632 characters, or when multiple passed arguments exceed together 34632 characters, the execution fails with :
Unable to send channel request Unhandled exception: Inedo.Agents.Ssh.SshException: Unable to send channel request at Inedo.Agents.Ssh.Libssh2.Libssh2Session.HandleError(Int32 res, IntPtr sftp) at Inedo.Agents.Ssh.Libssh2.Libssh2Session.WithSocketAsync[T](Func`1 run, Func`2 getError, IntPtr sftp, CancellationToken cancellationToken) at Inedo.Agents.Ssh.SshProcess.StartInternalAsync(CancellationToken cancellationToken) at Inedo.Agents.Ssh.SshProcess.StartInternalAsync(CancellationToken cancellationToken) at Inedo.Extensions.Scripting.Operations.Shell.SHUtil.ExecuteShellScriptAsync(IShellOperation operation, ShellStartInfo startInfo, IOperationExecutionContext context) in C:\Users\builds\AppData\Local\Temp\InedoAgent\BuildMaster\192.168.44.60\Temp\_E573257\Src\Scripting\InedoExtension\Operations\Shell\SHUtil.cs:line 264 at Inedo.Extensions.Scripting.Operations.Shell.SHUtil.ExecuteShellScriptAhAsync[TOperation](TOperation operation, IOperationExecutionContext context, String execMode) in C:\Users\builds\AppData\Local\Temp\InedoAgent\BuildMaster\192.168.44.60\Temp\_E573257\Src\Scripting\InedoExtension\Operations\Shell\SHUtil.cs:line 389 at Inedo.Extensions.Scripting.Operations.Shell.SHCallOperation.ExecuteAsync(IOperationExecutionContext context) in C:\Users\builds\AppData\Local\Temp\InedoAgent\BuildMaster\192.168.44.60\Temp\_E573257\Src\Scripting\InedoExtension\Operations\Shell\SHCallOperation.cs:line 81 at Inedo.BuildMaster.Windows.ServiceApplication.Executions.PlanExecuter.OtterScriptExecuter.Inedo.ExecutionEngine.Executer.IExecutionHostEnvironment.ExecuteActionAsync(ActionStatement actionStatement, IExecuterContext context) in C:\Users\builds\AppData\Local\Temp\InedoAgent\BuildMaster\192.168.44.60\Temp\_E574178\Src\BuildMasterSolution\BuildMaster.Service\Executions\PlanExecuter\OtterScriptExecuter.cs:line 350The pipeline looks like :
{ "Name": "pipeline", "Stages": [ { "Name": "test", "Targets": [ { "ScriptId": "global::OtterScript", "EnvironmentName": "test", "ServerNames": [ "server" ], [...]The server which the Shell script is submitted on is Linux like and the used credentials are SSHKeyPair.
I suspect that some SSH agent is implemented by Buildmaster.The Otterscript looks like :
##AH:UseTextMode set $arg="<more than 34632 characters>"; # Test Otterscript { { # # SHcall { SHCall Test_SSH ( Arguments: $arg,Our instance runs Buildmaster 7.0.23 but I am able to reproduce the issue in Buildmaster 2024.8
Could you please help ?
Thank you.
-
Hi @Anthony ,
When you use
SHCall, it's translated into a remote SSH command that includes all arguments inline on the shell. Basically something likessh user@host bash -c '...'However, there is an OS-enforced limit on how long this can be, which is typically between ~32K and ~64K characters. It looks like you're there exactly, and you may be able to see this limit with
getconf ARG_MAX. Note that you would also get this error if you didssh user@host bash -c 'echo "Really long....."'.So bottom line -- this is an OS/SSH limit. To work-around it, you can just write out
$argto a file, and have your script read in that file.Thanks,
Alana