Fix prof_tctx_dump_iter() to filter.

Fix prof_tctx_dump_iter() to filter out nodes that were created after
heap profile dumping started.  Prior to this fix, spurious entries with
arbitrary object/byte counts could appear in heap profiles, which
resulted in jeprof inaccuracies or failures.
This commit is contained in:
Jason Evans 2015-09-21 18:37:18 -07:00
parent 486d249fb4
commit fb64ec29ec
2 changed files with 23 additions and 5 deletions

View File

@ -4,6 +4,12 @@ brevity. Much more detail can be found in the git revision history:
https://github.com/jemalloc/jemalloc https://github.com/jemalloc/jemalloc
* 4.0.3 (XXX)
Bug fixes:
- Fix prof_tctx_dump_iter() to filter out nodes that were created after heap
profile dumping started.
* 4.0.2 (September 21, 2015) * 4.0.2 (September 21, 2015)
This bugfix release addresses a few bugs specific to heap profiling. This bugfix release addresses a few bugs specific to heap profiling.

View File

@ -1102,11 +1102,23 @@ prof_tctx_dump_iter(prof_tctx_tree_t *tctxs, prof_tctx_t *tctx, void *arg)
{ {
bool propagate_err = *(bool *)arg; bool propagate_err = *(bool *)arg;
if (prof_dump_printf(propagate_err, switch (tctx->state) {
" t%"FMTu64": %"FMTu64": %"FMTu64" [%"FMTu64": %"FMTu64"]\n", case prof_tctx_state_initializing:
tctx->thr_uid, tctx->dump_cnts.curobjs, tctx->dump_cnts.curbytes, case prof_tctx_state_nominal:
tctx->dump_cnts.accumobjs, tctx->dump_cnts.accumbytes)) /* Not captured by this dump. */
return (tctx); break;
case prof_tctx_state_dumping:
case prof_tctx_state_purgatory:
if (prof_dump_printf(propagate_err,
" t%"FMTu64": %"FMTu64": %"FMTu64" [%"FMTu64": "
"%"FMTu64"]\n", tctx->thr_uid, tctx->dump_cnts.curobjs,
tctx->dump_cnts.curbytes, tctx->dump_cnts.accumobjs,
tctx->dump_cnts.accumbytes))
return (tctx);
break;
default:
not_reached();
}
return (NULL); return (NULL);
} }