gpt4 book ai didi

由于读取超时,Jenkins 插件管理器无法安装/更新插件

转载 作者:行者123 更新时间:2023-12-03 18:44:31 27 4
gpt4 key购买 nike

我们的团队最近在 Jenkins 插件管理器安装/更新插件时遇到了一些问题。在我们修复了防火墙和代理规则的一些问题(我们位于公司防火墙和代理之后)之后,我们仍然无法下载一些插件文件。

一些插件文件已成功下载并安装,另一些则因以下错误而失败:

Failed to install git-client
java.net.SocketTimeoutException: Read timed out
at java.net.SocketInputStream.socketRead0(Native Method)
at java.net.SocketInputStream.socketRead(SocketInputStream.java:116)
at java.net.SocketInputStream.read(SocketInputStream.java:171)
at java.net.SocketInputStream.read(SocketInputStream.java:141)
at java.io.BufferedInputStream.fill(BufferedInputStream.java:246)
at java.io.BufferedInputStream.read1(BufferedInputStream.java:286)
at java.io.BufferedInputStream.read(BufferedInputStream.java:345)
at sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:735)
at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:678)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1593)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1498)
at sun.net.www.protocol.http.HttpURLConnection.getHeaderField(HttpURLConnection.java:3057)
at java.net.URLConnection.getHeaderFieldLong(URLConnection.java:629)
at java.net.URLConnection.getContentLengthLong(URLConnection.java:501)
at java.net.URLConnection.getContentLength(URLConnection.java:485)
at hudson.model.UpdateCenter$UpdateCenterConfiguration.download(UpdateCenter.java:1161)
Caused: java.net.SocketTimeoutException: Read timed out
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at sun.net.www.protocol.http.HttpURLConnection$10.run(HttpURLConnection.java:1950)
at sun.net.www.protocol.http.HttpURLConnection$10.run(HttpURLConnection.java:1945)
at java.security.AccessController.doPrivileged(Native Method)
at sun.net.www.protocol.http.HttpURLConnection.getChainedException(HttpURLConnection.java:1944)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1514)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1498)
at hudson.model.UpdateCenter$UpdateCenterConfiguration.download(UpdateCenter.java:1177)
Caused: java.io.IOException: Failed to load http://updates.jenkins-ci.org/download/plugins/git-client/3.0.0/git-client.hpi to /var/lib/jenkins/plugins/git-client.jpi.tmp
at hudson.model.UpdateCenter$UpdateCenterConfiguration.download(UpdateCenter.java:1184)
Caused: java.io.IOException: Failed to download from http://updates.jenkins-ci.org/download/plugins/git-client/3.0.0/git-client.hpi (redirected to: http://ftp-nyc.osuosl.org/pub/jenkins/plugins/git-client/3.0.0/git-client.hpi)
at hudson.model.UpdateCenter$UpdateCenterConfiguration.download(UpdateCenter.java:1218)
at hudson.model.UpdateCenter$DownloadJob._run(UpdateCenter.java:1766)
at hudson.model.UpdateCenter$InstallationJob._run(UpdateCenter.java:2037)
at hudson.model.UpdateCenter$DownloadJob.run(UpdateCenter.java:1740)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at hudson.remoting.AtmostOneThreadExecutor$Worker.run(AtmostOneThreadExecutor.java:112)
at java.lang.Thread.run(Thread.java:748)

为了诊断潜在的网络问题,我尝试通过 curl 直接从托管 Jenkins 服务器的机器上下载 git-client.hpi,这是成功的:
[root@servername ~]# curl -vk -x http://proxyserver:7689 http://ftp-nyc.osuosl.org/pub/jenkins/plugins/git-client/3.0.0/git-client.hpi -o /tmp/git-client.hpi
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0* About to connect() to proxy proxyserver port 6789 (#0)
* Trying 10.100.50.100...
* Connected to proxyserver (10.100.50.100) port 6789(#0)
> GET http://ftp-nyc.osuosl.org/pub/jenkins/plugins/git-client/3.0.0/git-client.hpi HTTP/1.1
> User-Agent: curl/7.29.0
> Host: ftp-nyc.osuosl.org
> Accept: */*
> Proxy-Connection: Keep-Alive
>
0 0 0 0 0 0 0 0 --:--:-- 0:01:01 --:--:-- 0< HTTP/1.1 200 OK
< Date: Mon, 11 Nov 2019 08:18:55 GMT
< Server: Apache
< Last-Modified: Sat, 02 Nov 2019 12:03:46 GMT
< ETag: "7dd268-5965bdfed67ce"
< Accept-Ranges: bytes
< Content-Type: application/vnd.hp-hpid
< Age: 6915
< Content-Length: 8245864
< Via: 1.1 proxyserver
<
0 8052k 0 0 0 0 0 0 --:--:-- 0:01:01 --:--:-- 0{ [data not shown]
100 8052k 100 8052k 0 0 130k 0 0:01:01 0:01:01 --:--:-- 2132k
* Connection #0 to host proxyserver left intact

通过 curl 下载是成功的,虽然我注意到连接成功后,下载过程在 0% 停滞了大约一分钟。然后它突然开始,并在几秒钟内完成。

编辑 : 这不是基础设施问题 ,与 INFRA-2393 无关,也没有任何其他与更新站点问题相关的问题:
  • 这个读取超时是在 2019 年 10 月首次遇到的,可以在 2019 年 12 月中旬重现。基础设施问题往往比这更快解决。
  • 在 INFRA-2393 解决很久之后,我还设法在欧洲中部时间 2020-01-02 10:30 左右使用/plugins/subversion/2.13.0/subversion.hpi 使用 60 秒读取超时设置重现了该问题。我还通过提高读取超时设置来解决这个问题,如下所述。
  • 读取超时仅发生在 Jenkins 内。在浏览器或 curl 命令中使用相同的下载链接下载受影响的文件。这是因为 Jenkins 的默认读取超时为 60 秒,而浏览器/curl 没有。
  • 在早先对此进行诊断的同时,我们重新安排了我们的网络策略并使 Jenkins 直接访问更新站点(不使用代理)。在这种情况下,所有问题下载都有效。这表明下载停止与更新站点错误无关,而是与我们自己的代理有关。


  • 另外,不要让我提交一份关于 Jenkins Jira 的报告。我发布这个问题和我的回答的真正原因是我对尝试使用 Jenkins Jira 寻找解决方案感到沮丧。我在那里找到的与我的问题相关的 Material 大致分为两类:
  • 基础设施问题可以追溯到几年前,显然是在几年前解决的。换句话说:噪音。
  • 真正的 Jenkins 问题发布了类似的症状,发布了数十/数百条评论,主要归结为 Jenkins 工作人员表示问题出在用户方面,人们应该修复自己的公司防火墙/代理/等。没有一个字相关超时值。换句话说:更多的噪音。

  • 再次强调:这不是与 Jenkins 更新站点相关的问题,也不是 Jenkins 软件错误。如果它与任何内容有关,那么它与缺乏文档有关。正是 SO 旨在涵盖恕我直言的事情。

    最佳答案

    从上面要注意的重要一点是这不是连接超时而是读取超时 .与下载镜像的连接已建立,但客户端在大约一分钟内未收到任何字节。 (我们假设发生这种情况是因为我们的代理在将字节转发给请求下载的客户端之前分析了 git-client.hpi 的内容。)
    curl 下载成功,因为命令中没有设置读取超时。 Jenkins 显然使用 60 秒的默认套接字读取超时,因此在 60 秒内没有流量后,它认为连接已死并因 SocketException 而失败。
    我没有找到任何官方文档,而是查看 Jenkins source code证实了这个理论:UpdateCenter.PLUGIN_DOWNLOAD_READ_TIMEOUT 常量是从属性值初始化的,如果没有,则默认为 60。
    我没有找到的另一件事是 Jenkins 属性的综合文档(键名、可能的值、描述等)。
    要设置的确切属性键是: hudson.model.UpdateCenter.pluginDownloadReadTimeoutSeconds
    AFAIK Jenkins 没有任何 *.properties 文件,但在启动时接受属性设置作为 JVM 参数。
    我通过找到 解决了这个问题 Jenkins 选项文件(如果您使用 RHEL,并从包存储库安装 Jenkins,则确切路径为: /etc/sysconfig/jenkins ),并附加 -Dhudson.model.UpdateCenter.pluginDownloadReadTimeoutSeconds=120 的值JENKINS_JAVA_OPTIONS 环境。
    更新:我发现 the official Jenkins documentation about Jenkins system properties ,其中还介绍了 hudson.model.UpdateCenter.pluginDownloadReadTimeoutSeconds 属性。

    关于由于读取超时,Jenkins 插件管理器无法安装/更新插件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59422308/

    27 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com