Fixing sonar-runner error - Can not add twice the same measure

Sometimes, when running sonar-runner to compile the results of a Jenkins build into measurable data for a SonarQube dashboard for a project, I get the following errors, and execution stops before the data is sent to the central sonar server:

ERROR: Error during Sonar runner execution
ERROR: Unable to execute Sonar
ERROR: Caused by: Can not add twice the same measure on org.sonar.api.resources.File...

I was looking into what causes this issue, and couldn't find much via Google. However, just running sonar-runner again, without changing anything or modifying anything, seems to let sonar succeed.

I'll update this post if I ever figure out what might be causing the 'twice the same measure' error, but for now, just run sonar-runner again if you ever bump into this error message :)

I'll be posting more about how to use Sonar + Jenkins + Phing to do some pretty awesome Drupal and PHP code analysis and deployments in future blog posts—stay tuned!

Drupal 6.x and PHP 5.3.x - Date Timezone warnings

This morning, I was presented with quite the conundrum: one of my servers suddently started having about 4x the normal MySQL traffic it would have in a morning, and I had no indication as to why this was happening; traffic to the sites on the server was steady (no spikes), and I couldn't find any problems with any of the sites.

munin mysql traffic spike

However, after inspecting the Apache (httpd) error logs for the Drupal 6 sites, I found a ton of PHP warnings on almost all the sites. Something like the following:

Cron Troubles in Drupal? Here's a Tip

I recently had a problem with cron on one of my Drupal sites, related to an issue I'll be posting about soon (namely, using Drupal's built-in search with more than 4.5 million entries in the search_index table). When I manually tried running cron, I got a "Cron failed" status message. I checked the log, and it said "Attempting to re-run cron while it is already running."

Apparently, something had messed up (probably due to the fact that I was messing with database tables while cron was working on them) with the previous cron job, and Drupal couldn't start a new cron job anymore. So, with the handy help of Google, I found part of a solution to my cron woes in the forums. Here's what I did to prevent this cron error from happening again: