升级后无法连接到 Jenkins Agent

Unable to connect to Jenkins Agent after upgrade

将 Jenkins 从 2.257 升级到 2.339。升级后 none 个节点能够连接到主节点。 Jenkins 托管在亚马逊 Linux 上。这是我尝试将节点连接到控制器时遇到的错误:

来自 Windows 代理的日志:

SSHLauncher{host='172.*.*.*', port=22, credentialsId='3f7dbc2d-7850-4506-a356-24328ded5b43', jvmOptions='', javaPath='', prefixStartSlaveCmd='', suffixStartSlaveCmd='', launchTimeoutSeconds=210, maxNumRetries=10, retryWaitTime=15, sshHostKeyVerificationStrategy=hudson.plugins.sshslaves.verifiers.ManuallyTrustedKeyVerificationStrategy, tcpNoDelay=true, trackCredentials=true}
[03/20/22 14:38:59] [SSH] Opening SSH connection to 172.*.*.*.
[03/20/22 14:38:59] [SSH] SSH host key matches key seen previously for this host. Connection will be allowed.
[03/20/22 14:38:59] [SSH] Authentication successful.
[03/20/22 14:38:59] [SSH] The remote user's environment is:
ALLUSERSPROFILE='C:\<some folder>'
ANDROID_HOME='C:\<some path>'
ANDROID_NDK_HOME='C:\<some path>'
APPDATA='C:\Users\<jenkis user>\AppData\Roaming'
BASH=/bin/bash
BASHOPTS=cmdhist:complete_fullquote:extquote:force_fignore:hostcomplete:interactive_comments:progcomp:promptvars:sourcepath
BASH_ALIASES=()
BASH_ARGC=()
BASH_ARGV=()
BASH_CMDS=()
BASH_EXECUTION_STRING=set
BASH_LINENO=()
BASH_SOURCE=()
BASH_VERSINFO=([0]="4" [1]="4" [2]="12" [3]="3" [4]="release" [5]="x86_64-unknown-cygwin")
BASH_VERSION='4.4.12(3)-release'
COMPUTERNAME=EC2AMAZ-ML17J1C
COMSPEC='C:\Windows\system32\cmd.exe'
CYGWIN=sshd
CYG_SYS_BASHRC=1
CommonProgramFiles='C:\Program Files\Common Files'
CommonProgramW6432='C:\Program Files\Common Files'
DIRSTACK=()
EUID=197608
GROUPS=()
GTK_BASEPATH='C:\Program Files (x86)\GtkSharp.12\'
HOME=/home/<some path>
HOMEDRIVE=C:
HOMEPATH='\cygwin64\home\<some path>'
HOSTNAME=someserver
HOSTTYPE=x86_64
IFS=$' \t\n'
JAVA_HOME='C:\Program Files\Java\jdk1.8.0_144'
LOCALAPPDATA='C:\Users\<somem user>\AppData\Local'
LOGNAME=<login user>
LOGONSERVER='\someserver
M2_HOME='C:\apache-maven-3.3.9'
MACHTYPE=x86_64-unknown-cygwin
MAIL=/var/spool/mail//Jenkins
MAVEN_HOME='C:\apache-maven-3.3.9'
NUMBER_OF_PROCESSORS=4
OPTERR=1
OPTIND=1
OS=Windows_NT
OSTYPE=cygwin
PATH=''
PATHEXT='.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC'
PIPESTATUS=([0]="0")
PPID=5896
PROCESSOR_ARCHITECTURE=AMD64
PROCESSOR_IDENTIFIER='Intel64 Family 6 Model 85 Stepping 7, GenuineIntel'
PROCESSOR_LEVEL=6
PROCESSOR_REVISION=5507
PROGRAMFILES='C:\Program Files'
PS4='+ '
PSModulePath='%ProgramFiles%\WindowsPowerShell\Modules;C:\Windows\system32\WindowsPowerShell\v1.0\Modules;C:\Program Files (x86)\AWS Tools\PowerShell\'
PUBLIC='C:\Users\Public'
PWD=/home/<somepath>
ProgramData='C:\ProgramData'
ProgramW6432='C:\Program Files'
SHELL=/bin/bash
SHELLOPTS=braceexpand:hashall:interactive-comments
SHLVL=1
SSH_AUTH_SOCK=/tmp/ssh-xQ6x4PUqHRF7/agent.34688
SSH_CLIENT='172.*.*.* 52306 22'
SSH_CONNECTION='172.*.*.* 52306 172.*.*.* 22'
SYSTEMDRIVE=C:
SYSTEMROOT='C:\Windows'
TERM=dumb
UID=197608
USER=<some user>
USERDOMAIN=someserver
USERNAME=<some user>
USERPROFILE='C:\Users\<some user>'
VS140COMNTOOLS='C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\Tools\'
WINDIR='C:\Windows'
_=
[03/20/22 14:38:59] [SSH] Checking java version of c:\<some path>/jdk/bin/java
Couldn't figure out the Java version of c:\<some path>/jdk/bin/java
bash: c:<some path>/jdk/bin/java: No such file or directory

[03/20/22 14:38:59] [SSH] Checking java version of java
[03/20/22 14:38:59] [SSH] java -version returned 1.8.0_191.
[03/20/22 14:38:59] [SSH] Starting sftp client.
[03/20/22 14:39:00] [SSH] Copying latest remoting.jar...
java.io.IOException: Could not copy remoting.jar into 'c:\<some path>' on agent
    at hudson.plugins.sshslaves.SSHLauncher.copyAgentJar(SSHLauncher.java:702)
    at hudson.plugins.sshslaves.SSHLauncher.access0(SSHLauncher.java:113)
    at hudson.plugins.sshslaves.SSHLauncher.call(SSHLauncher.java:445)
    at hudson.plugins.sshslaves.SSHLauncher.call(SSHLauncher.java:412)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.IllegalArgumentException: invalid len argument
    at com.trilead.ssh2.SFTPv3Client.read(SFTPv3Client.java:1232)
    at com.trilead.ssh2.jenkins.SFTPClient$SFTPInputStream.read(SFTPClient.java:172)
    at com.google.common.io.ByteStreams.toByteArrayInternal(ByteStreams.java:191)
    at com.google.common.io.ByteStreams.toByteArray(ByteStreams.java:238)
    at hudson.plugins.sshslaves.SSHLauncher.readInputStreamIntoByteArrayAndClose(SSHLauncher.java:760)
    at hudson.plugins.sshslaves.SSHLauncher.copyAgentJar(SSHLauncher.java:671)
    ... 7 more
[03/20/22 14:39:00] Launch failed - cleaning up connection
[03/20/22 14:39:00] [SSH] Connection closed.
REST API
Jenkins 2.339

我有 3 个不同的节点(Windows、Ubuntu 和 mac)。我在这三个方面都遇到了同样的错误:

Caused by: java.lang.IllegalArgumentException: invalid len argument

感谢解决此问题的任何信息。 谢谢

关于您的问题有一个未解决的问题:https://issues.jenkins.io/browse/JENKINS-67258

根据本问题的一位参与者的说法,解决方案是:

[...] upgrading SSH Build Agents / SSH Slaves Plugin to version 1.32.0 and beyond [...]