Inedo Community Forums Forums
    • Recent
    • Tags
    • Popular
    • Login

    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

    Scheduled Pinned Locked Moved Support
    2 Posts 2 Posters 5 Views 1 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • A Offline
      Anthony
      last edited by Anthony

      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 350
      

      The 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.

      1 Reply Last reply Reply Quote 0
      • atrippA Offline
        atripp inedo-engineer
        last edited by

        Hi @Anthony ,

        When you use SHCall, it's translated into a remote SSH command that includes all arguments inline on the shell. Basically something like ssh 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 did ssh 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 $arg to a file, and have your script read in that file.

        Thanks,
        Alana

        1 Reply Last reply Reply Quote 0

        Hello! It looks like you're interested in this conversation, but you don't have an account yet.

        Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

        With your input, this post could be even better 💗

        Register Login
        • 1 / 1
        • First post
          Last post
        Inedo Website Home • Support Home • Code of Conduct • Forums Guide • Documentation