Sonar execution via jenkins, sonar processing continue even after ANALYSIS SUCCESSFUL message - jenkins

I am facing an issue while running sonar through Jenkins, after configuration when I making build by build now trigger my build runs and creating EAR successfully then sonar deployment starts which also run successfully and showing ANALYSIS SUCCESSFUL in the end of Jenkins build processing but even after successful analysis of sonar build continue to process and it never ends even after a long time wait. Very last line of build processing is
"12:55:14.159 INFO - <- Delete aborted builds"
pls see attached screenshot to refer.
can anybody help me out over this issue?
what is the reason behind this continuous processing of sonar analysis?
it never complete. what should I do at my end to complete build process so that my build become successful in the end?

Try restarting Jenkins. It solved the issue for me.

The ANALYSIS SUCCESSFUL message just means that all sensors and decorators have completed. There are still some post-analysis tasks which must take place (specifically, any class extending PostJob). I've found that the final log output message is not always an accurate indicator of what's wrong. There are some plugins which churn forever but don't produce any output. But I wouldn't be surprised if your analyses really are stuck at "Delete aborted builds." Sometimes the Database Cleaner can take a long time, but if it's more than 10 minutes, it's stuck. It's very likely a problem with database interaction.
The way to continue is to enable all possible SQL tracing. Enable all the options -- sonar.showProfiling=true, sonar.showSql=true, sonar.showSqlResults=true, and sonar.verbose=true. See the Sonar Analysis Parameters for more information.
If that doesn't tell you what's wrong, you might have some luck getting more information out of sonar.log by editing wrapper.conf to show DEBUG log output.

Related

TFS 2017 gets stuck when the Visual Studio Test task tries to publish results

We have a TFS 2017 build agent executing a Visual Studio Test task to execute our unit tests. This has worked fine for several years, but all of a sudden - without any code changes - the task gets stuck.
All the tests have finished running, we see summary information, and it will sit at what appears to be the place where it would normally publish the results... but then nothing happens. We've waited 12+ hours for it to finish. This step normally takes about 90 minutes.
I've confirmed that the TRX file is being created. It's about 4MB in size. We're running a bit over 3000 unit tests.
I've also tried disabling code coverage and attachments upload inside the test task, but it doesn't appear to make a difference.
Below is a screen cap of the log output when the step is stuck.
Lastly, we have lots of other projects on this server whose tests run / publish fine, as well as TFS Releases for this same build that also run tests (integration/system tests) which work without issue.
UPDATE: We ran this build on a different build server, and it published tests correctly. So this means there is something wrong with this specific build server...
UPDATE 2: So I'm not longer sure what is happening here. The original build server we were having issues on is now working fine with no changes whatsoever. Just started working again. The other build server was working, and then stopped. Same issue. I broke up the 3000+ tests into two steps, roughly 50/50, and that worked a couple of times, but now does not. So this does not appear to be server specific, nor does it appear to be related to the quantity of tests. Debug logging offers nothing useful, as everything seems fine right up until it just stops doing anything after generating the TRX file.
UPDATE 3: Well, it's happening again. I'm not sure how to proceed. I even tried Fiddler on the build box to see if I could catch funky looking traffic, but most of the traffic I'd expect to see I don't. It's like a good chunk of the work isn't being captured (such as source downloads, reporting progress, or test result publishing) by Fiddler. Is it not over HTTP/HTTPS?
This was difficult to figure out due to the quantity of tests we're running, but I was able to narrow it down to a test that launched ping.exe:
[ExpectedException(typeof(TimeoutException))]
[TestMethod]
public void ProcessWillTimeout()
{
const string command = "cmd";
const string args = "/C ping 127.0.0.1 /t";
var externalProcessService = new ExternalProcessService();
externalProcessService.Execute(command, args, TimeSpan.FromMilliseconds(500));
}
For whatever reason, this test was leaving both conhost.exe and ping.exe "orphaned". The fact these processes were not terminating was, for an unknown reason, preventing the tests from publishing their results back to TFS. There is probably something somewhere that waits for the a process to finish and that was never happening.
Indeed, we would see a bunch of conhost.exe and ping.exe processes in both Task Manager and Process Explorer:
You'll notice the tool tip there... "[Error opening process]". I couldn't even use Process Explorer to kill these processes - although Task Manager could. Sure enough, when I killed them, the TFS build task would immediately resume and finish publishing results.
So there is clearly some kind of bug in that ExternalProcessService code we were testing (despite carefully having a finally block that terminated the process), but we are at least able to have our build tests run again without issue.
Suggest you abandon this build and trigger it again. To narrow down if this issue could be reproduced stably.
According to your description, all other builds work properly. And it worked fine for several years. All tests pass, the test report is written, but just the task hangs. Please double check if some other processes might possibly not be properly closing down.
Besides use another build agent to test again. Also try to create a newly build definition with the same settings, trigger that definition, this may do the trick.
Moreover, you could enable verbose logging for trouble shooting. To do this simply adding a build variable named system.debug and setting its value to 'true', this will contain a more detail log info.

Jenkins build is not timing out even when Build Timeout is explicitly mentioned

I've mentioned build timeout in jenkins job as per attached screen shot
But even with this setting build is not timing out even after 2 -4 hrs.
I use jenkins job to do GET requests to REST end points.
There is a bug with one of the end point which results in response not being sent in required time.
Please clarify how to get time out fixed with jenkins job ?
Thanks & Regards,
Vikram
The "Abort the build if it's stuck" option is offered by the "Build Timeout Plugin".
According to the documentation of the "Build Timeout Plugin" (https://wiki.jenkins-ci.org) :
[...] depending on how a build hangs, the abort operation might not take effect.
The documentation lists a couple of possible reasons. Make sure you are not affected by one of those reasons. (I cannot tell without seeing a lot more of your configuration and precisely how you place those GET requests.)

Sonarqube: reordering published build results

I am publishing build results to Sonarqube, with jenkins.
Each commit on git is triggering a jenkins build.
My problem is that build duration is not deterministic so build #2 can finish before build #1.
Consequently, results are published to Sonar in wrong order and differential view shows wrong results.
For example, if i corrected a unit test in build #2, results of buildĀ #1 will tell me that test is failing again.
Build result version is setted and it should be used to order builds instead of publication date.
Is there any way to do it?
Thank you.
The SonarQube platform is going to process the analysis reports in the order it receives them. It has no way of knowing anything about your Jenkins build number.
Your best bet is to enable the Throttle Concurrent Builds option to make sure that each new job waits its turn. That's the only way to ensure the order you expect.

Occasionally Jenkins Configuration Matrix jobs report failure on success

General Symptoms
We use Jenkins to build & test on multiple platforms. We use the Configuration Matrix plugin to help with this. Occasionally (increasingly often) Jenkins will mark the Configuration Matrix master job or subjobs as failed when the jobs seem to have succeeded (the console output reports success). We have no idea why this is happening. Any suggestions?
Some clues:
The exit code of the Jenkins job's script is not relevant. We've had test sub-jobs that simply exit 0 and they can still exhibit this bad behavior.
The failures are bunchy. They seem to come in groups.
The failures tend to effect our Windows platforms more heavily but the issue occurs on our Mac nodes as well.
The failures clump on a single node for a time but they are not exclusive to any 1 node.
We've noticed that the failures happen most often with load, particularly failed sub-jobs are started later than their successful sibling sub-jobs (often after other siblings have already completed).
We suspect that the sub-jobs are somehow considered completed by the master before they actually complete. Since they're not done the master sees them as failed. Later the sub-job really does complete (thus the console output says Success). We suspect this because we've added comments to "failed" jobs which look incomplete only to return later and see additional console logs.
It turns out that there is a bug in either the Jenkins "Set Build Name" plugin or the "Configuration Matrix" plugin. When you use them both you're subject to a few bugs. First is the symptoms I described above. Second is that the names set on builds can be wrong (race conditions mean that the wrong name can be applied).
There is a ticket open against Jenkins here. Unfortunately there isn't currently a posted work-around. We may simply stop using one of the plugins.

Stop build execution in Jenkins

I am using Jenkins to run a Maven project having Junit tests in Sauce Connect. I created a job and to stop/abort the build in between I clicked the Cross button (X) shown near progress bar for build execution. But the build execution does not get stopped.
When I moved to console output for the build, it was showing message as "Closing Sauce Connect" and it takesd too much time and Jenkins does not stop build process.
Could anyone please advice as to how can we manually stop/abort build execution.
Additionally, is there any site where we can find proper documentation regarding Jenkins for Beginners as i have few more problems regarding its start and stop process.
I guess it is too late to answer but my help some people.
Install the monitoring plugin. (http://wiki.jenkins-ci.org/display/JENKINS/Monitoring)
Go to jenkinsUrl/monitoring/nodes
Go to the Threads section at the bottom
Click on the details buttom on the left of the slave the job is build on
Sort by User time (ms)
Then look at the name of the thread, you will have the name and number of the build
Kill it
Hope it can help
Jenkins will terminate the build nicely, i.e. wait for the running processes to end after sending the termination signal. If the processes take a long time to terminate, it will wait. The easiest way is to change your build/code such that it terminates immediately, or has a timeout for closing connections etc.
Regarding more documentation, have a look at the Jenkins wiki or get the Jenkins book.

Resources