Page MenuHomeFreeBSD

libprocstat: handle race condition while retrieving thread kernel stacks
Needs ReviewPublic

Authored by wollman on Mar 8 2016, 10:45 PM.
This revision needs review, but there are no reviewers specified.



When retrieving kernel stacks using sysctl (as for procstat -kk on a running kernel), thread creation can race with allocating the buffer to hold the sysctl results, so the operation fails with [ENOMEM]. As a heuristic, assume that the number of threads (and thus the required buffer size) will at most double during this interval.

Test Plan

I have a machine where this happens somewhat regularly with nfsd and will be installing it there to see if the errors go away completely.

Diff Detail

rS FreeBSD src repository
Lint Skipped
Unit Tests Skipped

Event Timeline

wollman updated this revision to Diff 14180.Mar 8 2016, 10:45 PM
wollman retitled this revision from to libprocstat: handle race condition while retrieving thread kernel stacks.
wollman updated this object.
wollman edited the test plan for this revision. (Show Details)
wollman set the repository for this revision to rS FreeBSD src repository.