Sonarqube Scanner Plugin for Jenkins with Threads Bug

Hello, I don’t know if I’ve tagged this correctly, if not I apologize.

Well, I have an issue that if a project no longer is present on Sonarqube, Jenkins will still query the service for that project/branch. When this happens, the Sonarqube scanner plugin (for Jenkins) creates a thread that sticks there for so long that our VM runs out of memory and starts to kill other threads like the thread with port 50000 (Jenkins agents port).

I’ve registered a ticket here but I still had no luck. This is a serious problem because it provoces downtime of the service :slightly_frowning_face:

Best Regards
Luís

1 Like

Hi,

Welcome to the community!

Could you give some context on this? Under what conditions does Jenkins query for the project?

 
Ann

Hi

Thank you so much for taking some time to help me :pray:

Regarding this issue, on Jenkins for each branch there is an icon (added by the SonarQube plugin) that shows the status of the last scan:
image

When this project no longer exists on Sonarqube (manual deletion or retention policy for example) these icons don’t appear and it keeps querying the server for the result (that’s why Jenkins creates unlimited threads) with logs saying:

May 24, 2022 8:17:37 AM FINE hudson.plugins.sonar
Error fetching project information: Error 404 on https://sonarqube.xxxxx.com/api/qualitygates/project_status?analysisId=AYBLexFPSx2XEKxeOpyH : {"errors":[{"msg":"Analysis with id \u0027AYBLexFPSx2XEKxeOpyH\u0027 is not found"}]}
May 24, 2022 8:17:38 AM FINE hudson.plugins.sonar
Error fetching project information: Error 404 on https://sonarqube.xxxxx.com/api/qualitygates/project_status?analysisId=AYBvr0tKSx2XEKxec7Iq : {"errors":[{"msg":"Analysis with id \u0027AYBvr0tKSx2XEKxec7Iq\u0027 is not found"}]}
May 24, 2022 8:17:38 AM FINE hudson.plugins.sonar
Error fetching project information: Error 404 on https://sonarqube.xxxxx.com/api/qualitygates/project_status?analysisId=AYC5ZSQdpLKeDN0rxLl2 : {"errors":[{"msg":"Analysis with id \u0027AYC5ZSQdpLKeDN0rxLl2\u0027 is not found"}]}
May 24, 2022 8:17:38 AM FINE hudson.plugins.sonar
Error fetching project information: Error 404 on https://sonarqube.xxxxx.com/api/qualitygates/project_status?analysisId=AYBv3-3wSx2XEKxehY67 : {"errors":[{"msg":"Analysis with id \u0027AYBv3-3wSx2XEKxehY67\u0027 is not found"}]}
May 24, 2022 8:17:38 AM FINE hudson.plugins.sonar
Error fetching project information: Error 404 on https://sonarqube.xxxxx.com/api/qualitygates/project_status?analysisId=AYBLnVOQSx2XEKxeTIui : {"errors":[{"msg":"Analysis with id \u0027AYBLnVOQSx2XEKxeTIui\u0027 is not found"}]}
May 24, 2022 8:17:39 AM FINE hudson.plugins.sonar
Error fetching project information: Error 404 on https://sonarqube.xxxxx.com/api/qualitygates/project_status?analysisId=AYA9A1teSx2XEKxePrIg : {"errors":[{"msg":"Analysis with id \u0027AYA9A1teSx2XEKxePrIg\u0027 is not found"}]}
May 24, 2022 8:17:55 AM FINE hudson.plugins.sonar
Error fetching project information: Error 404 on https://sonarqube.xxxxx.com/api/qualitygates/project_status?analysisId=AYDS3tycpLKeDN0rcCmQ : {"errors":[{"msg":"Analysis with id \u0027AYDS3tycpLKeDN0rcCmQ\u0027 is not found"}]}
May 24, 2022 8:18:10 AM FINE hudson.plugins.sonar
Error fetching project information: Error 404 on https://sonarqube.xxxxx.com/api/qualitygates/project_status?analysisId=AYA9A1teSx2XEKxePrIg : {"errors":[{"msg":"Analysis with id \u0027AYA9A1teSx2XEKxePrIg\u0027 is not found"}]}

Thank you
best regards

Can we have any help in here? this is still an issue.

Best Regards

Hey @lmmc

We intentionally put these logs at the FINE level of logging because these logs are typically only meant to be enabled for debugging purposes… and then turned off. Do you have these logs enabled all the time, and if so why?

Hello Colin, thank you for your response.

We activated these logs to see what was the behavior of the plugin. It was due to these logs that we found out that we were doing lots of requests to Sonarqube for projects that no longer existed (retention policy on Sonarqube server) and he keeps asking for that project as long as you have a tab or enter in that project on Jenkins. This will create threads that take too long to finish which after some time the VM reaches a max memory and kills the threads including important ones like the thread that opens port 50000 (Jenkins agents port).