Comment 3 for bug 1187040

Revision history for this message
Joe (joegrasse) wrote :

After more digging, when the interval lines up with the total bench time you have a condition percentile->values and percentile->tmp are getting freed then then used. To mitigate most of the cores I encountered I change sb_percentile_reset and sb_percentile_done in sb_percentile.c to the following. This isn't a complete/proper fix though.

void sb_percentile_reset(sb_percentile_t *percentile)
{
  int err;

  err = pthread_mutex_lock(&percentile->mutex);
  if( err == 0){
    percentile->total = 0;
    memset(percentile->values, 0, percentile->size * sizeof(unsigned long long));
    pthread_mutex_unlock(&percentile->mutex);
  }
}

void sb_percentile_done(sb_percentile_t *percentile)
{
  int err;

  err = pthread_mutex_destroy(&percentile->mutex);
  if( err == 0){
    free(percentile->values);
    free(percentile->tmp);
  }
}

Another workaround is to use an interval that doesn't line up to total test time.