Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-70163

GitHub Branch Source clients are caching proxy configuration DNS / IPs

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • None
    • github-branch-source:1696.v3a_7603564d04
    • github-branch-source:1728.v859147241f49

      When using GitHub Branch Source with a Jenkins Proxy configuration, if the IP of the proxy server changes GitHub Branch Source still uses the previous IP.

      This has been reproduced in Kubernetes with a squid proxy deployment and service deployed in k8s.

      • Set the Jenkins proxy to the Kubernetes Service DNS of the proxy and port
      • Then I do the following:
      • build a multibranch job and wait for it to complete (retrieve the Jenkinsfile and does a checkout)
      • delete the squid proxy pods and service
      • recreate the squid service
      • build the same multibranch job

      We see a SocketTimeoutException.

      java.net.SocketTimeoutException: connect timed out
      	at java.base/java.net.PlainSocketImpl.socketConnect(Native Method)
      	at java.base/java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:412)
      	at java.base/java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:255)
      	at java.base/java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:237)
      	at java.base/java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
      	at java.base/java.net.Socket.connect(Socket.java:609)
      	at okhttp3.internal.platform.Platform.connectSocket(Platform.kt:128)
      	at okhttp3.internal.connection.RealConnection.connectSocket(RealConnection.kt:295)
      	at okhttp3.internal.connection.RealConnection.connectTunnel(RealConnection.kt:261)
      	at okhttp3.internal.connection.RealConnection.connect(RealConnection.kt:201)
      	at okhttp3.internal.connection.ExchangeFinder.findConnection(ExchangeFinder.kt:226)
      	at okhttp3.internal.connection.ExchangeFinder.findHealthyConnection(ExchangeFinder.kt:106)
      	at okhttp3.internal.connection.ExchangeFinder.find(ExchangeFinder.kt:74)
      	at okhttp3.internal.connection.RealCall.initExchange$okhttp(RealCall.kt:255)
      	at okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.kt:32)
      	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
      	at okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.kt:95)
      	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
      	at okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.kt:83)
      	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
      	at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.kt:76)
      	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
      	at org.kohsuke.github.extras.okhttp3.ObsoleteUrlFactory$UnexpectedException.lambda$static$0(ObsoleteUrlFactory.java:1365)
      	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
      	at okhttp3.internal.connection.RealCall.getResponseWithInterceptorChain$okhttp(RealCall.kt:201)
      	at okhttp3.internal.connection.RealCall.execute(RealCall.kt:154)
      	at org.kohsuke.github.extras.okhttp3.ObsoleteUrlFactory$OkHttpURLConnection.getResponse(ObsoleteUrlFactory.java:671)
      	at org.kohsuke.github.extras.okhttp3.ObsoleteUrlFactory$OkHttpURLConnection.getResponseCode(ObsoleteUrlFactory.java:702)
      	at org.kohsuke.github.extras.okhttp3.ObsoleteUrlFactory$DelegatingHttpsURLConnection.getResponseCode(ObsoleteUrlFactory.java:1064)
      	at org.kohsuke.github.internal.GitHubConnectorHttpConnectorAdapter.send(GitHubConnectorHttpConnectorAdapter.java:87)
      	at org.kohsuke.github.GitHubClient.sendRequest(GitHubClient.java:384)
      Caused: org.kohsuke.github.HttpException: Server returned HTTP response code: -1, message: 'null' for URL: https://api.github.com/
      	at org.kohsuke.github.GitHubClient.interpretApiError(GitHubClient.java:548)
      	at org.kohsuke.github.GitHubClient.sendRequest(GitHubClient.java:399)
      	at org.kohsuke.github.GitHubClient.fetch(GitHubClient.java:121)
      	at org.kohsuke.github.GitHubClient.checkApiUrlValidity(GitHubClient.java:323)
      	at org.kohsuke.github.GitHub.checkApiUrlValidity(GitHub.java:1244)
      	at org.jenkinsci.plugins.github_branch_source.ApiRateLimitChecker.verifyConnection(ApiRateLimitChecker.java:199)
      	at org.jenkinsci.plugins.github_branch_source.Connector$GitHubConnection.verifyConnection(Connector.java:794)
      	at org.jenkinsci.plugins.github_branch_source.Connector.connect(Connector.java:447)
      	at org.jenkinsci.plugins.github_branch_source.GitHubSCMSource.retrieve(GitHubSCMSource.java:1679)
      	at jenkins.scm.api.SCMSource.fetch(SCMSource.java:582)
      	at org.jenkinsci.plugins.workflow.multibranch.SCMBinder.create(SCMBinder.java:101)
      	at org.jenkinsci.plugins.workflow.job.WorkflowRun.run(WorkflowRun.java:311)
      	at hudson.model.ResourceController.execute(ResourceController.java:107)
      	at hudson.model.Executor.run(Executor.java:449)
      

      Restarting the controller fixes this.

      Notes: this is reproducible whether the okhttp disk cache is disabled with org.jenkinsci.plugins.github_branch_source.GitHubSCMSource.cacheSize=0 or not.

            allan_burdajewicz Allan BURDAJEWICZ
            allan_burdajewicz Allan BURDAJEWICZ
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: