Jenkins Multibranch jobs load slow after sonar server switch

Template for a good bug report, formatted with Markdown:

  • versions used: Jenkins 2.263.4, SonarQube Scanner for Jenkins 2.13
  • error observed:
2021-03-02 07:54:26.529+0000 [id=19974] WARNING h.p.s.client.SQProjectResolver#resolve: Error fetching project information
java.net.SocketTimeoutException: connect timed out
        at java.net.PlainSocketImpl.socketConnect(Native Method)
        at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
        at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
        at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
        at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
        at java.net.Socket.connect(Socket.java:607)
        at okhttp3.internal.platform.Platform.connectSocket(Platform.java:124)
        at okhttp3.internal.connection.RealConnection.connectSocket(RealConnection.java:221)
        at okhttp3.internal.connection.RealConnection.connect(RealConnection.java:147)
        at okhttp3.internal.connection.StreamAllocation.findConnection(StreamAllocation.java:192)
        at okhttp3.internal.connection.StreamAllocation.findHealthyConnection(StreamAllocation.java:121)
        at okhttp3.internal.connection.StreamAllocation.newStream(StreamAllocation.java:100)
        at okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.java:42)
        at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
        at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67)
        at okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.java:93)
        at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
        at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67)
        at okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.java:93)
        at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
        at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.java:120)
        at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
        at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67)
        at okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.java:185)
        at okhttp3.RealCall.execute(RealCall.java:69)
        at org.sonarqube.ws.client.HttpConnector.doCall(HttpConnector.java:188)
Caused: java.lang.IllegalStateException: Fail to request https://oldSonarURL/sonar/api/server/version
        at org.sonarqube.ws.client.HttpConnector.doCall(HttpConnector.java:190)
        at org.sonarqube.ws.client.HttpConnector.get(HttpConnector.java:124)
  • steps to reproduce
    Simply try to access one repository in a Jenkins Multibranch Project
  • potential workaround

Hello,

We recently switched our SONAR server and it’s URL. Therefore the central Jenkins configuration has been adapted to the new SONAR server settings and everything works for new jobs. But loading old jobs may take really long, because they still try to access the old server URL, which doesn’t response anymore, because the old server has been stopped. The load time seems to depend on how many branches and jobs you have and can take over 5 minutes. Is there any change to avoid these long loading times?

Thank you and regards
Kay

In the past build of your sonar job, you have reference to your old sonar server. Youi have to replace those reference with the new one

Go to the jobs directory of your jenkins server and search for the reference to your old sonar server.with find in all build.xml file

find <jenkins_jobs_dir> -type f -name “build.xml” -exec grep -HE “<oldserver_pattern>” {} ;

Then modify with sed those file to replace your old server reference with the new one
Finnaly restart jenkins service.

Best regards.

1 Like