SonarQube后台分析偶发失败:smells插件不存在问题求助
Let’s break down this tricky intermittent issue you’re facing—alternating success/failure when running SonarQube analysis via Jenkins, even though the smells plugin is clearly loaded in SonarQube. Here are targeted troubleshooting steps to get to the root of it:
1. Clear SonarQube’s Temporary Cache & Verify Plugin Integrity
Intermittent plugin loading issues often tie back to corrupted or stale cache data. Let’s reset the temp directory and confirm the plugin file is intact:
- Stop your SonarQube service, wipe the temp folder, then restart:
sudo service sonar stop rm -rf /opt/sonar/temp/* sudo service sonar start - Check the
smellsplugin jar in/opt/sonar/plugins—verify its MD5 hash matches the official download to rule out file corruption.
2. Validate Jenkins-SonarQube Request Consistency
Jenkins showing a "success" even when analysis fails means we need to dig into the actual requests being sent:
- Double-check your Jenkins job’s SonarQube configuration: ensure
sonar.host.url,sonar.login, and other parameters don’t change between builds (no dynamic variables that might break consistency). - Enable verbose logging for the SonarQube Maven goal by updating it to
sonar:sonar -X. Compare the logs from successful and failed runs—look for differences in how Jenkins fetches plugin info from SonarQube, like timeouts or partial responses.
3. Inspect SonarQube Compute Engine (CE) Stability
Your startup log confirms the CE node is up, but load spikes or resource constraints could cause intermittent failures:
- Check the CE logs at
/opt/sonar/logs/ce.logfor errors during failed runs—look for signs of memory exhaustion, thread pool limits, or unhandled exceptions. - Try increasing the CE node’s JVM memory allocation in
/opt/sonar/conf/sonar.properties: adjustsonar.ce.javaOptsfrom-Xmx512mto-Xmx1024m(or higher if your EC2 instance has resources to spare) and see if the instability eases.
4. Rule Out Plugin Compatibility & Conflicts
Even if the plugin shows as loaded, version mismatches or conflicts with other plugins could cause intermittent issues:
- Confirm the
smellsplugin v4.0.0 is fully compatible with SonarQube 6.7.1—check the plugin’s documentation for known issues with this SonarQube version. - Do a process of elimination by temporarily disabling non-core plugins (like Sonargraph, aemrules, or checkstyle one by one) and running repeated builds. If the issue stops after disabling a specific plugin, you’ve found a conflict.
5. Check for Network/DNS Flakiness (Even on Local EC2)
Don’t overlook subtle network issues even in a local EC2 setup:
- Run repeated curl requests to SonarQube’s plugin API from your Jenkins server to confirm consistent responses:
Verify thecurl http://localhost:9000/api/plugins/installedsmellsplugin appears in every response—if it’s missing occasionally, you’ve got a network or API endpoint stability problem to debug.
内容的提问来源于stack exchange,提问作者ddiman

