Failed to upload the report to SonarQube (Caused by: Network is unreachable (connect failed))

scanner
sonarqube

(Paramesh Perugu) #1

Must-share information (formatted with Markdown):

  • which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension)

SonarQube: sonarqube-6.7.6
Sonar-Scanner: sonar-scanner-3.2.0.1227-linux and using all default installed plugins.

  • what are you trying to achieve : I have totally 4 projects .I scanned and uploaded 3 projects sucessfully.
    When I’m trying scan and upload 4th project I’m getting below error.

INFO: CPD calculation finished INFO: Analysis report generated in 26123ms, dir size=677 MB INFO: Analysis reports compressed in 65558ms, zip size=240 MB INFO: ------------------------------------------------------------------------ INFO: EXECUTION FAILURE INFO: ------------------------------------------------------------------------ INFO: Total time: 49:03.139s INFO: Final Memory: 182M/30076M INFO: ------------------------------------------------------------------------ ERROR: Error during SonarQube Scanner execution ERROR: Fail to request http://sonar.com/api/ce/submit?projectKey=MS ERROR: Caused by: Failed to connect to sonar.com/2606:4700:30:0:0:0:681b:9294:80 ERROR: Caused by: Network is unreachable (connect failed)

  • what have you tried so far to achieve this

I tried with different type of instance (ex: c4.xlarge ,c4.4xlarge, c5.18xlarge)

For c4.xlarge it took 4 hours to scan the report and got failed with above error
C4.4xlarger it took 2 hours to scan and got failed
C5.18xlarge it took 49 minutes and got failed

I have no clue why I’m getting above error and how to fix it. Please help me


(Paramesh Perugu) #2

Hello,
@Fabrice_Bellingard Could you please check on my Issue when you are free !


(G Ann Campbell) #3

Hi,

Please refrain from invoking specific SonarSourcers who are not already involved in your thread. I understand your anxiety that your thread was overlooked. However, many SonarSourcers have been off in these last few weeks celebrating the holidays. We’re human. We take breaks. :slight_smile:

Your error says that an attempt to contact “http://sonar.com” failed. So somewhere in your job configuration this URL is being used. You need to find and correct it.

 
Ann


(Paramesh Perugu) #4

Hello @ganncamp

Good Day!

Thanks for getting back to me on issue. Hoping you had a great time in Holidays :smiley:

In “sonar-scanner.properties” file we configured

#----- Default SonarQube server
sonar.host.url=http://sonar.com/

and my point is out of 4 , three projects successfully executed.

In this project report getting generated and atlast when its trying to upload a repot through API

INFO: Analysis report generated in 26123ms, dir size=677 MB
INFO: Analysis reports compressed in 65558ms, zip size=240 MB
INFO: ------------------------------------------------------------------------
INFO: EXECUTION FAILURE
INFO: ------------------------------------------------------------------------
INFO: Total time: 49:03.139s
INFO: Final Memory: 182M/30076M
INFO: ------------------------------------------------------------------------
ERROR: Error during SonarQube Scanner execution
ERROR: Fail to request http://sonar.com/api/ce/submit?projectKey=MS
ERROR: Caused by: Failed to connect to sonar.com/2606:4700:30:0:0:0:681b:9294:80
ERROR: Caused by: Network is unreachable (connect failed)


(Paramesh Perugu) #5

and One more thing , i have my source code in the server were I installed SoanrQube and SonarScanner and MySql.

Im using below command from my source code directory to analyse code.

sonar-scanner -Dsonar.projectKey=MS -Dsonar.sources=. -Dsonar.host.url=http://sonar.com/ -Dsonar.login=************************************ -D sonar.java.binaries=.


(G Ann Campbell) #6

Hi,

Okay, so I’ve guess you’ve got your local DNS configured to point ‘sonar.com’ at your SonarQube server. That makes this a network issue. You need to figure out why your Jenkins server can’t connect to “http://sonar.com/2606:4700:30:0:0:0:681b:9294:80”.

 
Ann


(Paramesh Perugu) #7

Hello @ganncamp

Good Day!

I think their is nothing to do with jenkins because jenkins not integrated with sonarQube/SonarScanner.
Directly we are analysing code in the Sonar server.

And this source code size is 1.2GB

My guess is sonar-scanner establishing connection with SonarQube through API (http://sonar.com) initially, while executing some were scanner getting lost connection with SoanrQube. After analysing code its getting failed to upload the report to SonarQube through API with an error “Network is unreachable (connect failed)”.
Correct me if Im wrong.

If its the case , please help on it to fix. Thanks in advance.

Paramesh


(G Ann Campbell) #8

Hi Paramesh,

Right now all I’ve got to go on is the error message in the log you provided: Failed to connect ... Caused by: Network is unreachable, and that points to… a problem in your network. Perhaps you can provide a stacktrace, with more detail?

BTW, to clarify this point:

The scanner requests data from SonarQube when analysis starts, then runs independently (without connection to the server), and submits an analysis report back to the server once analysis is complete. Your job is failing at this last step, so this cannot be a case of an existing connection being broken.

 
Ann


(Paramesh Perugu) #9

@ganncamp

I splitted up my Project (MS) into 4 (each project size around 270 MB +) , Then I started analysing each project with name MS1,MS2,MS3 and MS4. This time i din’t get any error and report uploaded to the SonarQube server successfully.

Im not sure the problem which i reported in correct way or! :frowning:

and is it network getting failed while uploading large size of analysis report? If it is how can we avoid it in future projects ?


(G Ann Campbell) #10

Hi,

It does seem like some sort of timeout during analysis report uploading, but in that case I would expect a slightly different error in your logs. I just keep coming back to what you’ve reported: Network is unreachable (connect failed). Still, I won’t hurt to take a look at your server logs to see if there are any errors there.

 
Ann


(Paramesh Perugu) #11

I’ll rerun the project and will get back to you with server log